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), tp/Texin


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Convert/Text.pm (_convert), tp/Texinfo/Convert/TextContent.pm (_convert), tp/maintain/regenerate_commands_perl_info.pl: do not put item in Texinfo::Command %formatted_line_commands, to have the same setup as in XS/C. Update code to set $data_cmdname for item to item_LINE if in a @table and similar.
Date: Sat, 23 Nov 2024 13:24:29 -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 a2f9f12dd9 * tp/Texinfo/Convert/Text.pm (_convert), 
tp/Texinfo/Convert/TextContent.pm (_convert), 
tp/maintain/regenerate_commands_perl_info.pl: do not put item in 
Texinfo::Command %formatted_line_commands, to have the same setup as in XS/C.  
Update code to set $data_cmdname for item to item_LINE if in a @table and 
similar.
a2f9f12dd9 is described below

commit a2f9f12dd9eb1b6cefe247561bcbce4b3a57216d
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Nov 23 19:24:23 2024 +0100

    * tp/Texinfo/Convert/Text.pm (_convert),
    tp/Texinfo/Convert/TextContent.pm (_convert),
    tp/maintain/regenerate_commands_perl_info.pl: do not put item in
    Texinfo::Command %formatted_line_commands, to have the same setup as
    in XS/C.  Update code to set $data_cmdname for item to item_LINE if in
    a @table and similar.
---
 ChangeLog                                    |  9 +++++++++
 tp/Texinfo/Commands.pm                       |  1 -
 tp/Texinfo/Convert/Text.pm                   | 11 +++++++++--
 tp/Texinfo/Convert/TextContent.pm            | 14 +++++++++++++-
 tp/maintain/regenerate_commands_perl_info.pl | 12 ------------
 5 files changed, 31 insertions(+), 16 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d9fb4b99db..ed938e66aa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-11-23  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/Text.pm (_convert),
+       tp/Texinfo/Convert/TextContent.pm (_convert),
+       tp/maintain/regenerate_commands_perl_info.pl: do not put item in
+       Texinfo::Command %formatted_line_commands, to have the same setup as
+       in XS/C.  Update code to set $data_cmdname for item to item_LINE if in
+       a @table and similar.
+
 2024-11-22  Gavin Smith <gavinsmith0123@gmail.com>
 
        Change use of memcpy to memmove
diff --git a/tp/Texinfo/Commands.pm b/tp/Texinfo/Commands.pm
index b30725f7d8..421ec58af8 100644
--- a/tp/Texinfo/Commands.pm
+++ b/tp/Texinfo/Commands.pm
@@ -853,7 +853,6 @@ our %formatted_line_commands = (
   "exdent"                  => 1,
   "heading"                 => 1,
   "item_LINE"               => 1,
-  "item"                    => 1,
   "itemx"                   => 1,
   "majorheading"            => 1,
   "node"                    => 1,
diff --git a/tp/Texinfo/Convert/Text.pm b/tp/Texinfo/Convert/Text.pm
index 26463e9644..83eb78f212 100644
--- a/tp/Texinfo/Convert/Text.pm
+++ b/tp/Texinfo/Convert/Text.pm
@@ -517,8 +517,15 @@ sub _convert($$)
   }
 
   my $cmdname;
+  my $data_cmdname;
   if (defined($element->{'cmdname'})) {
     $cmdname = $element->{'cmdname'};
+    if ($cmdname eq 'item' and $element->{'parent'}->{'type'}
+        and $element->{'parent'}->{'type'} eq 'table_term') {
+      $data_cmdname = 'item_LINE';
+    } else {
+      $data_cmdname = $cmdname;
+    }
   }
 
   return '' if (!($element->{'type'} and $element->{'type'} eq 'def_line')
@@ -549,7 +556,7 @@ sub _convert($$)
                      and $element->{'args'}->[0]->{'type'}
                      and ($element->{'args'}->[0]->{'type'} eq 'line_arg'
                          or $element->{'args'}->[0]->{'type'} eq 'rawline_arg')
-                     and !$formatted_line_commands{$cmdname}
+                     and !$formatted_line_commands{$data_cmdname}
                      and !$converted_formattable_line_commands{$cmdname})))));
 
   my $result = '';
