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


From: Gavin D. Smith
Subject: branch master updated: * tp/Texinfo/Convert/Plaintext.pm (_convert) <process contents>: Limit zeroing of 'empty_lines_count' to elements of type 'preformatted' or 'rawpreformatted', which typically only contain content for a single line. Previously, this code was also used for processing the contents of whole @menu blocks (as the local variable '$preformatted' was set) but the two cases are quite different and not well handled by the same code. (_convert) <menu_entry>: Unconditionally zero $self->{'empty_lines_ [...]
Date: Thu, 04 Jan 2024 14:27:46 -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 f755cba0dd * tp/Texinfo/Convert/Plaintext.pm (_convert) <process 
contents>: Limit zeroing of 'empty_lines_count' to elements of type 
'preformatted' or 'rawpreformatted', which typically only contain content for a 
single line.  Previously, this code was also used for processing the contents 
of whole @menu blocks (as the local variable '$preformatted' was set) but the 
two cases are quite different and not well handled by the same code. (_convert) 
<menu_entry>: Unconditionally zero  [...]
f755cba0dd is described below

commit f755cba0dd18dd1eda89152bdd570da623df8985
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Thu Jan 4 19:27:05 2024 +0000

    * tp/Texinfo/Convert/Plaintext.pm (_convert) <process contents>:
    Limit zeroing of 'empty_lines_count' to elements of type
    'preformatted' or 'rawpreformatted', which typically only contain
    content for a single line.  Previously, this code was also used
    for processing the contents of whole @menu blocks (as the local
    variable '$preformatted' was set) but the two cases are quite
    different and not well handled by the same code.
    (_convert) <menu_entry>:
    Unconditionally zero $self->{'empty_lines_count'} when processing
    the 'menu_entry' element itself, which is contained within the
    @menu block.
---
 ChangeLog                                                  | 14 ++++++++++++++
 tp/Texinfo/Convert/Plaintext.pm                            |  7 +++++--
 tp/t/results/menu/commands_in_nodedescriptionblock.pl      |  1 -
 .../moresectioning/topic_guide/res_info/topic_guide.info   |  7 +++----
 4 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c3a04bbda8..6ffda8958a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2024-01-04  Gavin Smith <gavinsmith0123@gmail.com>
+
+       * tp/Texinfo/Convert/Plaintext.pm (_convert) <process contents>:
+       Limit zeroing of 'empty_lines_count' to elements of type
+       'preformatted' or 'rawpreformatted', which typically only contain
+       content for a single line.  Previously, this code was also used
+       for processing the contents of whole @menu blocks (as the local
+       variable '$preformatted' was set) but the two cases are quite
+       different and not well handled by the same code.
+       (_convert) <menu_entry>:
+       Unconditionally zero $self->{'empty_lines_count'} when processing
+       the 'menu_entry' element itself, which is contained within the
+       @menu block.
+
 2024-01-04  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/convert/convert_html.c (convert_definfoenclose_type)
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index 6d80a0c259..a2ecae8541 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -3468,6 +3468,7 @@ sub _convert($$)
     } elsif ($type eq 'menu_entry') {
       my $entry_name_seen = 0;
       my $menu_entry_node;
+      $self->{'empty_lines_count'} = 0;
       foreach my $content (@{$element->{'contents'}}) {
         if ($content->{'type'} eq 'menu_entry_leading_text') {
           if (defined($content->{'text'})) {
@@ -3703,8 +3704,10 @@ sub _convert($$)
 
     for my $content (@$contents) {
       my $text = _convert($self, $content);
-      $self->{'empty_lines_count'} = 0
-        if ($preformatted and $text =~ /\S/);
+      if (defined($type) and ($type eq 'preformatted'
+             or $type eq 'rawpreformatted')) {
+        $self->{'empty_lines_count'} = 0 if ($text =~ /\S/);
+      }
       $result .= $text;
     }
     pop @{$self->{'current_contents'}};
diff --git a/tp/t/results/menu/commands_in_nodedescriptionblock.pl 
b/tp/t/results/menu/commands_in_nodedescriptionblock.pl
index 660c78367b..99ebc0ecd2 100644
--- a/tp/t/results/menu/commands_in_nodedescriptionblock.pl
+++ b/tp/t/results/menu/commands_in_nodedescriptionblock.pl
@@ -1342,7 +1342,6 @@ 
$result_converted{'plaintext'}->{'commands_in_nodedescriptionblock'} = 'test com
                tfloat 1.1: Cap1
 
 
-
 * Menu:
 
 * in nodedescriptionblock:               node2.                (line 34)
diff --git a/tp/t/results/moresectioning/topic_guide/res_info/topic_guide.info 
b/tp/t/results/moresectioning/topic_guide/res_info/topic_guide.info
index 7237c26da8..cf5ac88f5e 100644
--- a/tp/t/results/moresectioning/topic_guide/res_info/topic_guide.info
+++ b/tp/t/results/moresectioning/topic_guide/res_info/topic_guide.info
@@ -59,7 +59,6 @@ This is topic 3
 
 More information
 
-
 
 File: topic_guide.info,  Node: topic4,  Prev: topic5,  Up: guide2
 
@@ -104,9 +103,9 @@ Node: guide1334
 Node: topic1569
 Node: topic2690
 Node: topic3825
-Node: topic4941
-Node: topic51074
-Node: guide21213
+Node: topic4940
+Node: topic51073
+Node: guide21212
 
 End Tag Table
 



reply via email to

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