texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp Texinfo/Common.pm Texinfo/Parser.pm ...


From: Patrice Dumas
Subject: texinfo/tp Texinfo/Common.pm Texinfo/Parser.pm ...
Date: Mon, 22 Nov 2010 18:58:38 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        10/11/22 18:58:38

Modified files:
        tp/Texinfo     : Common.pm Parser.pm 
        tp/Texinfo/Convert: Plaintext.pm 
        tp/t/results/alias: simple.pl 
        tp/t/results/coverage: item_container.pl preformatted.pl 
                               table.pl table_command_comment.pl 
        tp/t/results/invalid_nestings: block_not_matching.pl 
                                       formats_not_closed_in_example.pl 
                                       in_table.pl 
                                       itemx_in_itemize_enumerate_in_table.pl 
                                       style_not_closed_in_table_line.pl 
                                       table_not_closed_in_menu_comment.pl 
                                       table_not_closed_in_menu_description.pl 
        tp/t/results/itemize: accent_argument.pl 
        tp/t/results/macro: macro_in_brace_command.pl 
        tp/t/results/xtable: headitem_in_table.pl 

Log message:
        Add information about the command used in argument of @ŧable and 
@itemize
        and use the @table command information for formatting.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Common.pm?cvsroot=texinfo&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.153&r2=1.154
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Plaintext.pm?cvsroot=texinfo&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/alias/simple.pl?cvsroot=texinfo&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/coverage/item_container.pl?cvsroot=texinfo&r1=1.22&r2=1.23
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/coverage/preformatted.pl?cvsroot=texinfo&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/coverage/table.pl?cvsroot=texinfo&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/coverage/table_command_comment.pl?cvsroot=texinfo&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/invalid_nestings/block_not_matching.pl?cvsroot=texinfo&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/invalid_nestings/formats_not_closed_in_example.pl?cvsroot=texinfo&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/invalid_nestings/in_table.pl?cvsroot=texinfo&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/invalid_nestings/itemx_in_itemize_enumerate_in_table.pl?cvsroot=texinfo&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/invalid_nestings/style_not_closed_in_table_line.pl?cvsroot=texinfo&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/invalid_nestings/table_not_closed_in_menu_comment.pl?cvsroot=texinfo&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/invalid_nestings/table_not_closed_in_menu_description.pl?cvsroot=texinfo&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/itemize/accent_argument.pl?cvsroot=texinfo&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/macro/macro_in_brace_command.pl?cvsroot=texinfo&r1=1.22&r2=1.23
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/xtable/headitem_in_table.pl?cvsroot=texinfo&r1=1.10&r2=1.11

Patches:
Index: Texinfo/Common.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Common.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- Texinfo/Common.pm   21 Nov 2010 11:57:15 -0000      1.3
+++ Texinfo/Common.pm   22 Nov 2010 18:58:36 -0000      1.4
@@ -335,11 +335,13 @@
   $preformatted_commands{$preformatted_command} = 1;
 }
 