@@ -687,7 +694,7 @@ sub _convert($$)
         chomp ($result);
         $result .= "\n" if ($result =~ /\S/);
       }
-    } elsif ($formatted_line_commands{$cmdname}
+    } elsif ($formatted_line_commands{$data_cmdname}
              and $element->{'args'}) {
       if ($cmdname ne 'node') {
         if ($cmdname eq 'page') {
diff --git a/tp/Texinfo/Convert/TextContent.pm 
b/tp/Texinfo/Convert/TextContent.pm
index c62542d578..26c207ca1f 100644
--- a/tp/Texinfo/Convert/TextContent.pm
+++ b/tp/Texinfo/Convert/TextContent.pm
@@ -121,6 +121,17 @@ sub _convert($$)
   my $self = shift;
   my $element = shift;
 
+  # determine name used to check command properties
+  my $data_cmdname;
+  if ($element->{'cmdname'}) {
+    if ($element->{'cmdname'} eq 'item' and $element->{'parent'}->{'type'}
+        and $element->{'parent'}->{'type'} eq 'table_term') {
+      $data_cmdname = 'item_LINE';
+    } else {
+      $data_cmdname = $element->{'cmdname'};
+    }
+  }
+
   return '' if (!($element->{'type'} and $element->{'type'} eq 'def_line')
      and (($element->{'type'} and $ignored_types{$element->{'type'}})
           or ($element->{'cmdname'}
@@ -137,10 +148,11 @@ sub _convert($$)
                      and $element->{'args'}->[0]->{'type'}
                      and ($element->{'args'}->[0]->{'type'} eq 'line_arg'
                           or $element->{'args'}->[0]->{'type'} eq 
'rawline_arg')
-                     and 
!$self->{'formatted_line_commands'}->{$element->{'cmdname'}})))));
+                     and 
!$self->{'formatted_line_commands'}->{$data_cmdname})))));
   if (defined($element->{'text'})) {
     return $element->{'text'};
   }
+
   if (defined($element->{'cmdname'})) {
     if (exists($Texinfo::Common::nobrace_symbol_text{$element->{'cmdname'}})) {
       return $Texinfo::Common::nobrace_symbol_text{$element->{'cmdname'}};
diff --git a/tp/maintain/regenerate_commands_perl_info.pl 
b/tp/maintain/regenerate_commands_perl_info.pl
index 49785ed8e4..0e64e90cd1 100755
--- a/tp/maintain/regenerate_commands_perl_info.pl
+++ b/tp/maintain/regenerate_commands_perl_info.pl
@@ -38,8 +38,6 @@ my %command_categories;
 my %flags_hashes;
 my %command_args_nr;
 
-my %multi_category_commands;
-
 while (<STDIN>) {
   if (not (/^#/ or /^ *$/)) {
     my ($command, $flags, $data, $args_nr) = split;
@@ -75,11 +73,6 @@ while (<STDIN>) {
       }
       $category = $categories[0];
     }
-    # handle commands in multiple categories, for now @item
-    my $uc_category = uc($category);
-    if ($command =~ /^(.*)_$uc_category$/) {
-      $multi_category_commands{$command} = $1;
-    }
 
     if (defined($args_nr) and $args_nr ne '') {
       $command_args_nr{$command} = $args_nr;
@@ -143,11 +136,6 @@ foreach my $hash_flag (sort(keys(%flags_hashes))) {
   print OUT "our %${hash_flag}_commands = (\n";
   foreach my $command (sort(@{$flags_hashes{$hash_flag}})) {
     print OUT '  '.sprintf('%-25s', '"'.$command.'"')." => 1,\n";
-    if ($multi_category_commands{$command}
-        and $converter_flag{$hash_flag}) {
-      print OUT '  '.sprintf('%-25s', '"'.$multi_category_commands{$command}
-                                                             .'"')." => 1,\n";
-    }
   }
   print OUT ");\n\n";
 }



reply via email to

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