texinfo-commits
[Top][All Lists]
Advanced

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

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


From: Patrice Dumas
Subject: texinfo/tp/Texinfo Common.pm Parser.pm Convert/...
Date: Thu, 29 Sep 2011 13:57:22 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        11/09/29 13:57:21

Modified files:
        tp/Texinfo     : Common.pm Parser.pm 
        tp/Texinfo/Convert: Converter.pm DocBook.pm HTML.pm Info.pm 
                            NodeNameNormalization.pm Plaintext.pm 
                            Text.pm XML.pm 

Log message:
        Put ascii representation of commands in no_brace_commands.
        
        Avoid using informations from Texinfo::Convert::Text.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Common.pm?cvsroot=texinfo&r1=1.66&r2=1.67
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.308&r2=1.309
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Converter.pm?cvsroot=texinfo&r1=1.43&r2=1.44
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/DocBook.pm?cvsroot=texinfo&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/HTML.pm?cvsroot=texinfo&r1=1.155&r2=1.156
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Info.pm?cvsroot=texinfo&r1=1.62&r2=1.63
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/NodeNameNormalization.pm?cvsroot=texinfo&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Plaintext.pm?cvsroot=texinfo&r1=1.164&r2=1.165
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Text.pm?cvsroot=texinfo&r1=1.60&r2=1.61
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/XML.pm?cvsroot=texinfo&r1=1.42&r2=1.43

Patches:
Index: Common.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Common.pm,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -b -r1.66 -r1.67
--- Common.pm   29 Sep 2011 08:40:17 -0000      1.66
+++ Common.pm   29 Sep 2011 13:57:20 -0000      1.67
@@ -163,11 +163,24 @@
 }
 
 our %no_brace_commands;             # commands never taking braces
+%no_brace_commands = (
+           '*', "\n",
+           ' ', ' ',
+           "\t", ' ',
+           "\n", ' ',
+           '-', '',  # hyphenation hint
+           '|', '',  # used in formatting commands @evenfooting and friends
+           '/', '',
+           ':', '',
+           '!', '!',
+           '?', '?',
+           '.', '.',
+           '@', '@',
+           '}', '}',
+           '{', '{',
+           '\\', '\\',  # should only appear in math
+);
 
-foreach my $no_brace_command ('*',' ',"\t","\n",'-', '|', '/',':','!',
-                              '?','.','@','}','{','\\') {
-  $no_brace_commands{$no_brace_command} = 1;
-}
 
 # commands taking a line as argument or no argument.
 # sectioning commands and def* commands are added below.
@@ -1233,7 +1246,8 @@
 =item %no_brace_commands
 
 Commands without brace with a single character as name, like C<*>
-or C<:>.
+or C<:>.  The value is an ascii representation of the command.  It
+may be an empty string.
 
 =item %misc_commands
 

Index: Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.308
retrieving revision 1.309
diff -u -b -r1.308 -r1.309
--- Parser.pm   29 Sep 2011 08:18:14 -0000      1.308
+++ Parser.pm   29 Sep 2011 13:57:21 -0000      1.309
@@ -376,16 +376,19 @@
 }
 
 # commands that may appear in accents
-my %in_accent_commands = (%no_brace_commands, %accent_commands);
+my %in_accent_commands = (%accent_commands);
 foreach my $brace_command(keys(%brace_commands)) {
   $in_accent_commands{$brace_command} = 1 if 
(!$brace_commands{$brace_command});
 }
+foreach my $no_brace_command (keys(%no_brace_commands)) {
+  $in_accent_commands{$no_brace_command} = 1;
+}
 $in_accent_commands{'c'} = 1;
 $in_accent_commands{'comment'} = 1;
 
 # commands that may appear in texts arguments