+our %raw_commands;
 our @out_formats = ('html', 'tex', 'xml', 'docbook');
 # macro/rmacro are special
 foreach my $raw_command (@out_formats, 'verbatim', 
                          'ignore', 'macro', 'rmacro') {
   $block_commands{$raw_command} = 'raw';
+  $raw_commands{$raw_command} = 1;
 }
 
 foreach my $command (@out_formats, 'info', 'plaintext') {

Index: Texinfo/Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.153
retrieving revision 1.154
diff -u -b -r1.153 -r1.154
--- Texinfo/Parser.pm   21 Nov 2010 23:36:08 -0000      1.153
+++ Texinfo/Parser.pm   22 Nov 2010 18:58:37 -0000      1.154
@@ -2358,6 +2358,8 @@
           delete $current->{'contents'};
           print STDERR "FOR PARENT 
address@hidden>{'parent'}->{'parent'}->{'cmdname'} command_as_argument 
$current->{'cmdname'}\n" if ($self->{'debug'});
           $current->{'type'} = 'command_as_argument';
+          $current->{'parent'}->{'parent'}->{'extra'}->{'command_as_argument'} 
+            = $current->{'cmdname'};
           $current = $current->{'parent'};
 
         # now accent commands

Index: Texinfo/Convert/Plaintext.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Plaintext.pm,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- Texinfo/Convert/Plaintext.pm        21 Nov 2010 22:30:35 -0000      1.15
+++ Texinfo/Convert/Plaintext.pm        22 Nov 2010 18:58:37 -0000      1.16
@@ -86,6 +86,7 @@
 my %preformatted_commands = %Texinfo::Common::preformatted_commands;
 my %explained_commands = %Texinfo::Common::explained_commands;
 my %item_container_commands = %Texinfo::Common::item_container_commands;
+my %raw_commands = %Texinfo::Common::raw_commands;
 
 foreach my $def_command (keys(%def_commands)) {
   $kept_misc_commands{$def_command} = 1 if ($misc_commands{$def_command});
@@ -120,10 +121,17 @@
     if exists($block_commands{$indented_command});
 }
 
+my %format_context_commands = %indented_commands;
+
 foreach my $non_indented('format', 'smallformat') {
   delete $indented_commands{$non_indented};
 }
 
+foreach my $format_context_command (keys(%menu_commands), 'verbatim',
+ 'flushleft', 'flushright', 'multitable') {
+  $format_context_commands{$format_context_command} = 1;
+}
+
 # commands that leads to advancing the paragraph number.  This is mostly
 #used to determine the first line, in fact.
 my %advance_paragraph_count_commands;
@@ -631,6 +639,7 @@
                     'contents' => address@hidden,
                    {'text' => ')'},];
         } elsif (defined($args[4])) {
+          # FIXME this is a bit strange.
           $file = [{'text' => '()'}];
         }
         if ($name) {
@@ -638,6 +647,7 @@
           if ($file) {
             push @contents, @$file;
           }
+          # node name
           push @contents, ({'type' => 'code',
                             'contents' => address@hidden);
           push @contents, {'text' => '.'} if ($command eq 'pxref');
@@ -695,15 +705,19 @@
       #    at the end. do something specific here or at the end?
       #    punctuation munging is done, but end of lines are kept.
 
-      if ($preformatted_commands{$root->{'cmdname'}} or 
$menu_commands{$root->{'cmdname'}}) {
+      if ($preformatted_commands{$root->{'cmdname'}} 
+           or $menu_commands{$root->{'cmdname'}}
+           or $root->{'cmdname'} eq 'verbatim') {
         push @{$self->{'context'}}, 'preformatted';
       }
-      if ($indented_commands{$root->{'cmdname'}}) {
+      if ($format_context_commands{$root->{'cmdname'}}) {
         push @{$self->{'format_context'}}, { 'cmdname' => $root->{'cmdname'},
                'paragraph_count' => 0,
                'indent_level' => 
-                   $self->{'format_context'}->[-1]->{'indent_level'} + 1,
+                   $self->{'format_context'}->[-1]->{'indent_level'},
                'max' => $self->{'format_context'}->[-1]->{'max'} };
+        $self->{'format_context'}->[-1]->{'indent_level'}++
+           if ($indented_commands{$root->{'cmdname'}});
         if ($self->{'context'}->[-1] eq 'preformatted') {
           $preformatted = $self->new_formatter('unfilled');
           push @{$self->{'formatters'}}, $preformatted;
@@ -726,12 +740,23 @@
     } elsif ($root->{'cmdname'} eq 'node') {
         # FIXME handle node
     } elsif ($misc_commands{$root->{'cmdname'}}) {
-      if (($sectioning_commands{$root->{'cmdname'}}
-          or ($root->{'cmdname'} eq 'item' or $root->{'cmdname'} eq 'itemx'))
-              and $root->{'args'}) {
+      if ($sectioning_commands{$root->{'cmdname'}}) {
         # FIXME handle sectioning commands with their underline
-        # and item with their prepending
-        $result = $self->convert_line($root->{'args'}->[0],
+        if ($root->{'args'}) {
+          $result = $self->convert_line($root->{'args'}->[0]);
+          chomp ($result);
+          $result .= "\n";
+        }
+      } elsif (($root->{'cmdname'} eq 'item' or $root->{'cmdname'} eq 'itemx')
+              and $root->{'extra'} and $root->{'extra'}->{'misc_content'}) {
+        my $contents = $root->{'extra'}->{'misc_content'};
+        if ($root->{'parent'}->{'extra'} and 
$root->{'parent'}->{'extra'}->{'command_as_argument'}) {
+          $contents = [{'cmdname' => 
$root->{'parent'}->{'extra'}->{'command_as_argument'},
+                   'args' => [{'type' => 'brace_command_arg', 
+                              'contents' => address@hidden
+          }];
+        }
+        $result = $self->convert_line({'contents' => address@hidden,
             {'indent_level' => 
$self->{'format_context'}->[-1]->{'indent_level'} -1});
         chomp ($result);
         $result .= "\n";
@@ -891,10 +916,7 @@
     push @{$self->{'current_contents'}}, address@hidden;
     while (@contents) {
       my $content = shift @contents;
-      # FIXME an empty line between block commands don't seem to be 
-      # output.
-      if ($content->{'type'} 
-          and $content->{'type'} eq 'empty_line') {
+      if ($content->{'type'} and $content->{'type'} eq 'empty_line') {
         $result .= "\n" if (!$self->{'empty_lines_count'} 
                             or $self->{'context'}->[-1] eq 'preformatted');
         $self->{'empty_lines_count'}++;

Index: t/results/alias/simple.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/results/alias/simple.pl,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- t/results/alias/simple.pl   20 Nov 2010 16:58:03 -0000      1.23
+++ t/results/alias/simple.pl   22 Nov 2010 18:58:37 -0000      1.24
@@ -251,7 +251,8 @@
           [
             {}
           ]
-        ]
+        ],
+        'command_as_argument' => 'code'
       },
       'parent' => {}
     },

Index: t/results/coverage/item_container.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/results/coverage/item_container.pl,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- t/results/coverage/item_container.pl        21 Nov 2010 22:41:27 -0000      
1.22
+++ t/results/coverage/item_container.pl        22 Nov 2010 18:58:37 -0000      
1.23
@@ -157,7 +157,8 @@
           [
             {}
           ]
-        ]
+        ],
+        'command_as_argument' => 'bullet'
       },
       'parent' => {}
     },

Index: t/results/coverage/preformatted.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/results/coverage/preformatted.pl,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- t/results/coverage/preformatted.pl  20 Nov 2010 23:35:41 -0000      1.24
+++ t/results/coverage/preformatted.pl  22 Nov 2010 18:58:37 -0000      1.25
@@ -147,7 +147,8 @@
               [
                 {}
               ]
-            ]
+            ],
+            'command_as_argument' => 'code'
           },
           'parent' => {}
         },
@@ -234,7 +235,7 @@
      e-xample  some  
 
    text
-item in table in format
+`item in table in format\'
 
      in table in format
 ';

Index: t/results/coverage/table.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/results/coverage/table.pl,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- t/results/coverage/table.pl 20 Nov 2010 23:35:41 -0000      1.23
+++ t/results/coverage/table.pl 22 Nov 2010 18:58:37 -0000      1.24
@@ -129,7 +129,8 @@
           [
             {}
           ]
-        ]
+        ],
+        'command_as_argument' => 'asis'
       },
       'parent' => {}
     },
@@ -403,7 +404,8 @@
           [
             {}
           ]
-        ]
+        ],
+        'command_as_argument' => 'samp'
       },
       'parent' => {}
     },
@@ -533,8 +535,8 @@
 table itemx
      In table
 
-vtable item
-itemx vtable
+`vtable item\'
+`itemx vtable\'
 ';
 
 1;

Index: t/results/coverage/table_command_comment.pl
===================================================================
RCS file: 
/sources/texinfo/texinfo/tp/t/results/coverage/table_command_comment.pl,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- t/results/coverage/table_command_comment.pl 20 Nov 2010 17:05:41 -0000      
1.18
+++ t/results/coverage/table_command_comment.pl 22 Nov 2010 18:58:37 -0000      
1.19
@@ -80,7 +80,8 @@
           [
             {}
           ]
-        ]
+        ],
+        'command_as_argument' => 'code'
       },
       'parent' => {}
     },
@@ -120,7 +121,7 @@
 
 
 
-$result_converted{'plaintext'}->{'table_command_comment'} = 'item
+$result_converted{'plaintext'}->{'table_command_comment'} = '`item\'
 ';
 
 1;

Index: t/results/invalid_nestings/block_not_matching.pl
===================================================================
RCS file: 
/sources/texinfo/texinfo/tp/t/results/invalid_nestings/block_not_matching.pl,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- t/results/invalid_nestings/block_not_matching.pl    20 Nov 2010 16:58:06 
-0000      1.13
+++ t/results/invalid_nestings/block_not_matching.pl    22 Nov 2010 18:58:37 
-0000      1.14
@@ -302,7 +302,8 @@
           [
             {}
           ]
-        ]
+        ],
+        'command_as_argument' => 'emph'
       },
       'parent' => {}
     },

