[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/ParserNonXS.pm (_end_line_misc_line)
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/ParserNonXS.pm (_end_line_misc_line), tp/Texinfo/XS/parsetexi/end_line.c (end_line_misc_line): remove setfilename or include from tre before starting a new preformatted, in preformatted context. |
Date: |
Sun, 15 Jan 2023 17:44:42 -0500 |
This is an automated email from the git hooks/post-receive script.
pertusus pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new 3b7531e437 * tp/Texinfo/ParserNonXS.pm (_end_line_misc_line),
tp/Texinfo/XS/parsetexi/end_line.c (end_line_misc_line): remove setfilename or
include from tre before starting a new preformatted, in preformatted context.
3b7531e437 is described below
commit 3b7531e4376f5da01d8363736056f9e58b0805b7
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Jan 15 23:43:24 2023 +0100
* tp/Texinfo/ParserNonXS.pm (_end_line_misc_line),
tp/Texinfo/XS/parsetexi/end_line.c (end_line_misc_line): remove
setfilename or include from tre before starting a new preformatted,
in preformatted context.
* tp/t/80include.t, tp/Makefile.tres: add test
include_with_setfilename_in_preformatted that tests @include in
@example, with a @setfilename in the included file.
---
ChangeLog | 11 ++
tp/Makefile.tres | 1 +
tp/Texinfo/ParserNonXS.pm | 12 +-
tp/Texinfo/XS/parsetexi/end_line.c | 11 +-
tp/t/80include.t | 5 +
.../include_with_setfilename_in_preformatted.pl | 126 +++++++++++++++++++++
6 files changed, 156 insertions(+), 10 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8e9a817a5f..4f1e111302 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2023-01-15 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/ParserNonXS.pm (_end_line_misc_line),
+ tp/Texinfo/XS/parsetexi/end_line.c (end_line_misc_line): remove
+ setfilename or include from tre before starting a new preformatted,
+ in preformatted context.
+
+ * tp/t/80include.t, tp/Makefile.tres: add test
+ include_with_setfilename_in_preformatted that tests @include in
+ @example, with a @setfilename in the included file.
+
2023-01-15 Gavin Smith <gavinsmith0123@gmail.com>
* system.h (DEFAULT_TMPDIR): Remove all uses, eliminating
diff --git a/tp/Makefile.tres b/tp/Makefile.tres
index a58a80acd0..550f432203 100644
--- a/tp/Makefile.tres
+++ b/tp/Makefile.tres
@@ -686,6 +686,7 @@ test_files_generated_list =
$(test_tap_files_generated_list) \
t/results/include/include_space.pl \
t/results/include/include_space_comment.pl \
t/results/include/include_with_setfilename.pl \
+ t/results/include/include_with_setfilename_in_preformatted.pl \
t/results/include/macro_and_commands_in_early_commands.pl \
t/results/include/macro_definition_in_include.pl \
t/results/include/macro_in_early_commands.pl \
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 888b472847..a8edc57cd9 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -3247,14 +3247,16 @@ sub _end_line_misc_line($$$)
if ($close_preformatted_commands{$end_command});
}
} else {
+ # Ignore @setfilename in included file, as said in the manual.
+ if ($included_file
+ or ($command eq 'setfilename' and _in_include($self))) {
+ pop @{$current->{'contents'}};
+ }
$current = _begin_preformatted($self, $current)
if ($close_preformatted_commands{$command});
}
- # Ignore @setfilename in included file, as said in the manual.
- if ($included_file
- or ($command eq 'setfilename' and _in_include($self))) {
- pop @{$current->{'contents'}};
- } elsif ($command eq 'setfilename'
+
+ if ($command eq 'setfilename'
and ($self->{'current_node'} or $self->{'current_section'})) {
$self->_command_warn($misc_cmd, $source_info,
__("\@%s after the first element"), $command);
diff --git a/tp/Texinfo/XS/parsetexi/end_line.c
b/tp/Texinfo/XS/parsetexi/end_line.c
index fbedf51bf5..6a128bac73 100644
--- a/tp/Texinfo/XS/parsetexi/end_line.c
+++ b/tp/Texinfo/XS/parsetexi/end_line.c
@@ -1878,15 +1878,16 @@ end_line_misc_line (ELEMENT *current)
}
else
{
+ /* If a file was included, remove the include command completely.
+ Also ignore @setfilename in included file, as said in the manual. */
+ if (included_file || (cmd == CM_setfilename && top_file_index () > 0))
+ destroy_element_and_children (pop_element_from_contents (current));
+
if (close_preformatted_command (cmd))
current = begin_preformatted (current);
}
- /* If a file was included, remove the include command completely.
- Also ignore @setfilename in included file, as said in the manual. */
- if (included_file || (cmd == CM_setfilename && top_file_index () > 0))
- destroy_element_and_children (pop_element_from_contents (current));
- else if (cmd == CM_setfilename && (current_node || current_section))
+ if (cmd == CM_setfilename && (current_node || current_section))
command_warn (misc_cmd, "@setfilename after the first element");
else if (cmd == CM_columnfractions)
{
diff --git a/tp/t/80include.t b/tp/t/80include.t
index f61b47e75c..8df746f118 100644
--- a/tp/t/80include.t
+++ b/tp/t/80include.t
@@ -142,6 +142,11 @@ After.'],
'@include included_file_with_setfilename.texi
@setfilename include_with_setfilename.info
', {'test_formats' => ['info']}],
+['include_with_setfilename_in_preformatted',
+'@example
+@include included_file_with_setfilename.texi
+after include
+@end example', {'test_formats' => ['info']}],
['include_setfilename_on_setfilename_line',
'@setfilename file @setfilename other file @include are you joking!
'],
diff --git a/tp/t/results/include/include_with_setfilename_in_preformatted.pl
b/tp/t/results/include/include_with_setfilename_in_preformatted.pl
new file mode 100644
index 0000000000..9f48243adb
--- /dev/null
+++ b/tp/t/results/include/include_with_setfilename_in_preformatted.pl
@@ -0,0 +1,126 @@
+use vars qw(%result_texis %result_texts %result_trees %result_errors
+ %result_indices %result_sectioning %result_nodes %result_menus
+ %result_floats %result_converted %result_converted_errors
+ %result_elements %result_directions_text %result_indices_sort_strings);
+
+use utf8;
+
+$result_trees{'include_with_setfilename_in_preformatted'} = {
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'args' => [
+ {
+ 'info' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'type' => 'block_line_arg'
+ }
+ ],
+ 'cmdname' => 'example',
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'text' => '
+',
+ 'type' => 'empty_line'
+ },
+ {
+ 'text' => 'In included file.
+'
+ },
+ {
+ 'text' => 'after include
+'
+ }
+ ],
+ 'type' => 'preformatted'
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'example'
+ }
+ ],
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'end',
+ 'extra' => {
+ 'text_arg' => 'example'
+ },
+ 'info' => {
+ 'spaces_before_argument' => ' '
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 4,
+ 'macro' => ''
+ }
+ }
+ ],
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => ''
+ }
+ }
+ ],
+ 'type' => 'before_node_section'
+ }
+ ],
+ 'type' => 'document_root'
+};
+
+$result_texis{'include_with_setfilename_in_preformatted'} = '@example
+
+In included file.
+after include
+@end example';
+
+
+$result_texts{'include_with_setfilename_in_preformatted'} = '
+In included file.
+after include
+';
+
+$result_errors{'include_with_setfilename_in_preformatted'} = [];
+
+
+$result_floats{'include_with_setfilename_in_preformatted'} = {};
+
+
+
+$result_converted{'info'}->{'include_with_setfilename_in_preformatted'} =
'This is , produced from .
+
+
+ In included file.
+ after include
+
+
+Tag Table:
+
+End Tag Table
+
+
+Local Variables:
+coding: utf-8
+End:
+';
+
+$result_converted_errors{'info'}->{'include_with_setfilename_in_preformatted'}
= [
+ {
+ 'error_line' => 'warning: document without nodes
+',
+ 'text' => 'document without nodes',
+ 'type' => 'warning'
+ }
+];
+
+
+1;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/ParserNonXS.pm (_end_line_misc_line), tp/Texinfo/XS/parsetexi/end_line.c (end_line_misc_line): remove setfilename or include from tre before starting a new preformatted, in preformatted context.,
Patrice Dumas <=