[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Convert/DocBook.pm (output), tp/Texi
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Convert/DocBook.pm (output), tp/Texinfo/Convert/LaTeX.pm (_prepare_conversion, _convert), tp/Texinfo/Convert/Plaintext.pm (_convert): check existence of contents instead of relying on {'extra'}->{'missing_argument'}. |
Date: |
Sun, 22 Oct 2023 12:37:13 -0400 |
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 f557ec5379 * tp/Texinfo/Convert/DocBook.pm (output),
tp/Texinfo/Convert/LaTeX.pm (_prepare_conversion, _convert),
tp/Texinfo/Convert/Plaintext.pm (_convert): check existence of contents instead
of relying on {'extra'}->{'missing_argument'}.
f557ec5379 is described below
commit f557ec537974bc214f3bfc5af525589c6ab9b24e
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Oct 22 18:37:01 2023 +0200
* tp/Texinfo/Convert/DocBook.pm (output), tp/Texinfo/Convert/LaTeX.pm
(_prepare_conversion, _convert), tp/Texinfo/Convert/Plaintext.pm
(_convert): check existence of contents instead of relying on
{'extra'}->{'missing_argument'}.
* tp/Texinfo/Convert/LaTeX.pm (_associate_other_nodes_to_sections,
_convert), tp/Texinfo/Convert/Plaintext.pm (_convert): avoid erroneous
autovivification.
---
ChangeLog | 11 +++++++++
tp/Texinfo/Convert/DocBook.pm | 16 +++++--------
tp/Texinfo/Convert/LaTeX.pm | 21 +++++++---------
tp/Texinfo/Convert/Plaintext.pm | 28 +++++-----------------
tp/t/results/converters_tests/line_breaks.pl | 2 --
.../converters_tests/spaces_in_empty_node_names.pl | 3 ---
.../misc_commands/comment_space_command_on_line.pl | 1 -
.../res_parser/formatting_latex/formatting.tex | 5 ++++
8 files changed, 36 insertions(+), 51 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index cd2939c9a0..2d8643f33a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2023-10-22 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Convert/DocBook.pm (output), tp/Texinfo/Convert/LaTeX.pm
+ (_prepare_conversion, _convert), tp/Texinfo/Convert/Plaintext.pm
+ (_convert): check existence of contents instead of relying on
+ {'extra'}->{'missing_argument'}.
+
+ * tp/Texinfo/Convert/LaTeX.pm (_associate_other_nodes_to_sections,
+ _convert), tp/Texinfo/Convert/Plaintext.pm (_convert): avoid erroneous
+ autovivification.
+
2023-10-22 Patrice Dumas <pertusus@free.fr>
* doc/texi2any_api.texi (Command Tree Element Conversion Functions),
diff --git a/tp/Texinfo/Convert/DocBook.pm b/tp/Texinfo/Convert/DocBook.pm
index 0db5da6ef7..963af22700 100644
--- a/tp/Texinfo/Convert/DocBook.pm
+++ b/tp/Texinfo/Convert/DocBook.pm
@@ -404,9 +404,8 @@ sub output($$)
foreach my $title_cmdname ('title', 'shorttitlepage', 'titlefont') {
if ($self->{'global_commands'}->{$title_cmdname}) {
my $command = $self->{'global_commands'}->{$title_cmdname};
- next if (!$command->{'args'}
- or !$command->{'args'}->[0]->{'contents'}
- or $command->{'extra'}->{'missing_argument'});
+ next if (!$command->{'args'} or !$command->{'args'}->[0]
+ or !$command->{'args'}->[0]->{'contents'});
$fulltitle_command = $command;
last;
}
@@ -459,10 +458,8 @@ sub output($$)
if ($self->{'global_commands'}->{'settitle'}) {
my $command = $self->{'global_commands'}->{'settitle'};
$settitle_command = $command
- unless (!$command->{'args'}
- or !$command->{'args'}->[0]->{'contents'}
- or $command->{'extra'}->{'missing_argument'});
-
+ unless (!$command->{'args'} or !$command->{'args'}->[0]
+ or !$command->{'args'}->[0]->{'contents'});
}
my $titleabbrev_command;
@@ -475,9 +472,8 @@ sub output($$)
# preceding it, so we also use @top
my $command = $self->{'global_commands'}->{'top'};
$fulltitle_command = $command
- unless (!$command->{'args'}
- or !$command->{'args'}->[0]->{'contents'}
- or $command->{'extra'}->{'missing_argument'});
+ unless (!$command->{'args'} or !$command->{'args'}->[0]
+ or !$command->{'args'}->[0]->{'contents'});
}
my $title_info = '';
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index be7d26d8d5..24aa706344 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -988,9 +988,7 @@ sub _prepare_conversion($;$)
if ($self->{'global_commands'}->{'settitle'}) {
my $settitle_root = $self->{'global_commands'}->{'settitle'};
if ($settitle_root->{'args'}->[0]
- and $settitle_root->{'args'}->[0]->{'contents'}
- and not ($settitle_root->{'extra'}
- and $settitle_root->{'extra'}->{'missing_argument'})) {
+ and $settitle_root->{'args'}->[0]->{'contents'}) {
$self->{'settitle_tree'} =
{'contents' => $settitle_root->{'args'}->[0]->{'contents'}};
}
@@ -1014,7 +1012,8 @@ sub _associate_other_nodes_to_sections($$)
foreach my $element_content (@{$root->{'contents'}}) {
if ($element_content->{'cmdname'}
and $element_content->{'cmdname'} eq 'node') {
- if (not $element_content->{'extra'}->{'associated_section'}
+ if ($element_content->{'extra'}
+ and not $element_content->{'extra'}->{'associated_section'}
and defined($element_content->{'extra'}->{'normalized'})) {
if (defined($current_sectioning_command)) {
$additional_node_section_associations
@@ -2685,13 +2684,6 @@ sub _convert($$)
}
}
- if ($element->{'extra'}) {
- if ($element->{'extra'}->{'missing_argument'}
- and (!$element->{'contents'} or !@{$element->{'contents'}})) {
- return $result;
- }
- }
-
# for displaymath that closes the preformatted
my $preformatted_to_reopen;
if ($cmdname) {
@@ -3735,7 +3727,8 @@ sub _convert($$)
}
if ($cmdname eq 'node') {
# add the label only if not associated with a section
- if (not $element->{'extra'}->{'associated_section'}) {
+ if (!$element->{'extra'}
+ or not $element->{'extra'}->{'associated_section'}) {
my $node_label
= _tree_anchor_label($element->{'args'}->[0]->{'contents'});
$result .= "\\label{$node_label}%\n";
@@ -3918,7 +3911,9 @@ sub _convert($$)
return $result;
} elsif ($cmdname eq 'sp') {
my $sp_nr = 1;
- if ($element->{'extra'}->{'misc_args'}->[0]) {
+ if ($element->{'extra'}
+ and $element->{'extra'}->{'misc_args'}
+ and $element->{'extra'}->{'misc_args'}->[0]) {
# this useless copy avoids perl changing the type to integer!
$sp_nr = $element->{'extra'}->{'misc_args'}->[0];
}
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index b7eee2710b..517efbee61 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -1861,17 +1861,6 @@ sub _convert($$)
}
}
- if ($element->{'extra'}) {
- # REMARK it is not that wise to rely on {'extra'}->{'missing_argument'}
- # being set, additional tests of $element->{'contents'}
- # being defined could be added, in addition to be more robust in case
- # {'extra'}->{'missing_argument'} is removed
- if ($element->{'extra'}->{'missing_argument'}
- and (!$element->{'contents'} or !@{$element->{'contents'}})) {
- return '';
- }
- }
-
if ($element->{'extra'} and $element->{'extra'}->{'index_entry'}
and !$self->{'multiple_pass'} and !$self->{'in_copying_header'}) {
my $location = $self->add_location($element);
@@ -1925,6 +1914,8 @@ sub _convert($$)
if ($self->{'current_node'}) {
$location->{'node'} = $self->{'current_node'};
}
+ $self->{'index_entries_line_location'} = {}
+ unless $self->{'index_entries_line_location'};
$self->{'index_entries_line_location'}->{$element} = $location;
}
@@ -2933,10 +2924,6 @@ sub _convert($$)
#my ($counts, $new_locations);
push @{$self->{'count_context'}}, {'lines' => 0, 'bytes' => 0,
'locations' => []};
- # $element->{'args'}->[0]->{'contents'} not set cannot happen
- # as in that case missing_argument would be set. This condition
- # is therefre not really needed, but still put in case missing_argument
- # disappears
my $result = '';
if ($element->{'args'}->[0]
and $element->{'args'}->[0]->{'contents'}) {
@@ -2959,10 +2946,6 @@ sub _convert($$)
return $result;
} elsif ($command eq 'exdent') {
$result = '';
- # $element->{'args'}->[0]->{'contents'} not set cannot happen
- # as in that case missing_argument would be set. This condition
- # is therefre not really needed, but still put in case missing_argument
- # disappears
if ($element->{'args'}->[0]
and $element->{'args'}->[0]->{'contents'}) {
if
($self->{'preformatted_context_commands'}->{$self->{'context'}->[-1]}) {
@@ -3083,7 +3066,10 @@ sub _convert($$)
_add_lines_count($self, $lines_count);
return $result;
} elsif ($command eq 'sp') {
- if ($element->{'extra'}->{'misc_args'}->[0]) {
+ # FIXME No argument should mean 1, not 0, to check
+ if ($element->{'extra'}
+ and $element->{'extra'}->{'misc_args'}
+ and $element->{'extra'}->{'misc_args'}->[0]) {
$result = _count_added($self, $formatter->{'container'},
add_pending_word($formatter->{'container'}));
# this useless copy avoids perl changing the type to integer!
@@ -3836,8 +3822,6 @@ sub _convert($$)
or $command eq 'smallquotation')
and $element->{'extra'} and $element->{'extra'}->{'authors'}) {
foreach my $author (@{$element->{'extra'}->{'authors'}}) {
- # this cannot happen as this should be caugth by 'missing_argument'
- # but it is more robust to check anyway
if ($author->{'args'}->[0]
and $author->{'args'}->[0]->{'contents'}) {
$result .= _convert($self,
diff --git a/tp/t/results/converters_tests/line_breaks.pl
b/tp/t/results/converters_tests/line_breaks.pl
index abc009763b..fa8f5a06a2 100644
--- a/tp/t/results/converters_tests/line_breaks.pl
+++ b/tp/t/results/converters_tests/line_breaks.pl
@@ -106,7 +106,6 @@ $result_trees{'line_breaks'} = {
}
],
'cmdname' => 'settitle',
- 'extra' => {},
'info' => {
'spaces_before_argument' => {
'text' => ' '
@@ -142,7 +141,6 @@ $result_trees{'line_breaks'} = {
}
],
'cmdname' => 'title',
- 'extra' => {},
'info' => {
'spaces_before_argument' => {
'text' => ' '
diff --git a/tp/t/results/converters_tests/spaces_in_empty_node_names.pl
b/tp/t/results/converters_tests/spaces_in_empty_node_names.pl
index 15eff4412b..9a8a6b716b 100644
--- a/tp/t/results/converters_tests/spaces_in_empty_node_names.pl
+++ b/tp/t/results/converters_tests/spaces_in_empty_node_names.pl
@@ -297,7 +297,6 @@ $result_trees{'spaces_in_empty_node_names'} = {
'type' => 'empty_line'
}
],
- 'extra' => {},
'info' => {
'spaces_before_argument' => {
'text' => ' '
@@ -353,7 +352,6 @@ $result_trees{'spaces_in_empty_node_names'} = {
'type' => 'empty_line'
}
],
- 'extra' => {},
'info' => {
'spaces_before_argument' => {
'text' => ' '
@@ -552,7 +550,6 @@ $result_trees{'spaces_in_empty_node_names'} = {
'type' => 'paragraph'
}
],
- 'extra' => {},
'info' => {
'spaces_before_argument' => {
'text' => ' '
diff --git a/tp/t/results/misc_commands/comment_space_command_on_line.pl
b/tp/t/results/misc_commands/comment_space_command_on_line.pl
index 19cf7a00ce..c7285a5ac4 100644
--- a/tp/t/results/misc_commands/comment_space_command_on_line.pl
+++ b/tp/t/results/misc_commands/comment_space_command_on_line.pl
@@ -36,7 +36,6 @@ $result_trees{'comment_space_command_on_line'} = {
}
],
'cmdname' => 'settitle',
- 'extra' => {},
'info' => {
'spaces_before_argument' => {
'text' => ' '
diff --git a/tp/tests/coverage/res_parser/formatting_latex/formatting.tex
b/tp/tests/coverage/res_parser/formatting_latex/formatting.tex
index d988db3838..71cc6fe62b 100644
--- a/tp/tests/coverage/res_parser/formatting_latex/formatting.tex
+++ b/tp/tests/coverage/res_parser/formatting_latex/formatting.tex
@@ -1622,6 +1622,7 @@ Invalid use of @':\leavevmode{}\\
\texttt{@image\{f{-}{-}ile,aze,az,@verb\{:jk \_" \%@:\}\ @b\{in b
"\},e{-}{-}xt\}} \includegraphics[width=aze,height=az]{f--ile}
\texttt{@image\{file@verb\{:jk \_" \%@:\}{,}{,},alt@verb\{:jk \_" \%@:\}\}}
\includegraphics{filejk _" \%@}
+\vskip 1\baselineskip %
{\bfseries author}%
@@ -3299,6 +3300,7 @@ Invalid use of @':\leavevmode{}\\
\texttt{@image\{f{-}{-}ile,aze,az,@verb\{:jk \_" \%@:\}\ @b\{in b
"\},e{-}{-}xt\}} \includegraphics[width=aze,height=az]{f--ile}
\texttt{@image\{file@verb\{:jk \_" \%@:\}{,}{,},alt@verb\{:jk \_" \%@:\}\}}
\includegraphics{filejk _" \%@}
+\vskip 1\baselineskip %
{\bfseries author}%
@@ -4993,6 +4995,7 @@ Invalid use of @':\leavevmode{}\\
\texttt{@image\{f{-}{-}ile,aze,az,@verb\{:jk \_" \%@:\}\ @b\{in b
"\},e{-}{-}xt\}} \includegraphics[width=aze,height=az]{f--ile}
\texttt{@image\{file@verb\{:jk \_" \%@:\}{,}{,},alt@verb\{:jk \_" \%@:\}\}}
\includegraphics{filejk _" \%@}
+\vskip 1\baselineskip %
{\bfseries author}%
@@ -6669,6 +6672,7 @@ Invalid use of @':\leavevmode{}\\
\texttt{@image\{f{-}{-}ile,aze,az,@verb\{:jk \_" \%@:\}\ @b\{in b
"\},e{-}{-}xt\}} \includegraphics[width=aze,height=az]{f--ile}
\texttt{@image\{file@verb\{:jk \_" \%@:\}{,}{,},alt@verb\{:jk \_" \%@:\}\}}
\includegraphics{filejk _" \%@}
+\vskip 1\baselineskip %
{\bfseries author}%
@@ -8810,6 +8814,7 @@ Invalid use of @':\leavevmode{}\\
\texttt{@image\{f{-}{-}ile,aze,az,@verb\{:jk \_" \%@:\}\ @b\{in b
"\},e{-}{-}xt\}}\ \includegraphics[width=aze,height=az]{f--ile}
\texttt{@image\{file@verb\{:jk \_" \%@:\}{,}{,},alt@verb\{:jk \_" \%@:\}\}}\
\includegraphics{filejk _" \%@}
+\vskip 1\baselineskip %
{\bfseries author}%
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Convert/DocBook.pm (output), tp/Texinfo/Convert/LaTeX.pm (_prepare_conversion, _convert), tp/Texinfo/Convert/Plaintext.pm (_convert): check existence of contents instead of relying on {'extra'}->{'missing_argument'}.,
Patrice Dumas <=
- Prev by Date:
branch master updated: * doc/texi2any_api.texi (Command Tree Element Conversion Functions), tp/Texinfo/Convert/HTML.pm (_convert, _convert_email_command) (_convert_explained_command, _convert_uref_command) (_convert_image_command, _convert_titlefont_command) (_convert_sp_command, _convert_center_command), tp/init/documentation_examples.pm, tp/init/html32.pm, tp/t/init/translate_txiinternalvalue_macro.init: if an argument is empty, set @$args for this argument to be undef instead of ignoring completly the command [...]
- Next by Date:
branch master updated: * tp/Texinfo/ParserNonXS.pm (_end_line_misc_line) (_parse_line_command_args), tp/Texinfo/XS/parsetexi/end_line.c (parse_line_command_args, end_line_misc_line): remove {'extra'}->{'missing_argument'} from tree.
- Previous by thread:
branch master updated: * doc/texi2any_api.texi (Command Tree Element Conversion Functions), tp/Texinfo/Convert/HTML.pm (_convert, _convert_email_command) (_convert_explained_command, _convert_uref_command) (_convert_image_command, _convert_titlefont_command) (_convert_sp_command, _convert_center_command), tp/init/documentation_examples.pm, tp/init/html32.pm, tp/t/init/translate_txiinternalvalue_macro.init: if an argument is empty, set @$args for this argument to be undef instead of ignoring completly the command [...]
- Next by thread:
branch master updated: * tp/Texinfo/ParserNonXS.pm (_end_line_misc_line) (_parse_line_command_args), tp/Texinfo/XS/parsetexi/end_line.c (parse_line_command_args, end_line_misc_line): remove {'extra'}->{'missing_argument'} from tree.
- Index(es):