[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/ParserNonXS.pm (_parse_line_command_
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/ParserNonXS.pm (_parse_line_command_args): remove a useless argument of sprintf. |
Date: |
Sun, 29 Sep 2024 09:59:17 -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 9d3f3fca55 * tp/Texinfo/ParserNonXS.pm (_parse_line_command_args):
remove a useless argument of sprintf.
9d3f3fca55 is described below
commit 9d3f3fca556232cda77fbf4dfbe3f87726f6b04e
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Jul 1 23:40:26 2024 +0200
* tp/Texinfo/ParserNonXS.pm (_parse_line_command_args): remove a
useless argument of sprintf.
* tp/Texinfo/Convert/DocBook.pm (_convert): handle better @-command
defined with definfoenclose missing braces and with 0 args.
* tp/Makefile.tres, tp/t/03coverage_braces.t
(definfoenclose_bad_argument, definfoenclose_no_braces): new tests.
---
ChangeLog | 11 ++
tp/Makefile.tres | 2 +
tp/Texinfo/Convert/DocBook.pm | 6 +-
tp/Texinfo/Convert/HTML.pm | 4 +-
tp/Texinfo/ParserNonXS.pm | 3 +-
tp/t/03coverage_braces.t | 3 +
.../coverage_braces/definfoenclose_bad_argument.pl | 66 ++++++++++++
.../coverage_braces/definfoenclose_no_braces.pl | 112 +++++++++++++++++++++
8 files changed, 201 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 08f38161fe..f38aebfcd5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2024-07-01 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/ParserNonXS.pm (_parse_line_command_args): remove a
+ useless argument of sprintf.
+
+ * tp/Texinfo/Convert/DocBook.pm (_convert): handle better @-command
+ defined with definfoenclose missing braces and with 0 args.
+
+ * tp/Makefile.tres, tp/t/03coverage_braces.t
+ (definfoenclose_bad_argument, definfoenclose_no_braces): new tests.
+
2024-07-01 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/Plaintext.pm (_convert): simplify args
diff --git a/tp/Makefile.tres b/tp/Makefile.tres
index 195d09b0ce..aab6adaab0 100644
--- a/tp/Makefile.tres
+++ b/tp/Makefile.tres
@@ -393,6 +393,8 @@ test_files_generated_list =
$(test_tap_files_generated_list) \
t/results/coverage_braces/command_in_U.pl \
t/results/coverage_braces/command_in_dotless.pl \
t/results/coverage_braces/contain_plain_text_nestings.pl \
+ t/results/coverage_braces/definfoenclose_bad_argument.pl \
+ t/results/coverage_braces/definfoenclose_no_braces.pl \
t/results/coverage_braces/definfoenclose_texinfo_commands.pl \
t/results/coverage_braces/email_no_braces.pl \
t/results/coverage_braces/email_possibilities.pl \
diff --git a/tp/Texinfo/Convert/DocBook.pm b/tp/Texinfo/Convert/DocBook.pm
index 65ce3b52a9..5ab4c0589f 100644
--- a/tp/Texinfo/Convert/DocBook.pm
+++ b/tp/Texinfo/Convert/DocBook.pm
@@ -1106,8 +1106,10 @@ sub _convert($$;$)
}
} elsif ($element->{'type'}
and $element->{'type'} eq 'definfoenclose_command') {
- my $arg = $self->_convert($element->{'args'}->[0]);
- $result .= $arg;
+ if ($element->{'args'}) {
+ my $arg_text = $self->_convert($element->{'args'}->[0]);
+ $result .= $arg_text;
+ }
} elsif ($element->{'args'}
and exists($Texinfo::Commands::brace_commands{$cmdname})) {
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index d9be241512..67f50cc849 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -13830,9 +13830,9 @@ sub _convert($$;$)
# def_line type is to handle the same the def*x and def* line formatting.
if ($element->{'cmdname'}
and !(($element->{'type'}
- and $element->{'type'} eq 'definfoenclose_command')
+ and $element->{'type'} eq 'definfoenclose_command')
or ($element->{'type'}
- and $element->{'type'} eq 'index_entry_command'))) {
+ and $element->{'type'} eq 'index_entry_command'))) {
my $command_name = $element->{'cmdname'};
if ($root_commands{$command_name}) {
$self->{'current_root_command'} = $element;
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 5ed1a995ab..ed22eaf120 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -8042,8 +8042,7 @@ sub _parse_line_command_args($$$)
# @-command otherwise will remain there, possibly having specific
effects.
}
} else {
- $self->_line_error(sprintf(__("bad argument to \@definfoenclose"),
- $command),
+ $self->_line_error(sprintf(__("bad argument to \@definfoenclose")),
$source_info);
}
} elsif ($command eq 'columnfractions') {
diff --git a/tp/t/03coverage_braces.t b/tp/t/03coverage_braces.t
index b64baa88a9..32a54fe7b2 100644
--- a/tp/t/03coverage_braces.t
+++ b/tp/t/03coverage_braces.t
@@ -101,6 +101,8 @@ my @test_cases = (
['U_no_braces', '@U'],
['hyphenation_no_braces', '@hyphenation'],
['titlefont_no_braces', '@titlefont'],
+['definfoenclose_no_braces', '@definfoenclose phoo,;,:
+@phoo'],
# tests a brace command without braces on a line command at the end of a
# document
['seeentry_no_braces', '@node Top
@@ -431,6 +433,7 @@ third}
@ref{,,,manual} @ref{,,, , Manual} @inforef{,,imanual}
@xref{ , Bidule, Truc, file, Printed}.
'],
+['definfoenclose_bad_argument', '@definfoenclose #phoo,;,:'],
);
foreach my $test (@test_cases) {
diff --git a/tp/t/results/coverage_braces/definfoenclose_bad_argument.pl
b/tp/t/results/coverage_braces/definfoenclose_bad_argument.pl
new file mode 100644
index 0000000000..f03c55c851
--- /dev/null
+++ b/tp/t/results/coverage_braces/definfoenclose_bad_argument.pl
@@ -0,0 +1,66 @@
+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{'definfoenclose_bad_argument'} = {
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => '#phoo,;,:'
+ }
+ ],
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'definfoenclose',
+ 'info' => {
+ 'spaces_before_argument' => {
+ 'text' => ' '
+ }
+ },
+ 'source_info' => {
+ 'line_nr' => 1
+ }
+ }
+ ],
+ 'type' => 'before_node_section'
+ }
+ ],
+ 'type' => 'document_root'
+};
+
+$result_texis{'definfoenclose_bad_argument'} = '@definfoenclose #phoo,;,:';
+
+
+$result_texts{'definfoenclose_bad_argument'} = '';
+
+$result_errors{'definfoenclose_bad_argument'} = [
+ {
+ 'error_line' => 'warning: @definfoenclose is obsolete
+',
+ 'line_nr' => 1,
+ 'text' => '@definfoenclose is obsolete',
+ 'type' => 'warning'
+ },
+ {
+ 'error_line' => 'bad argument to @definfoenclose
+',
+ 'line_nr' => 1,
+ 'text' => 'bad argument to @definfoenclose',
+ 'type' => 'error'
+ }
+];
+
+
+$result_floats{'definfoenclose_bad_argument'} = {};
+
+
+1;
diff --git a/tp/t/results/coverage_braces/definfoenclose_no_braces.pl
b/tp/t/results/coverage_braces/definfoenclose_no_braces.pl
new file mode 100644
index 0000000000..61e58a2825
--- /dev/null
+++ b/tp/t/results/coverage_braces/definfoenclose_no_braces.pl
@@ -0,0 +1,112 @@
+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{'definfoenclose_no_braces'} = {
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'phoo,;,:'
+ }
+ ],
+ 'info' => {
+ 'spaces_after_argument' => {
+ 'text' => '
+'
+ }
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'definfoenclose',
+ 'extra' => {
+ 'misc_args' => [
+ 'phoo',
+ ';',
+ ':'
+ ]
+ },
+ 'info' => {
+ 'spaces_before_argument' => {
+ 'text' => ' '
+ }
+ },
+ 'source_info' => {
+ 'line_nr' => 1
+ }
+ },
+ {
+ 'contents' => [
+ {
+ 'cmdname' => 'phoo',
+ 'extra' => {
+ 'begin' => ';',
+ 'end' => ':'
+ },
+ 'info' => {
+ 'command_name' => 'phoo'
+ },
+ 'source_info' => {
+ 'line_nr' => 2
+ },
+ 'type' => 'definfoenclose_command'
+ }
+ ],
+ 'type' => 'paragraph'
+ }
+ ],
+ 'type' => 'before_node_section'
+ }
+ ],
+ 'type' => 'document_root'
+};
+
+$result_texis{'definfoenclose_no_braces'} = '@definfoenclose phoo,;,:
+@phoo';
+
+
+$result_texts{'definfoenclose_no_braces'} = '';
+
+$result_errors{'definfoenclose_no_braces'} = [
+ {
+ 'error_line' => 'warning: @definfoenclose is obsolete
+',
+ 'line_nr' => 1,
+ 'text' => '@definfoenclose is obsolete',
+ 'type' => 'warning'
+ },
+ {
+ 'error_line' => '@phoo expected braces
+',
+ 'line_nr' => 2,
+ 'text' => '@phoo expected braces',
+ 'type' => 'error'
+ }
+];
+
+
+$result_floats{'definfoenclose_no_braces'} = {};
+
+
+
+$result_converted{'plaintext'}->{'definfoenclose_no_braces'} = ';:
+';
+
+
+$result_converted{'html_text'}->{'definfoenclose_no_braces'} = '<p>;:</p>';
+
+
+$result_converted{'latex_text'}->{'definfoenclose_no_braces'} = '';
+
+
+$result_converted{'docbook'}->{'definfoenclose_no_braces'} = '<para></para>';
+
+1;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/ParserNonXS.pm (_parse_line_command_args): remove a useless argument of sprintf.,
Patrice Dumas <=