[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Convert/TexinfoMarkup.pm (_convert),
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Convert/TexinfoMarkup.pm (_convert), util/txixml2texi.pl: always add end of line for the block command lines. |
Date: |
Mon, 12 Dec 2022 10:30:15 -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 3a88058955 * tp/Texinfo/Convert/TexinfoMarkup.pm (_convert),
util/txixml2texi.pl: always add end of line for the block command lines.
3a88058955 is described below
commit 3a88058955e7c474482690e4f8b45631358453d4
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Dec 12 16:30:01 2022 +0100
* tp/Texinfo/Convert/TexinfoMarkup.pm (_convert), util/txixml2texi.pl:
always add end of line for the block command lines.
* t/57invalid_nestings.t (@formatted_cases): add
section_on_cartouche_line.
---
ChangeLog | 8 +
tp/Texinfo/Convert/TexinfoMarkup.pm | 15 +-
tp/t/57invalid_nestings.t | 5 +
.../results/converters_tests/at_commands_in_raw.pl | 3 +-
.../invalid_nestings/section_on_cartouche_line.pl | 196 +++++++++++++++++++++
.../invalid_nestings/section_on_xtable_line.pl | 12 +-
.../codequoteundirected_codequotebacktick.pl | 6 +-
tp/t/results/raw/beginning_and_end_on_line.pl | 9 +-
tp/t/results/raw/nested_macros.pl | 3 +-
tp/t/results/xml_tests/macro_and_args.pl | 6 +-
tp/t/results/xtable/table_nested.pl | 3 +-
.../res_parser/formatting_xml/formatting.xml | 1 +
util/txixml2texi.pl | 1 -
13 files changed, 251 insertions(+), 17 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 53102f616e..5d585f7372 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-12-12 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Convert/TexinfoMarkup.pm (_convert), util/txixml2texi.pl:
+ always add end of line for the block command lines.
+
+ * t/57invalid_nestings.t (@formatted_cases): add
+ section_on_cartouche_line.
+
2022-12-11 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/TexinfoMarkup.pm (_convert), util/texinfo.dtd: if
diff --git a/tp/Texinfo/Convert/TexinfoMarkup.pm
b/tp/Texinfo/Convert/TexinfoMarkup.pm
index 938dc8c44c..5186591e88 100644
--- a/tp/Texinfo/Convert/TexinfoMarkup.pm
+++ b/tp/Texinfo/Convert/TexinfoMarkup.pm
@@ -481,6 +481,7 @@ sub _end_line_spaces
return $end_spaces;
}
+# no end of line
sub _arg_line($)
{
my $self = shift;
@@ -1513,12 +1514,22 @@ sub _convert($$;$)
$result .= "\n";
}
} else {
- # get end of lines from @*table and block @-commands with
- # no argument that have a bogus argument.
+ # get end of lines from @*table and block @-commands that
+ # usually have arguments but with missing or bogus arguments,
+ # and from block @-commands without argument.
$result .= _end_line_spaces($self, $element);
$result .= $self->format_comment_or_return_end_line($element);
+ # systematic for @(r)macro as _arg_line removes the end of line,
+ # also happens for commands interrupted on the line
+ $result .= "\n" unless ($result =~ /\n/);
}
}
+ } else {
+ # happens for @def* as @def* line args are in
+ # the first def contents, the def_line type.
+ # happens for bogus empty @macro immediately followed by
+ # newline.
+ #print STDERR "no args: $element->{'cmdname'}\n";
}
unshift @close_format_elements, $element->{'cmdname'};
}
diff --git a/tp/t/57invalid_nestings.t b/tp/t/57invalid_nestings.t
index b71fb32565..e78ddcea8e 100644
--- a/tp/t/57invalid_nestings.t
+++ b/tp/t/57invalid_nestings.t
@@ -572,6 +572,11 @@ Something
@itemize @ringaccent @section fourth
'],
+['section_on_cartouche_line',
+'@cartouche@section first
+
+@cartouche @section second spaces
+'],
['ignored_text',
'@node before ignore @ifinfo
in ifinfo
diff --git a/tp/t/results/converters_tests/at_commands_in_raw.pl
b/tp/t/results/converters_tests/at_commands_in_raw.pl
index 82e452141b..7d5bb57ec2 100644
--- a/tp/t/results/converters_tests/at_commands_in_raw.pl
+++ b/tp/t/results/converters_tests/at_commands_in_raw.pl
@@ -1293,7 +1293,8 @@ $result_converted{'html_text'}->{'at_commands_in_raw'} =
'<div class="top-level-
$result_converted{'xml'}->{'at_commands_in_raw'} = '<node name="Top" spaces="
"><nodename>Top</nodename><nodenext automatic="on">chap</nodenext></node>
<top spaces=" "><sectiontitle>top</sectiontitle>
-<macro name="othermacro" line=" othermacro{}" endspaces=" ">Other macro
+<macro name="othermacro" line=" othermacro{}" endspaces=" ">
+Other macro
</macro>
</top>
diff --git a/tp/t/results/invalid_nestings/section_on_cartouche_line.pl
b/tp/t/results/invalid_nestings/section_on_cartouche_line.pl
new file mode 100644
index 0000000000..ddfa27ceb0
--- /dev/null
+++ b/tp/t/results/invalid_nestings/section_on_cartouche_line.pl
@@ -0,0 +1,196 @@
+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{'section_on_cartouche_line'} = {
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'args' => [
+ {
+ 'type' => 'block_line_arg'
+ }
+ ],
+ 'cmdname' => 'cartouche',
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => ''
+ }
+ }
+ ],
+ 'type' => 'before_node_section'
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'first'
+ }
+ ],
+ 'info' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'section',
+ 'contents' => [
+ {
+ 'text' => '
+',
+ 'type' => 'empty_line'
+ },
+ {
+ 'args' => [
+ {
+ 'type' => 'block_line_arg'
+ }
+ ],
+ 'cmdname' => 'cartouche',
+ 'info' => {
+ 'spaces_before_argument' => ' '
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 3,
+ 'macro' => ''
+ }
+ }
+ ],
+ 'info' => {
+ 'spaces_before_argument' => ' '
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => ''
+ }
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'second spaces'
+ }
+ ],
+ 'info' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'section',
+ 'info' => {
+ 'spaces_before_argument' => ' '
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 3,
+ 'macro' => ''
+ }
+ }
+ ],
+ 'type' => 'document_root'
+};
+
+$result_texis{'section_on_cartouche_line'} = '@cartouche@section first
+
+@cartouche @section second spaces
+';
+
+
+$result_texts{'section_on_cartouche_line'} = '1 first
+=======
+
+2 second spaces
+===============
+';
+
+$result_sectioning{'section_on_cartouche_line'} = {
+ 'structure' => {
+ 'section_childs' => [
+ {
+ 'cmdname' => 'section',
+ 'info' => {},
+ 'structure' => {
+ 'section_level' => 2,
+ 'section_number' => 1,
+ 'section_up' => {}
+ }
+ },
+ {
+ 'cmdname' => 'section',
+ 'info' => {},
+ 'structure' => {
+ 'section_level' => 2,
+ 'section_number' => 2,
+ 'section_prev' => {},
+ 'section_up' => {},
+ 'toplevel_prev' => {}
+ }
+ }
+ ],
+ 'section_level' => 1
+ }
+};
+$result_sectioning{'section_on_cartouche_line'}{'structure'}{'section_childs'}[0]{'structure'}{'section_up'}
= $result_sectioning{'section_on_cartouche_line'};
+$result_sectioning{'section_on_cartouche_line'}{'structure'}{'section_childs'}[1]{'structure'}{'section_prev'}
=
$result_sectioning{'section_on_cartouche_line'}{'structure'}{'section_childs'}[0];
+$result_sectioning{'section_on_cartouche_line'}{'structure'}{'section_childs'}[1]{'structure'}{'section_up'}
= $result_sectioning{'section_on_cartouche_line'};
+$result_sectioning{'section_on_cartouche_line'}{'structure'}{'section_childs'}[1]{'structure'}{'toplevel_prev'}
=
$result_sectioning{'section_on_cartouche_line'}{'structure'}{'section_childs'}[0];
+
+$result_errors{'section_on_cartouche_line'} = [
+ {
+ 'error_line' => '@section seen before @end cartouche
+',
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => '',
+ 'text' => '@section seen before @end cartouche',
+ 'type' => 'error'
+ },
+ {
+ 'error_line' => '@section seen before @end cartouche
+',
+ 'file_name' => '',
+ 'line_nr' => 3,
+ 'macro' => '',
+ 'text' => '@section seen before @end cartouche',
+ 'type' => 'error'
+ }
+];
+
+
+$result_floats{'section_on_cartouche_line'} = {};
+
+
+
+$result_converted{'plaintext'}->{'section_on_cartouche_line'} = '1 first
+=======
+
+2 second spaces
+===============
+
+';
+
+
+$result_converted{'xml'}->{'section_on_cartouche_line'} = '<cartouche>
+</cartouche>
+<section spaces=" "><sectiontitle>first</sectiontitle>
+
+<cartouche spaces=" ">
+</cartouche>
+</section>
+<section spaces=" "><sectiontitle>second spaces</sectiontitle>
+</section>
+';
+
+1;
diff --git a/tp/t/results/invalid_nestings/section_on_xtable_line.pl
b/tp/t/results/invalid_nestings/section_on_xtable_line.pl
index b21ddcfb60..051cced4b9 100644
--- a/tp/t/results/invalid_nestings/section_on_xtable_line.pl
+++ b/tp/t/results/invalid_nestings/section_on_xtable_line.pl
@@ -511,18 +511,22 @@
$result_converted{'plaintext'}->{'section_on_xtable_line'} = '1 first
';
-$result_converted{'xml'}->{'section_on_xtable_line'} = '<vtable
commandarg="asis" automaticcommandarg="on" spaces=" "></vtable>
+$result_converted{'xml'}->{'section_on_xtable_line'} = '<vtable
commandarg="asis" automaticcommandarg="on" spaces=" ">
+</vtable>
<section spaces=" "><sectiontitle>first</sectiontitle>
-<table commandarg="asis" automaticcommandarg="on" spaces=" "> </table>
+<table commandarg="asis" automaticcommandarg="on" spaces=" ">
+</table>
</section>
<section spaces=" "><sectiontitle>second</sectiontitle>
-<table commandarg="code" spaces=" "> </table>
+<table commandarg="code" spaces=" ">
+</table>
</section>
<section spaces=" "><sectiontitle>third</sectiontitle>
-<ftable commandarg="asis" automaticcommandarg="on" spaces=" "></ftable>
+<ftable commandarg="asis" automaticcommandarg="on" spaces=" ">
+</ftable>
</section>
<section spaces=" "><sectiontitle>fourth</sectiontitle>
</section>
diff --git
a/tp/t/results/misc_commands/codequoteundirected_codequotebacktick.pl
b/tp/t/results/misc_commands/codequoteundirected_codequotebacktick.pl
index c2dce5160d..fa06f2465a 100644
--- a/tp/t/results/misc_commands/codequoteundirected_codequotebacktick.pl
+++ b/tp/t/results/misc_commands/codequoteundirected_codequotebacktick.pl
@@ -4474,7 +4474,8 @@ samp:
‘<literal>``simple-double--three---four----\'\' `simple\' quotedblle
';
-$result_converted{'xml'}->{'codequoteundirected_codequotebacktick'} = '<macro
name="quotes" line=" quotes" endspaces="
">``simple-double--three---four----\'\' `simple\' quotedblleft: @quotedblleft{}
@*
+$result_converted{'xml'}->{'codequoteundirected_codequotebacktick'} = '<macro
name="quotes" line=" quotes" endspaces=" ">
+``simple-double--three---four----\'\' `simple\' quotedblleft: @quotedblleft{}
@*
code: @code{``simple-double--three---four----\'\' `simple\' quotedblleft:
@quotedblleft{}} @*
asis: @asis{``simple-double--three---four----\'\' `simple\' quotedblleft:
@quotedblleft{}} @*
strong: @strong{``simple-double--three---four----\'\' `simple\' quotedblleft:
@quotedblleft{}} @*
@@ -4482,7 +4483,8 @@ kbd: @kbd{``simple-double--three---four----\'\' `simple\'
quotedblleft: @quotedb
samp: @samp{``simple-double--three---four----\'\' `simple\' quotedblleft:
@quotedblleft{}} @*
</macro>
-<macro name="allquotes" line=" allquotes" endspaces=" ">@quotes{}
+<macro name="allquotes" line=" allquotes" endspaces=" ">
+@quotes{}
@example
@@codequoteundirected on
diff --git a/tp/t/results/raw/beginning_and_end_on_line.pl
b/tp/t/results/raw/beginning_and_end_on_line.pl
index b6383a8390..c9fea17de4 100644
--- a/tp/t/results/raw/beginning_and_end_on_line.pl
+++ b/tp/t/results/raw/beginning_and_end_on_line.pl
@@ -250,11 +250,14 @@
$result_converted{'plaintext'}->{'beginning_and_end_on_line'} = '
$result_converted{'xml'}->{'beginning_and_end_on_line'} = '
-<tex spaces=" " endspaces=" "> </tex>
+<tex spaces=" " endspaces=" ">
+</tex>
-<verbatim xml:space="preserve" spaces=" " endspaces=" "> </verbatim>
+<verbatim xml:space="preserve" spaces=" " endspaces=" ">
+</verbatim>
-<html spaces=" " endspaces=" "> </html>
+<html spaces=" " endspaces=" ">
+</html>
';
1;
diff --git a/tp/t/results/raw/nested_macros.pl
b/tp/t/results/raw/nested_macros.pl
index b1ec47b2ee..e4e39220f5 100644
--- a/tp/t/results/raw/nested_macros.pl
+++ b/tp/t/results/raw/nested_macros.pl
@@ -179,7 +179,8 @@ $result_floats{'nested_macros'} = {};
$result_converted{'plaintext'}->{'nested_macros'} = '';
-$result_converted{'xml'}->{'nested_macros'} = '<macro name="truc" line=" truc
{ arg, ex}" endspaces="
"><formalarg>arg</formalarg><formalarg>ex</formalarg>in macro \\arg\\
+$result_converted{'xml'}->{'nested_macros'} = '<macro name="truc" line=" truc
{ arg, ex}" endspaces=" "><formalarg>arg</formalarg><formalarg>ex</formalarg>
+in macro \\arg\\
<macro line=" othermacro " endspaces=" ">other macro
</macro>
<macro endspaces=" "></macro>
diff --git a/tp/t/results/xml_tests/macro_and_args.pl
b/tp/t/results/xml_tests/macro_and_args.pl
index 747e0e3f40..edca54d8b6 100644
--- a/tp/t/results/xml_tests/macro_and_args.pl
+++ b/tp/t/results/xml_tests/macro_and_args.pl
@@ -177,9 +177,11 @@ $result_floats{'macro_and_args'} = {};
-$result_converted{'xml'}->{'macro_and_args'} = '<macro name="good" line=" good
{ aaa, 2b-bb}" endspaces="
"><formalarg>aaa</formalarg><formalarg>2b-bb</formalarg></macro>
+$result_converted{'xml'}->{'macro_and_args'} = '<macro name="good" line=" good
{ aaa, 2b-bb}" endspaces="
"><formalarg>aaa</formalarg><formalarg>2b-bb</formalarg>
+</macro>
-<macro name="bad" line=" bad { ggg"@@^_ ff, nnn_b, ccc v}" endspaces="
"><formalarg>ggg"@@^_
ff</formalarg><formalarg>nnn_b</formalarg><formalarg>ccc v</formalarg></macro>
+<macro name="bad" line=" bad { ggg"@@^_ ff, nnn_b, ccc v}" endspaces="
"><formalarg>ggg"@@^_
ff</formalarg><formalarg>nnn_b</formalarg><formalarg>ccc v</formalarg>
+</macro>
';
1;
diff --git a/tp/t/results/xtable/table_nested.pl
b/tp/t/results/xtable/table_nested.pl
index ad198a78ec..8a71d0b55a 100644
--- a/tp/t/results/xtable/table_nested.pl
+++ b/tp/t/results/xtable/table_nested.pl
@@ -2328,7 +2328,8 @@ Something.
';
-$result_converted{'xml'}->{'table_nested'} = '<macro name="myvtable" line="
myvtable" endspaces=" ">@vtable @asis
+$result_converted{'xml'}->{'table_nested'} = '<macro name="myvtable" line="
myvtable" endspaces=" ">
+@vtable @asis
@item first item
@itemx second itemx
diff --git a/tp/tests/layout/res_parser/formatting_xml/formatting.xml
b/tp/tests/layout/res_parser/formatting_xml/formatting.xml
index 24721d4502..1ac4ac48f8 100644
--- a/tp/tests/layout/res_parser/formatting_xml/formatting.xml
+++ b/tp/tests/layout/res_parser/formatting_xml/formatting.xml
@@ -20,6 +20,7 @@
<defcodeindex spaces=" " value="codeidx" line="codeidx"></defcodeindex>
<macro name="mymacro" line=" mymacro" endspaces=" ">
+
<
>
"
diff --git a/util/txixml2texi.pl b/util/txixml2texi.pl
index a8b4f3c7d2..cf7eb36523 100755
--- a/util/txixml2texi.pl
+++ b/util/txixml2texi.pl
@@ -344,7 +344,6 @@ while ($reader->read) {
if ($reader->hasAttributes() and
defined($reader->getAttribute('line'))) {
print $reader->getAttribute('line');
}
- print "\n";
} else {
# leading spaces are already in the line attribute for (r)macro
print "$spaces";
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Convert/TexinfoMarkup.pm (_convert), util/txixml2texi.pl: always add end of line for the block command lines.,
Patrice Dumas <=