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):


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Convert/TexinfoMarkup.pm (_convert): use directly the @node direction explicit args, reconstitute node and manual name only for automatic directions.
Date: Sun, 11 Dec 2022 09:43: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 e382c3ea90 * tp/Texinfo/Convert/TexinfoMarkup.pm (_convert): use 
directly the @node direction explicit args, reconstitute node and manual name 
only for automatic directions.
e382c3ea90 is described below

commit e382c3ea90eeb4a02dc072e7f2668f3337b8b444
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Dec 11 15:43:03 2022 +0100

    * tp/Texinfo/Convert/TexinfoMarkup.pm (_convert): use directly
    the @node direction explicit args, reconstitute node and manual name
    only for automatic directions.
    
    * tp/t/57invalid_nestings.t: move on_node_line to @formatted_cases
    to output XML.
---
 ChangeLog                                     |  9 +++++++
 tp/Texinfo/Convert/TexinfoMarkup.pm           | 36 ++++++++++++++++-----------
 tp/t/57invalid_nestings.t                     |  6 ++---
 tp/t/results/invalid_nestings/on_node_line.pl |  7 ++++++
 4 files changed, 41 insertions(+), 17 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0c560d2655..03ceae9dd0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2022-12-11  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/TexinfoMarkup.pm (_convert): use directly
+       the @node direction explicit args, reconstitute node and manual name
+       only for automatic directions.
+
+       * tp/t/57invalid_nestings.t: move on_node_line to @formatted_cases
+       to output XML.
+
 2022-12-11  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/ParserNonXS.pm (_end_line_starting_block),
diff --git a/tp/Texinfo/Convert/TexinfoMarkup.pm 
b/tp/Texinfo/Convert/TexinfoMarkup.pm
index 8a1aff9740..90a11e7c0d 100644
--- a/tp/Texinfo/Convert/TexinfoMarkup.pm
+++ b/tp/Texinfo/Convert/TexinfoMarkup.pm
@@ -811,28 +811,36 @@ sub _convert($$;$)
           foreach my $direction(@node_directions) {
             my $format_element = 'node'.lc($direction);
             if ($element->{'structure'}->{'node_'.lc($direction)}) {
-              my $node_direction = 
$element->{'structure'}->{'node_'.lc($direction)};
+              my $node_direction
+                     = $element->{'structure'}->{'node_'.lc($direction)};
               my $node_name = '';
               my $attributes = [];
-              if (! 
defined($element->{'extra'}->{'nodes_manuals'}->[$direction_index])) {
-                push @$attributes, ['automatic', 'on'];
-              }
               if ($element->{'args'}->[$direction_index]) {
                 push @$attributes, _leading_trailing_spaces_arg(
                                  $element->{'args'}->[$direction_index]);
               }
-              if ($node_direction->{'extra'}->{'manual_content'}) {
-                $node_name .= $self->_convert({
-                             'contents' => [{'text' => '('},
-                             @{$node_direction->{'extra'}->{'manual_content'}},
-                                          {'text' => ')'}]});
-              }
-              if ($node_direction->{'extra'}->{'node_content'}) {
-                $node_name .= 
Texinfo::Common::normalize_top_node_name($self->_convert({
-                  'contents' => 
$node_direction->{'extra'}->{'node_content'}}));
+              if (! defined($element->{'extra'}->{'nodes_manuals'}
+                                                        ->[$direction_index])) 
{
+                push @$attributes, ['automatic', 'on'];
+
+                if ($node_direction->{'extra'}->{'manual_content'}) {
+                  $node_name .= $self->_convert({
+                               'contents' => [{'text' => '('},
+                              
@{$node_direction->{'extra'}->{'manual_content'}},
+                                            {'text' => ')'}]});
+                }
+                if ($node_direction->{'extra'}->{'node_content'}) {
+                  $node_name .= Texinfo::Common::normalize_top_node_name(
+                    $self->_convert({'contents'
+                             => 
$node_direction->{'extra'}->{'node_content'}}));
+                }
+              } else {
+                $node_name
+                  = $self->_convert($element->{'args'}->[$direction_index]);
               }
               $result .= "$pending_empty_directions".
-                $self->txi_markup_open_element($format_element, 
$attributes).$node_name.
+                $self->txi_markup_open_element($format_element, $attributes)
+                .$node_name.
                 $self->txi_markup_close_element($format_element);
               $pending_empty_directions = '';
             } else {
diff --git a/tp/t/57invalid_nestings.t b/tp/t/57invalid_nestings.t
index 15b7f9c485..eb048db3a5 100644
--- a/tp/t/57invalid_nestings.t
+++ b/tp/t/57invalid_nestings.t
@@ -9,9 +9,6 @@ my @test_cases = (
 ['on_section_line',
 '@section @noindent Text @titlefont{in titlefont} @anchor{in 
anchor}@footnote{footnote} @exdent exdent
 '],
-['on_node_line',
-'@node @ref{a, b, c, filename}, (@pxref{(somemanual)Top}) @anchor{in 
anchor}@footnote{footnote} @exdent exdent
-'],
 ['on_subheading_line',
 '@subheading @noindent Text @titlefont{in titlefont} @anchor{in 
anchor}@footnote{footnote} @exdent exdent
 '],
@@ -519,6 +516,9 @@ Text. @errormsg{@anchor{in anchor} @ref{in ref}}
 );
 
 my @formatted_cases = (
+['on_node_line',
+'@node @ref{a, b, c, filename}, (@pxref{(somemanual)Top}) @anchor{in 
anchor}@footnote{footnote} @exdent exdent
+'],
 ['table_in_code',
 '@code{
 in code
diff --git a/tp/t/results/invalid_nestings/on_node_line.pl 
b/tp/t/results/invalid_nestings/on_node_line.pl
index 441e2aa15d..d9b46f691b 100644
--- a/tp/t/results/invalid_nestings/on_node_line.pl
+++ b/tp/t/results/invalid_nestings/on_node_line.pl
@@ -361,4 +361,11 @@ $result_errors{'on_node_line'} = [
 $result_floats{'on_node_line'} = {};
 
 
+
+$result_converted{'plaintext'}->{'on_node_line'} = '';
+
+
+$result_converted{'xml'}->{'on_node_line'} = '<node name="a" spaces=" 
"><nodename><ref label="a" 
manual="filename"><xrefnodename>a</xrefnodename><xrefinfoname spaces=" 
">b</xrefinfoname><xrefprinteddesc spaces=" ">c</xrefprinteddesc><xrefinfofile 
spaces=" ">filename</xrefinfofile></ref></nodename><nodenext spaces=" ">(<pxref 
label="Top" 
manual="somemanual"><xrefnodename>(somemanual)Top</xrefnodename></pxref>) 
<anchor name="in-anchor">in anchor</anchor><footnote><para>footnote</para></foo 
[...]
+</nodenext></node>';
+
 1;



reply via email to

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