texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Convert/Text.pm (_convert): do not h


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Convert/Text.pm (_convert): do not handle menu entry differently from other contents.
Date: Sat, 04 Feb 2023 14:56:22 -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 05b5d70278 * tp/Texinfo/Convert/Text.pm (_convert): do not handle menu 
entry differently from other contents.
05b5d70278 is described below

commit 05b5d70278cc93f91d89cf1f0a72b4461c4ca1dc
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Feb 4 20:56:11 2023 +0100

    * tp/Texinfo/Convert/Text.pm (_convert): do not handle menu entry
    differently from other contents.
---
 ChangeLog                  |  5 +++++
 tp/Texinfo/Convert/Text.pm | 45 ++++++++++++++++++---------------------------
 2 files changed, 23 insertions(+), 27 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 68bdff2998..7c69390ce3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2023-02-04  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/Text.pm (_convert): do not handle menu entry
+       differently from other contents.
+
 2023-02-04  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/TexinfoMarkup.pm (_convert): do not handle
diff --git a/tp/Texinfo/Convert/Text.pm b/tp/Texinfo/Convert/Text.pm
index a72f51f2af..5af4f4669c 100644
--- a/tp/Texinfo/Convert/Text.pm
+++ b/tp/Texinfo/Convert/Text.pm
@@ -626,31 +626,15 @@ sub _convert($;$)
       $result = _convert({'contents' => \@contents}, $options);
       $options->{_code_options}--;
     }
-  } elsif ($element->{'type'} and $element->{'type'} eq 'menu_entry') {
-    foreach my $arg (@{$element->{'contents'}}) {
-      if ($arg->{'type'} eq 'menu_entry_node') {
-        $options->{_code_options}++;
-        $result .= _convert($arg, $options);
-        $options->{_code_options}--;
-      } else {
-        $result .= _convert($arg, $options);
-      }
-    }
-    if (!$element->{'parent'}->{'type'}
-        or ($element->{'parent'}->{'type'} ne 'preformatted'
-            and $element->{'parent'}->{'type'} ne 'rawpreformatted')) {
-      chomp($result);
-      $result .= "\n";
-    }
-    return $result;
   }
   if ($element->{'contents'}) {
     my $in_code;
-    if ($element->{'cmdname'}
-        and 
($Texinfo::Commands::preformatted_code_commands{$element->{'cmdname'}}
-             or $Texinfo::Commands::math_commands{$element->{'cmdname'}}
-             or 
(defined($Texinfo::Commands::block_commands{$element->{'cmdname'}})
-                 and $Texinfo::Commands::block_commands{$element->{'cmdname'}} 
eq 'raw'))) {
+    if (($element->{'cmdname'}
+         and 
($Texinfo::Commands::preformatted_code_commands{$element->{'cmdname'}}
+              or $Texinfo::Commands::math_commands{$element->{'cmdname'}}
+              or 
(defined($Texinfo::Commands::block_commands{$element->{'cmdname'}})
+                  and 
$Texinfo::Commands::block_commands{$element->{'cmdname'}} eq 'raw')))
+         or ($element->{'type'} and $element->{'type'} eq 'menu_entry_node')) {
       $in_code = 1;
     }
     if (ref($element->{'contents'}) ne 'ARRAY') {
@@ -662,11 +646,18 @@ sub _convert($;$)
     }
     $options->{_code_options}-- if ($in_code);
   }
-  $result = '{'.$result.'}'
-     if ($element->{'type'} and $element->{'type'} eq 'bracketed'
-         and (!$element->{'parent'}->{'type'} or
-              ($element->{'parent'}->{'type'} ne 'block_line_arg'
-               and $element->{'parent'}->{'type'} ne 'line_arg')));
+  if ($element->{'type'} and $element->{'type'} eq 'bracketed'
+      and (!$element->{'parent'}->{'type'} or
+            ($element->{'parent'}->{'type'} ne 'block_line_arg'
+             and $element->{'parent'}->{'type'} ne 'line_arg'))) {
+    $result = '{'.$result.'}';
+  } elsif ($element->{'type'} and $element->{'type'} eq 'menu_entry'
+           and (!$element->{'parent'}->{'type'}
+                or ($element->{'parent'}->{'type'} ne 'preformatted'
+                    and $element->{'parent'}->{'type'} ne 'rawpreformatted'))) 
{
+    chomp($result);
+    $result .= "\n";
+  }
   #print STDERR "  RR ($element) -> $result\n";
   return $result;
 }



reply via email to

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