Index: t/results/invalid_nestings/formats_not_closed_in_example.pl
===================================================================
RCS file: 
/sources/texinfo/texinfo/tp/t/results/invalid_nestings/formats_not_closed_in_example.pl,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- t/results/invalid_nestings/formats_not_closed_in_example.pl 22 Nov 2010 
01:05:38 -0000      1.13
+++ t/results/invalid_nestings/formats_not_closed_in_example.pl 22 Nov 2010 
18:58:37 -0000      1.14
@@ -176,7 +176,8 @@
               [
                 {}
               ]
-            ]
+            ],
+            'command_as_argument' => 'minus'
           },
           'parent' => {}
         }

Index: t/results/invalid_nestings/in_table.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/results/invalid_nestings/in_table.pl,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- t/results/invalid_nestings/in_table.pl      20 Nov 2010 16:58:06 -0000      
1.20
+++ t/results/invalid_nestings/in_table.pl      22 Nov 2010 18:58:37 -0000      
1.21
@@ -45,7 +45,8 @@
           [
             {}
           ]
-        ]
+        ],
+        'command_as_argument' => 'xref'
       },
       'parent' => {}
     },
@@ -307,7 +308,8 @@
           [
             {}
           ]
-        ]
+        ],
+        'command_as_argument' => 'code'
       },
       'parent' => {}
     },

