texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: * tp/Texinfo/Convert/TexinfoMarkup.pm (_convert_a


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Convert/TexinfoMarkup.pm (_convert_argument_and_end_line) (_convert): convert comment_at_end from brace commands.
Date: Sat, 10 Dec 2022 11:59: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 26c5786ae7 * tp/Texinfo/Convert/TexinfoMarkup.pm 
(_convert_argument_and_end_line) (_convert): convert comment_at_end from brace 
commands.
26c5786ae7 is described below

commit 26c5786ae74dc94a75868d7e7e5e148f34fe4b2f
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Dec 10 17:59:31 2022 +0100

    * tp/Texinfo/Convert/TexinfoMarkup.pm (_convert_argument_and_end_line)
    (_convert): convert comment_at_end from brace commands.
    
    * tp/t/30sectioning.t: output XML for empty_ref_arg test.
---
 ChangeLog                                |  7 +++++++
 tp/Texinfo/Convert/TexinfoMarkup.pm      | 26 +++++++++++++++++++++++---
 tp/t/30sectioning.t                      |  3 ++-
 tp/t/results/sectioning/empty_ref_arg.pl | 14 ++++++++++++++
 4 files changed, 46 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8996cbd2a4..24474eec17 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-12-10  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/TexinfoMarkup.pm (_convert_argument_and_end_line)
+       (_convert): convert comment_at_end from brace commands.
+
+       * tp/t/30sectioning.t: output XML for empty_ref_arg test.
+
 2022-12-10  Gavin Smith  <gavinsmith0123@gmail.com>
 
        &nbsp; for @verb
diff --git a/tp/Texinfo/Convert/TexinfoMarkup.pm 
b/tp/Texinfo/Convert/TexinfoMarkup.pm
index 7e9071b467..1795eaba12 100644
--- a/tp/Texinfo/Convert/TexinfoMarkup.pm
+++ b/tp/Texinfo/Convert/TexinfoMarkup.pm
@@ -567,6 +567,21 @@ sub _convert_argument_and_end_line($$)
   return ($converted, $end_space, $end_line);
 }
 
+# used in brace commands
+sub _convert_comment_at_end
+{
+  my $self = shift;
+  my $element = shift;
+
+  my $comment = $element->{'info'}->{'comment_at_end'}
+    if $element->{'info'};
+
+  if ($comment) {
+    return $self->convert_tree($comment);
+  }
+  return '';
+}
+
 my @node_directions = ('Next', 'Prev', 'Up');
 
 # not used here, but it is consistent with other %commands_args_elements
@@ -1007,7 +1022,8 @@ sub _convert($$;$)
       my $command_result = $self->txi_markup_open_element('infoenclose',
                                           [['command', $element->{'cmdname'}],
                                        
$self->_infoenclose_attribute($element)])
-                 .$arg.$self->txi_markup_close_element('infoenclose');
+                 .$arg.$self->_convert_comment_at_end($element->{'args'}->[0]).
+                 $self->txi_markup_close_element('infoenclose');
       return $command_result;
     } elsif ($element->{'args'}
              and exists($brace_commands{$element->{'cmdname'}})) {
@@ -1098,6 +1114,8 @@ sub _convert($$;$)
             $in_monospace_not_normal
               if (defined($in_monospace_not_normal));
           my $arg = $self->_convert($element->{'args'}->[$arg_index]);
+          my $comment_at_end
+            = $self->_convert_comment_at_end($element->{'args'}->[$arg_index]);
           pop @{$self->{'document_context'}->[-1]->{'monospace'}}
             if (defined($in_monospace_not_normal));
 
@@ -1108,9 +1126,11 @@ sub _convert($$;$)
                    ->{'info'}->{'spaces_after_argument'};
           }
 
-          if (!defined($main_cmdname) or $arg ne '' or scalar(@$attribute) > 
0) {
+          if (!defined($main_cmdname) or $arg ne '' or scalar(@$attribute) > 0
+              or $comment_at_end ne '') {
             $args_or_one_arg_cmd .=
                  $self->txi_markup_open_element($format_element, 
$attribute).$arg
+                      .$comment_at_end
                       .$self->txi_markup_close_element($format_element);
             $last_empty_element = undef;
           # we keep the last empty argument to be able to prepend it to be able
@@ -1388,7 +1408,7 @@ sub _convert($$;$)
                     } elsif ($content->{'cmdname'} eq 'c'
                              or $content->{'cmdname'} eq 'comment') {
                       # NOTE it does not happen right now, because a comment
-                      # will be in info comment_at_end.  If comments are back
+                      # here will be in info comment_at_end.  If comments are 
back
                       # in the tree, they should be ignored here, as they would
                       # better be handled in format_comment_or_return_end_line
                     } else { # a command
diff --git a/tp/t/30sectioning.t b/tp/t/30sectioning.t
index 4a2d2ec698..5d781c533f 100644
--- a/tp/t/30sectioning.t
+++ b/tp/t/30sectioning.t
@@ -2197,7 +2197,8 @@ my @xml_tests_cases_tests = ('part_before_section',
 'section_chapter_before_top', 'sectioning_part_appendix',
 'part_chapter_appendix', 'sectioning_part_appendix_no_top',
 'top_chapter_sections', 'chapter_sections',
-'more_sections_than_nodes', 'next_no_prev_to_node');
+'more_sections_than_nodes', 'next_no_prev_to_node',
+'empty_ref_arg');
 
 my @docbook_tests_cases_tests = ('hole_in_sectioning');
 
diff --git a/tp/t/results/sectioning/empty_ref_arg.pl 
b/tp/t/results/sectioning/empty_ref_arg.pl
index a62b34ea5c..6149b0969a 100644
--- a/tp/t/results/sectioning/empty_ref_arg.pl
+++ b/tp/t/results/sectioning/empty_ref_arg.pl
@@ -439,4 +439,18 @@ $result_errors{'empty_ref_arg'} = [
 $result_floats{'empty_ref_arg'} = {};
 
 
+
+$result_converted{'xml'}->{'empty_ref_arg'} = '<node name="Top" spaces=" 
"><nodename>Top</nodename></node>
+
+<para><ref label="Top"><xrefnodename>Top</xrefnodename><xrefinfoname spaces=" 
"><spacecmd type="spc"/></xrefinfoname></ref>
+<ref label="Top"><xrefnodename>Top</xrefnodename><xrefinfoname spaces=" 
"></xrefinfoname><xrefprinteddesc spaces=" "><spacecmd 
type="spc"/></xrefprinteddesc></ref>
+<ref label="Top"><xrefnodename>Top</xrefnodename><xrefinfoname spaces=" 
"><spacecmd type="spc"/></xrefinfoname><xrefprinteddesc spaces=" 
">&noeos;</xrefprinteddesc></ref>
+<ref label="Top"><xrefnodename>Top</xrefnodename><xrefinfoname spaces=" "><!-- 
c aaa -->
+ <spacecmd type="spc"/>
+<!-- c ggg -->
+</xrefinfoname><xrefprinteddesc spaces=" "><!-- c fff -->
+<!-- c -->
+</xrefprinteddesc></ref>
+</para>';
+
 1;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]