-my %in_full_text_commands = %no_brace_commands;
-foreach my $command (keys(%brace_commands)) {
+my %in_full_text_commands;
+foreach my $command (keys(%brace_commands), keys(%no_brace_commands)) {
   $in_full_text_commands{$command} = 1;
 }
 foreach my $misc_command_in_full_text('c', 'comment', 'refill', 'noindent',
@@ -4171,7 +4174,7 @@
                  'begin' => $self->{'definfoenclose'}->{$command}->[0], 
                  'end' => $self->{'definfoenclose'}->{$command}->[1] };
           }
-        } elsif ($no_brace_commands{$command}) {
+        } elsif (exists ($no_brace_commands{$command})) {
           push @{$current->{'contents'}},
                  { 'cmdname' => $command, 'parent' => $current };
           # FIXME generalize?

Index: Convert/Converter.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Converter.pm,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -b -r1.43 -r1.44
--- Convert/Converter.pm        29 Sep 2011 11:30:23 -0000      1.43
+++ Convert/Converter.pm        29 Sep 2011 13:57:21 -0000      1.44
@@ -675,10 +675,7 @@
 $default_xml_commands_formatting{'normal'} = {
                'TeX'          => 'TeX',
                'LaTeX'          => 'LaTeX',
-# pertusus: unknown by makeinfo, not in texinfo manual (@* is the right thing)
-#               'br', '<br>',     # paragraph break
                'bullet'       => '&bull;',
-#               #'copyright' => '(C)',
                'copyright'    => '&copy;',
                'registeredsymbol'   => '&reg;',
                'dots'         => '&hellip;',
@@ -733,9 +730,9 @@
                'guilsinglright'          => '&rsaquo;',
 };
 
-foreach my $text_no_brace_command 
(keys(%Texinfo::Convert::Text::text_no_brace_commands)) {
-  $default_xml_commands_formatting{'normal'}->{$text_no_brace_command}
-    = $Texinfo::Convert::Text::text_no_brace_commands{$text_no_brace_command};
+foreach my $no_brace_command (keys(%Texinfo::Common::no_brace_commands)) {
+  $default_xml_commands_formatting{'normal'}->{$no_brace_command}
+    = $Texinfo::Common::no_brace_commands{$no_brace_command};
 }
 
 sub xml_default_comment($$)

Index: Convert/DocBook.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/DocBook.pm,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- Convert/DocBook.pm  29 Sep 2011 11:30:24 -0000      1.14
+++ Convert/DocBook.pm  29 Sep 2011 13:57:21 -0000      1.15
@@ -38,7 +38,7 @@
 # names by default without a very good reason. Use EXPORT_OK instead.
 # Do not simply export all your public functions/methods/constants.
 
-# This allows declaration       use Texinfo::Convert::Text ':all';
+# This allows declaration       use Texinfo::Convert::DocBook ':all';
 # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
 # will save memory.
 %EXPORT_TAGS = ( 'all' => [ qw(

Index: Convert/HTML.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/HTML.pm,v
retrieving revision 1.155
retrieving revision 1.156
diff -u -b -r1.155 -r1.156
--- Convert/HTML.pm     29 Sep 2011 11:30:24 -0000      1.155
+++ Convert/HTML.pm     29 Sep 2011 13:57:21 -0000      1.156
@@ -56,9 +56,7 @@
 
 # misc commands that are of use for formatting.
 my %formatting_misc_commands = 
%Texinfo::Convert::Text::formatting_misc_commands;
-my %text_no_brace_commands = %Texinfo::Convert::Text::text_no_brace_commands;
 my %no_brace_commands = %Texinfo::Common::no_brace_commands;
-my %text_brace_no_arg_commands = 
%Texinfo::Convert::Text::text_brace_no_arg_commands;
 my %accent_commands = %Texinfo::Common::accent_commands;
 my %misc_commands = %Texinfo::Common::misc_commands;
 my %sectioning_commands = %Texinfo::Common::sectioning_commands;

Index: Convert/Info.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Info.pm,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -b -r1.62 -r1.63
--- Convert/Info.pm     29 Sep 2011 11:30:24 -0000      1.62
+++ Convert/Info.pm     29 Sep 2011 13:57:21 -0000      1.63
@@ -32,7 +32,7 @@
 # names by default without a very good reason. Use EXPORT_OK instead.
 # Do not simply export all your public functions/methods/constants.
 
-# This allows declaration       use Texinfo::Covert::Text ':all';
+# This allows declaration       use Texinfo::Convert::Info ':all';
 # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
 # will save memory.
 %EXPORT_TAGS = ( 'all' => [ qw(

Index: Convert/NodeNameNormalization.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/NodeNameNormalization.pm,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- Convert/NodeNameNormalization.pm    20 Aug 2011 14:38:47 -0000      1.13
+++ Convert/NodeNameNormalization.pm    29 Sep 2011 13:57:21 -0000      1.14
@@ -66,7 +66,7 @@
 }
 
 my %normalize_node_no_brace_commands 
-  = %Texinfo::Convert::Text::text_no_brace_commands;
+  = %Texinfo::Common::no_brace_commands;
 $normalize_node_no_brace_commands{'*'} = ' ';
 
 my %accent_commands = %Texinfo::Common::accent_commands;
@@ -260,7 +260,6 @@
       my $accent_text = _convert($root->{'args'}->[0]);
       my $accented_char 
         = Texinfo::Convert::Unicode::unicode_accent($accent_text, 
-                         #$root, \&Texinfo::Convert::Text::ascii_accent);
                                                     $root);
       if (!defined($accented_char)) {
         # In this case, the node normalization do not follow the specification,

Index: Convert/Plaintext.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Plaintext.pm,v
retrieving revision 1.164
retrieving revision 1.165
diff -u -b -r1.164 -r1.165
--- Convert/Plaintext.pm        29 Sep 2011 11:30:24 -0000      1.164
+++ Convert/Plaintext.pm        29 Sep 2011 13:57:21 -0000      1.165
@@ -70,8 +70,12 @@
   $informative_commands{$informative_command} = 1;
 }
 
-my %text_no_brace_commands = %Texinfo::Convert::Text::text_no_brace_commands;
-my %text_brace_no_arg_commands = 
%Texinfo::Convert::Text::text_brace_no_arg_commands;
+my %no_brace_commands = %Texinfo::Common::no_brace_commands;
+my %brace_no_arg_commands;
+foreach my $command (keys (%Texinfo::Common::brace_commands)) {
+  $brace_no_arg_commands{$command} = 1 
+    if ($Texinfo::Common::brace_commands{$command} == 0);
+}
 my %accent_commands = %Texinfo::Common::accent_commands;
 my %misc_commands = %Texinfo::Common::misc_commands;
 my %sectioning_commands = %Texinfo::Common::sectioning_commands;
@@ -1185,7 +1189,7 @@
   if ($root->{'cmdname'}) {
     my $unknown_command;
     my $command = $root->{'cmdname'};
-    if (defined($text_no_brace_commands{$command})) {
+    if (defined($no_brace_commands{$command})) {
       if ($command eq ':') {
         $formatter->{'container'}->inhibit_end_sentence();
         return '';
@@ -1199,18 +1203,22 @@
             $formatter->{'container'}->add_next($command, undef, 1));
       } elsif ($command eq ' ' or $command eq "\n" or $command eq "\t") {
         $result .= $self->_count_added($formatter->{'container'}, 
-            
$formatter->{'container'}->add_next($text_no_brace_commands{$command}));
+            $formatter->{'container'}->add_next($no_brace_commands{$command}));
       } else {
         $result .= $self->_count_added($formatter->{'container'}, 
-            
$formatter->{'container'}->add_text($text_no_brace_commands{$command}));
+            $formatter->{'container'}->add_text($no_brace_commands{$command}));
       }
       return $result;
     } elsif ($root->{'cmdname'} eq 'today') {
       my $today = $self->Texinfo::Common::expand_today();
       unshift @{$self->{'current_contents'}->[-1]}, $today;
-    } elsif (defined($text_brace_no_arg_commands{$root->{'cmdname'}})) {
+    } elsif (exists($brace_no_arg_commands{$root->{'cmdname'}})) {
+      my $encoding;
+      if ($self->get_conf('ENABLE_ENCODING')) {
+        $encoding = $self->{'encoding_name'};
+      }
       my $text = Texinfo::Convert::Text::brace_no_arg_command($root, 
-                             {'enabled_encoding' => $self->{'encoding_name'},
+                             {'enabled_encoding' => $encoding,
                               'sc' => $formatter->{'upper_case'}});
       if ($punctuation_no_arg_commands{$command}) {
         $result .= $self->_count_added($formatter->{'container'},

Index: Convert/Text.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Text.pm,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -b -r1.60 -r1.61
--- Convert/Text.pm     29 Sep 2011 08:40:18 -0000      1.60
+++ Convert/Text.pm     29 Sep 2011 13:57:21 -0000      1.61
@@ -66,6 +66,7 @@
   $ignored_block_commands{$ignored_command} = 1;
 }
 
+# used by Texinfo::Convert::NodeNormalization
 our %text_brace_no_arg_commands = (
                'TeX'                => 'TeX',
                'LaTeX'              => 'LaTeX',
@@ -136,26 +137,8 @@
   $sort_brace_no_arg_commands{$accent_letter} = $accent_letter;
 }
 
-
-our %text_no_brace_commands = (
-           '*', "\n",
-           ' ', ' ',
-           "\t", ' ',
-           "\n", ' ',
-           '-', '',  # hyphenation hint
-           '|', '',  # used in formatting commands @evenfooting and friends
-           '/', '',
-           ':', '',
-           '!', '!',
-           '?', '?',
-           '.', '.',
-           '@', '@',
-           '}', '}',
-           '{', '{',
-           '\\', '\\',  # should only appear in math
-);
-
 my %accent_commands = %Texinfo::Common::accent_commands;
+my %no_brace_commands = %Texinfo::Common::no_brace_commands;
 my %unicode_to_eight_bit = %Texinfo::Convert::Unicode::unicode_to_eight_bit;
 
 our %formatting_misc_commands;
@@ -219,7 +202,7 @@
   my $debug;
   #$debug = 1;
 
-  # FIXME shouldn't it be better to format the innermost conntents with 
+  # FIXME shouldn't it be better to format the innermost contents with 
   # a converter, if present?
   my ($text, $innermost_accent, $stack) 
     = _find_innermost_accent($current, $encoding, $in_upper_case);
@@ -553,8 +536,8 @@
   }
   if ($root->{'cmdname'}) {
     my $command = $root->{'cmdname'};
-    if (defined($text_no_brace_commands{$root->{'cmdname'}})) {
-      return $text_no_brace_commands{$root->{'cmdname'}};
+    if (defined($no_brace_commands{$root->{'cmdname'}})) {
+      return $no_brace_commands{$root->{'cmdname'}};
     } elsif ($root->{'cmdname'} eq 'today') {
       if ($options->{'sort_string'} 
           and $sort_brace_no_arg_commands{$root->{'cmdname'}}) {

Index: Convert/XML.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/XML.pm,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -b -r1.42 -r1.43
--- Convert/XML.pm      29 Sep 2011 11:30:24 -0000      1.42
+++ Convert/XML.pm      29 Sep 2011 13:57:21 -0000      1.43
@@ -38,7 +38,7 @@
 # names by default without a very good reason. Use EXPORT_OK instead.
 # Do not simply export all your public functions/methods/constants.
 
-# This allows declaration       use Texinfo::Convert::Text ':all';
+# This allows declaration       use Texinfo::Convert::XML ':all';
 # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
 # will save memory.
 %EXPORT_TAGS = ( 'all' => [ qw(



reply via email to

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