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


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Convert/Plaintext.pm (_convert): avoid undef warning with definfoenclose by checking that $brace_commands{} exists. Change in spaces.
Date: Sat, 15 Jul 2023 06:55:17 -0400

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 84899636d0 * tp/Texinfo/Convert/Plaintext.pm (_convert): avoid undef 
warning with definfoenclose by checking that $brace_commands{} exists. Change 
in spaces.
84899636d0 is described below

commit 84899636d040fa63c394ee4f19f46b0ae00e5f11
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Jul 15 12:55:08 2023 +0200

    * tp/Texinfo/Convert/Plaintext.pm (_convert): avoid undef warning
    with definfoenclose by checking that $brace_commands{} exists.
    Change in spaces.
---
 ChangeLog                       |  6 ++++++
 tp/Texinfo/Convert/Plaintext.pm | 23 ++++++++++++-----------
 2 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0c35d5263b..ea515a264a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-07-15  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/Plaintext.pm (_convert): avoid undef warning
+       with definfoenclose by checking that $brace_commands{} exists.
+       Change in spaces.
+
 2023-07-15  Patrice Dumas  <pertusus@free.fr>
 
        Distinguish input text macro context and input text macro expansion
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index 510646126c..4a1504b399 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -1923,7 +1923,7 @@ sub _convert($$)
         if ($accented_text ne '');
       return $result;
     } elsif (exists($brace_commands{$command})
-         or ($type and $type eq 'definfoenclose_command')) {
+             or ($type and $type eq 'definfoenclose_command')) {
       if ($self->{'style_map'}->{$command}
            or ($type and $type eq 'definfoenclose_command')) {
         if ($brace_code_commands{$command}) {
@@ -1932,7 +1932,8 @@ sub _convert($$)
           } else {
             $formatter->{'font_type_stack'}->[-1]->{'monospace'}++;
           }
-        } elsif ($brace_commands{$command} eq 'style_no_code') {
+        } elsif (exists($brace_commands{$command})
+                 and $brace_commands{$command} eq 'style_no_code') {
           if ($formatter->{'font_type_stack'}->[-1]->{'monospace'}) {
             push @{$formatter->{'font_type_stack'}}, {'monospace' => 0,
                                                       'normal' => 1};
@@ -1943,7 +1944,7 @@ sub _convert($$)
         if ($no_punctation_munging_commands{$command}) {
           push @{$formatter->{'frenchspacing_stack'}}, 'on';
           set_space_protection($formatter->{'container'}, undef,
-            undef,undef,1);
+                               undef, undef, 1);
         }
         if ($upper_case_commands{$command}) {
           $formatter->{'upper_case_stack'}->[-1]->{'upper_case'}++;
@@ -1952,12 +1953,12 @@ sub _convert($$)
         }
         if ($command eq 'w') {
           $formatter->{'w'}++;
-          set_space_protection($formatter->{'container'}, 1,undef)
+          set_space_protection($formatter->{'container'}, 1, undef)
             if ($formatter->{'w'} == 1);
         }
         my ($text_before, $text_after);
         if ($element->{'type'}
-              and $element->{'type'} eq 'definfoenclose_command') {
+            and $element->{'type'} eq 'definfoenclose_command') {
           $text_before = $element->{'extra'}->{'begin'};
           $text_after = $element->{'extra'}->{'end'};
         } elsif ($non_quoted_commands_when_nested{$command}
@@ -1978,7 +1979,7 @@ sub _convert($$)
           $formatter->{'font_type_stack'}->[-1]->{'code_command'}++;
         }
         $result .= _count_added($self, $formatter->{'container'},
-                 add_next($formatter->{'container'}, $text_before, 1))
+                       add_next($formatter->{'container'}, $text_before, 1))
            if ($text_before ne '');
         if ($element->{'args'}) {
           $result .= _convert($self, $element->{'args'}->[0]);
@@ -1996,11 +1997,11 @@ sub _convert($$)
           }
         }
         $result .= _count_added($self, $formatter->{'container'},
-                 add_next($formatter->{'container'}, $text_after, 1))
+                       add_next($formatter->{'container'}, $text_after, 1))
            if ($text_after ne '');
         if ($command eq 'w') {
           $formatter->{'w'}--;
-          set_space_protection($formatter->{'container'},0,undef)
+          set_space_protection($formatter->{'container'}, 0, undef)
             if ($formatter->{'w'} == 0);
         }
         if ($brace_code_commands{$command}) {
@@ -2008,7 +2009,8 @@ sub _convert($$)
           allow_end_sentence($formatter->{'container'});
           pop @{$formatter->{'font_type_stack'}}
             if !$formatter->{'font_type_stack'}->[-1]->{'monospace'};
-        } elsif ($brace_commands{$command} eq 'style_no_code') {
+        } elsif (exists($brace_commands{$command})
+                 and $brace_commands{$command} eq 'style_no_code') {
           if ($formatter->{'font_type_stack'}->[-1]->{'normal'}) {
             $formatter->{'font_type_stack'}->[-1]->{'normal'}--;
             pop @{$formatter->{'font_type_stack'}}
@@ -2016,7 +2018,6 @@ sub _convert($$)
           }
         }
         if ($non_quoted_commands_when_nested{$command}) {
-          #$formatter->{'code_command'}--;
           $formatter->{'font_type_stack'}->[-1]->{'code_command'}--;
         }
         if ($no_punctation_munging_commands{$command}) {
@@ -2025,7 +2026,7 @@ sub _convert($$)
           $frenchspacing = 1 if ($formatter->{'frenchspacing_stack'}->[-1]
                                  eq 'on');
           set_space_protection($formatter->{'container'}, undef,
-            undef, undef, $frenchspacing);
+                               undef, undef, $frenchspacing);
         }
         if ($upper_case_commands{$command}) {
           $formatter->{'upper_case_stack'}->[-1]->{'upper_case'}--;



reply via email to

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