texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Convert/Plaintext.pm (_convert) <'me


From: Gavin D. Smith
Subject: branch master updated: * tp/Texinfo/Convert/Plaintext.pm (_convert) <'menu_entry'>: Add explicit handling of 'menu_entry_leading_text' (for "* "), rather than leaving it to a catch-all case. Flush output for before outputting both 'menu_entry_node' and 'menu_entry_name' elements in order to capture node names or labels correctly and quote correctly if needed, without including any surrounding spaces.
Date: Sat, 30 Dec 2023 16:24:48 -0500

This is an automated email from the git hooks/post-receive script.

gavin pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 7122fabaff * tp/Texinfo/Convert/Plaintext.pm (_convert) 
<'menu_entry'>: Add explicit handling of 'menu_entry_leading_text' (for "* "), 
rather than leaving it to a catch-all case.  Flush output for before outputting 
both 'menu_entry_node' and 'menu_entry_name' elements in order to capture node 
names or labels correctly and quote correctly if needed, without including any 
surrounding spaces.
7122fabaff is described below

commit 7122fabaff3f12741ece3172f94bb266b7dfedb1
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sat Dec 30 21:24:11 2023 +0000

    * tp/Texinfo/Convert/Plaintext.pm (_convert) <'menu_entry'>:
    Add explicit handling of 'menu_entry_leading_text' (for "* "),
    rather than leaving it to a catch-all case.  Flush output for
    before outputting both 'menu_entry_node' and 'menu_entry_name'
    elements in order to capture node names or labels correctly
    and quote correctly if needed, without including any surrounding
    spaces.
---
 ChangeLog                                          | 10 ++++++++++
 tp/Texinfo/Convert/Plaintext.pm                    | 23 +++++++++++++++-------
 .../info_tests/invalid_node_name_no_warning.pl     |  2 +-
 .../info_tests/invalid_node_name_warning.pl        |  2 +-
 .../quote_node_names_info/res_info/nodequote.info  |  2 +-
 5 files changed, 29 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b0b3cf8a44..2630556331 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2023-12-30  Gavin Smith <gavinsmith0123@gmail.com>
+
+       * tp/Texinfo/Convert/Plaintext.pm (_convert) <'menu_entry'>:
+       Add explicit handling of 'menu_entry_leading_text' (for "* "),
+       rather than leaving it to a catch-all case.  Flush output for
+       before outputting both 'menu_entry_node' and 'menu_entry_name'
+       elements in order to capture node names or labels correctly
+       and quote correctly if needed, without including any surrounding
+       spaces.
+
 2023-12-30  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/HTML.pm (_convert_inline_command): do not modify
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index 3bf2fdee91..5f53d99ac7 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -3466,18 +3466,23 @@ sub _convert($$)
       my $entry_name_seen = 0;
       my $menu_entry_node;
       foreach my $content (@{$element->{'contents'}}) {
-        if ($content->{'type'} eq 'menu_entry_node') {
+        if ($content->{'type'} eq 'menu_entry_leading_text') {
+          if (defined($content->{'text'})) {
+            $result .= _count_added($self, $formatter->{'container'},
+                   add_next($formatter->{'container'}, $content->{'text'}));
+          }
+        } elsif ($content->{'type'} eq 'menu_entry_node') {
+          # Flush output so not to include in node text.
+          $result .= _count_added($self, $formatter->{'container'},
+                           add_pending_word($formatter->{'container'}, 1));
+
           $menu_entry_node = $content;
           my ($pre_quote, $post_quote);
           $self->{'formatters'}->[-1]->{'suppress_styles'} = 1;
           $self->{'formatters'}->[-1]->{'no_added_eol'} = 1;
 
-          # Flush a leading space
-          $result .= _count_added($self, $formatter->{'container'},
-                           add_pending_word($formatter->{'container'}, 1));
-
-          # note that $content->{'contents'} may be undefined in rare case
-          # such as in sectionning in_menu_only_special_ascii_spaces_node
+          # note that $content->{'contents'} may be undefined in rare cases,
+          # such as in 30sectioning.t in_menu_only_special_ascii_spaces_node
           # test
           my $node_text = _convert($self, {'type' => '_code',
                                       'contents' => $content->{'contents'}});
@@ -3512,6 +3517,10 @@ sub _convert($$)
           }
           $result .= $pre_quote . $node_text . $post_quote;
         } elsif ($content->{'type'} eq 'menu_entry_name') {
+          # Flush output so not to include in name text
+          $result .= _count_added($self, $formatter->{'container'},
+                           add_pending_word($formatter->{'container'}, 1));
+
           my ($pre_quote, $post_quote);
           $self->{'formatters'}->[-1]->{'no_added_eol'} = 1;
           my $entry_name = _convert($self, $content);
diff --git a/tp/t/results/info_tests/invalid_node_name_no_warning.pl 
b/tp/t/results/info_tests/invalid_node_name_no_warning.pl
index edc8f7b383..e6584d409c 100644
--- a/tp/t/results/info_tests/invalid_node_name_no_warning.pl
+++ b/tp/t/results/info_tests/invalid_node_name_no_warning.pl
@@ -798,7 +798,7 @@ File: ,  Node: Top,  Next: nodename. a,  Up: (dir)
 
 * Menu:
 
-* truc:: nodename. a
+* truc:: nodename. a
 
 * machin: node,comma, def
 * bidule:::
diff --git a/tp/t/results/info_tests/invalid_node_name_warning.pl 
b/tp/t/results/info_tests/invalid_node_name_warning.pl
index b735462874..9ba47a799c 100644
--- a/tp/t/results/info_tests/invalid_node_name_warning.pl
+++ b/tp/t/results/info_tests/invalid_node_name_warning.pl
@@ -798,7 +798,7 @@ File: ,  Node: Top,  Next: nodename. a,  Up: (dir)
 
 * Menu:
 
-* truc:: nodename. a
+* truc:: nodename. a
 
 * machin: node,comma, def
 * bidule:::
diff --git 
a/tp/t/results/info_tests/quote_node_names_info/res_info/nodequote.info 
b/tp/t/results/info_tests/quote_node_names_info/res_info/nodequote.info
index 5cd2dea860..461d6d96fb 100644
--- a/tp/t/results/info_tests/quote_node_names_info/res_info/nodequote.info
+++ b/tp/t/results/info_tests/quote_node_names_info/res_info/nodequote.info
@@ -38,7 +38,7 @@ blah:blah.
 * blah:blah::
 * the topic:blumpty.fump.
 * normal node::
-* funny:label:secret,node.
+* funny:label:secret,node.
 * (man:u.al)ext::
 
 



reply via email to

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