texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Wed, 17 Aug 2022 18:34:12 -0400 (EDT)

branch: master
commit 69a76af6a2ef86929dfc4f37836b151eb5257d36
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Aug 18 00:34:00 2022 +0200

    * tp/Texinfo/Common.pm (parse_node_manual): do not set text type
    if undef.
---
 ChangeLog            |  5 +++++
 tp/Texinfo/Common.pm | 12 +++++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8f69f71a95..f9fa29875d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-08-17  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Common.pm (parse_node_manual): do not set text type
+       if undef.
+
 2022-08-17  Gavin Smith  <gavinsmith0123@gmail.com>
 
        Fix LaTeX chapter page breaks
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index e4d153bfde..37ba1a5215 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -1465,17 +1465,21 @@ sub parse_node_manual($)
   my ($end_paren, $spaces_after);
 
   if ($contents[0] and $contents[0]->{'text'} and $contents[0]->{'text'} =~ 
/^\(/) {
+    # remove the leading (, it is not in manual_content
     my $braces_count = 1;
     if ($contents[0]->{'text'} !~ /^\($/) {
       my $brace = shift @contents;
       my $brace_text = $brace->{'text'};
       $brace_text =~ s/^\(//;
-      unshift @contents, { 'text' => $brace_text, 'type' => $brace->{'type'},
-                           'parent' => $brace->{'parent'} } if $brace_text ne 
'';
+      if ($brace_text ne '') {
+        my $added_content = { 'text' => $brace_text, 'parent' => 
$brace->{'parent'} };
+        $added_content->{'type'} = $brace->{'type'} if 
defined($brace->{'type'});
+        unshift @contents, $added_content;
+      }
     } else {
       shift @contents;
     }
-    while(@contents) {
+    while (@contents) {
       my $content = shift @contents;
       if (!defined($content->{'text'}) or $content->{'text'} !~ /\)/) {
         push @$manual, $content;
@@ -1489,12 +1493,14 @@ sub parse_node_manual($)
         ($before, $after, $braces_count) = _find_end_brace($content->{'text'},
                                                               $braces_count);
         if ($braces_count == 0) {
+          # remove the closing ), it is not in manual_content
           $before =~ s/(\))$//;
           $end_paren = $1;
           push @$manual, { 'text' => $before, 'parent' => $content->{'parent'} 
}
             if ($before ne '');
           $after =~ s/^(\s*)//;
           $spaces_after = $1;
+          # put back everything appearing after the )
           unshift @contents,  { 'text' => $after, 'parent' => 
$content->{'parent'} }
             if ($after ne '');
           last;



reply via email to

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