Index: t/results/invalid_nestings/itemx_in_itemize_enumerate_in_table.pl
===================================================================
RCS file: 
/sources/texinfo/texinfo/tp/t/results/invalid_nestings/itemx_in_itemize_enumerate_in_table.pl,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- t/results/invalid_nestings/itemx_in_itemize_enumerate_in_table.pl   21 Nov 
2010 23:36:09 -0000      1.11
+++ t/results/invalid_nestings/itemx_in_itemize_enumerate_in_table.pl   22 Nov 
2010 18:58:37 -0000      1.12
@@ -186,7 +186,8 @@
           [
             {}
           ]
-        ]
+        ],
+        'command_as_argument' => 'strong'
       },
       'parent' => {}
     },

Index: t/results/invalid_nestings/style_not_closed_in_table_line.pl
===================================================================
RCS file: 
/sources/texinfo/texinfo/tp/t/results/invalid_nestings/style_not_closed_in_table_line.pl,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- t/results/invalid_nestings/style_not_closed_in_table_line.pl        20 Nov 
2010 16:58:07 -0000      1.12
+++ t/results/invalid_nestings/style_not_closed_in_table_line.pl        22 Nov 
2010 18:58:37 -0000      1.13
@@ -139,7 +139,8 @@
           [
             {}
           ]
-        ]
+        ],
+        'command_as_argument' => 'asis'
       },
       'parent' => {}
     },

Index: t/results/invalid_nestings/table_not_closed_in_menu_comment.pl
===================================================================
RCS file: 
/sources/texinfo/texinfo/tp/t/results/invalid_nestings/table_not_closed_in_menu_comment.pl,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- t/results/invalid_nestings/table_not_closed_in_menu_comment.pl      20 Nov 
2010 16:58:07 -0000      1.13
+++ t/results/invalid_nestings/table_not_closed_in_menu_comment.pl      22 Nov 
2010 18:58:37 -0000      1.14
@@ -153,7 +153,8 @@
                   [
                     {}
                   ]
-                ]
+                ],
+                'command_as_argument' => 'bullet'
               },
               'parent' => {}
             }

Index: t/results/invalid_nestings/table_not_closed_in_menu_description.pl
===================================================================
RCS file: 
/sources/texinfo/texinfo/tp/t/results/invalid_nestings/table_not_closed_in_menu_description.pl,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- t/results/invalid_nestings/table_not_closed_in_menu_description.pl  20 Nov 
2010 16:58:07 -0000      1.13
+++ t/results/invalid_nestings/table_not_closed_in_menu_description.pl  22 Nov 
2010 18:58:37 -0000      1.14
@@ -116,7 +116,8 @@
                       [
                         {}
                       ]
-                    ]
+                    ],
+                    'command_as_argument' => 'minus'
                   },
                   'parent' => {}
                 }

Index: t/results/itemize/accent_argument.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/results/itemize/accent_argument.pl,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- t/results/itemize/accent_argument.pl        21 Nov 2010 22:41:27 -0000      
1.18
+++ t/results/itemize/accent_argument.pl        22 Nov 2010 18:58:38 -0000      
1.19
@@ -73,7 +73,8 @@
           [
             {}
           ]
-        ]
+        ],
+        'command_as_argument' => '~'
       },
       'parent' => {}
     },
@@ -152,7 +153,8 @@
           [
             {}
           ]
-        ]
+        ],
+        'command_as_argument' => '~'
       },
       'parent' => {}
     },

Index: t/results/macro/macro_in_brace_command.pl
===================================================================
RCS file: 
/sources/texinfo/texinfo/tp/t/results/macro/macro_in_brace_command.pl,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- t/results/macro/macro_in_brace_command.pl   21 Nov 2010 22:41:27 -0000      
1.22
+++ t/results/macro/macro_in_brace_command.pl   22 Nov 2010 18:58:38 -0000      
1.23
@@ -190,7 +190,8 @@
           [
             {}
           ]
-        ]
+        ],
+        'command_as_argument' => 'bullet'
       },
       'parent' => {}
     },

Index: t/results/xtable/headitem_in_table.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/results/xtable/headitem_in_table.pl,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- t/results/xtable/headitem_in_table.pl       20 Nov 2010 16:58:10 -0000      
1.10
+++ t/results/xtable/headitem_in_table.pl       22 Nov 2010 18:58:38 -0000      
1.11
@@ -114,7 +114,8 @@
           [
             {}
           ]
-        ]
+        ],
+        'command_as_argument' => 'strong'
       },
       'parent' => {}
     },



reply via email to

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