texinfo-commits
[Top][All Lists]
Advanced

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

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


From: Patrice Dumas
Subject: texinfo/tp/Texinfo Parser.pm Convert/Converter....
Date: Sun, 10 Apr 2011 20:36:29 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        11/04/10 20:36:29

Modified files:
        tp/Texinfo     : Parser.pm 
        tp/Texinfo/Convert: Converter.pm HTML.pm Plaintext.pm 

Log message:
        Handle @*contents as configuration too.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.238&r2=1.239
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Converter.pm?cvsroot=texinfo&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/HTML.pm?cvsroot=texinfo&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Plaintext.pm?cvsroot=texinfo&r1=1.132&r2=1.133

Patches:
Index: Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.238
retrieving revision 1.239
diff -u -b -r1.238 -r1.239
--- Parser.pm   10 Apr 2011 17:43:16 -0000      1.238
+++ Parser.pm   10 Apr 2011 20:36:28 -0000      1.239
@@ -406,7 +406,7 @@
   'kbdinputstyle', 'paragraphindent', 'firstparagraphindent',
   'frenchspacing', 'footnotestyle', 'hyphenation', 'urefbreakstyle',
   'xrefautomaticsectiontitle', 'codequoteundirected',
-  'codequotebacktick', 'titlefont') {
+  'codequotebacktick', 'titlefont', 'footnote') {
   $global_multiple_commands{$global_multiple_command} = 1;
 }
 

Index: Convert/Converter.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Converter.pm,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- Convert/Converter.pm        6 Apr 2011 23:48:53 -0000       1.10
+++ Convert/Converter.pm        10 Apr 2011 20:36:28 -0000      1.11
@@ -64,7 +64,7 @@
   return ();
 }
 
-sub _initialize_global_command($$)
+sub _initialize_global_command($$$)
 {
 }
 
@@ -112,18 +112,6 @@
 
       $converter->{'floats'} = $floats if ($floats);
       $converter->{'labels'} = $labels if ($labels);
-      $converter->set_conf('setcontentsaftertitlepage', 1)
-         if ($converter->{'extra'}->{'contents'} 
-               and $converter->{'extra'}->{'setcontentsaftertitlepage'}
-               and $converter->{'structuring'}
-               and $converter->{'structuring'}->{'sectioning_root'});
-      $converter->set_conf('setshortcontentsaftertitlepage', 1)
-         if (($converter->{'extra'}->{'shortcontents'} 
-              or $converter->{'extra'}->{'summarycontents'})
-               and $converter->{'extra'}->{'setshortcontentsaftertitlepage'}
-               and $converter->{'structuring'}
-               and $converter->{'structuring'}->{'sectioning_root'});
-      $converter->{'gettext'} = $converter->{'parser'}->{'gettext'};
       foreach my $global_command ($converter->_global_commands()) {
         if (defined($converter->{'extra'}->{$global_command})) {
           my $root = $converter->{'extra'}->{$global_command};
@@ -132,10 +120,21 @@
           #}
           #if (ref($root) ne 'ARRAY') {
           #$converter->_informative_command($root);
-          $converter->_initialize_global_command($root);
+          $converter->_initialize_global_command($global_command, $root);
           #}
         }
       }
+      $converter->set_conf('setcontentsaftertitlepage', 1)
+         if ($converter->get_conf('contents')
+               and $converter->{'extra'}->{'setcontentsaftertitlepage'}
+               and $converter->{'structuring'}
+               and $converter->{'structuring'}->{'sectioning_root'});
+      $converter->set_conf('setshortcontentsaftertitlepage', 1)
+         if ($converter->get_conf('shortcontents') 
+               and $converter->{'extra'}->{'setshortcontentsaftertitlepage'}
+               and $converter->{'structuring'}
+               and $converter->{'structuring'}->{'sectioning_root'});
+      $converter->{'gettext'} = $converter->{'parser'}->{'gettext'};
       delete $conf->{'parser'};
     }
     foreach my $key (keys(%$conf)) {

Index: Convert/HTML.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/HTML.pm,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- Convert/HTML.pm     10 Apr 2011 17:43:17 -0000      1.14
+++ Convert/HTML.pm     10 Apr 2011 20:36:29 -0000      1.15
@@ -193,6 +193,7 @@
   'include_directories'  => undef,
   'NUMBER_SECTIONS'      => 1,
   'USE_NODES'            => 1,
+  'INLINE_CONTENTS'      => 1,
   'SPLIT'                => 'node',
 # if set style is added in attribute.
   'INLINE_CSS_STYLE'     => 0,
@@ -1275,7 +1276,6 @@
   }
 }
 
-
 # FIXME global targets
 sub _element_direction($$$$;$)
 {
@@ -1534,18 +1534,24 @@
                                                 $self->get_conf('SPLIT'));
   $self->{'pages'} = $pages;
   
-  # TODO handle special elements, footnotes element, contents and shortcontents
-  # elements, titlepage association
-
   # determine file names associated with the different pages.
   $self->_set_page_files($pages);
 
-  # Add element directions.  FIXME do it here or before?  Here it means that
+  # do element directions.  FIXME do it here or before?  Here it means that
   # PrevFile and NextFile can be set.
   Texinfo::Structuring::element_directions($self, $elements);
 
   # FIXME Before that, set multiple commands
   # FIXME set language and documentencoding/encoding_name
+
+  # TODO handle special elements, footnotes element, contents and shortcontents
+  # elements, titlepage association
+
+  if ($self->{'structuring'} and $self->{'structuring'}->{'sectioning_root'}
+      and !$self->get_conf('INLINE_CONTENTS')) {
+    #if ($self->get_conf('contents') and 
+  }
+
   $self->set_conf('BODYTEXT',  'lang="' . $self->get_conf('documentlanguage') 
. '" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" 
alink="#FF0000"');
 
   # prepare title

Index: Convert/Plaintext.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Plaintext.pm,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -b -r1.132 -r1.133
--- Convert/Plaintext.pm        6 Apr 2011 23:48:53 -0000       1.132
+++ Convert/Plaintext.pm        10 Apr 2011 20:36:29 -0000      1.133
@@ -62,7 +62,8 @@
 my $NO_NUMBER_FOOTNOTE_SYMBOL = '*';
 
 my @informative_global_commands = ('paragraphindent', 'firstparagraphindent',
-'frenchspacing', 'documentencoding', 'footnotestyle', 'documentlanguage');
+'frenchspacing', 'documentencoding', 'footnotestyle', 'documentlanguage',
+'contents', 'shortcontents', 'summarycontents');
 
 my %informative_commands;
 foreach my $informative_command (@informative_global_commands) {
@@ -91,8 +92,7 @@
 foreach my $kept_command(keys (%informative_commands),
   keys (%default_index_commands),
   'verbatiminclude', 'insertcopying', 
-  'listoffloats', 'printindex',
-  'contents', 'shortcontents', 'summarycontents') {
+  'listoffloats', 'printindex', ) {
   $formatting_misc_commands{$kept_command} = 1;
 }
 
@@ -278,12 +278,22 @@
   $self->{'formatters'}->[-1]->{'_top_formatter'} = 1;
 }
 
+
+my %contents_commands = (
+ 'contents' => 1,
+ 'shortcontents' => 1,
+ 'summarycontents' => 1,
+);
+
 sub _initialize_global_command($$)
 {
   my $self = shift;
+  my $command = shift;
   my $root = shift;
   if (ref($root) ne 'ARRAY') {
     $self->_informative_command($root);
+  } elsif ($contents_commands{$command}) {
+    $self->_informative_command($root->[0]);
   }
 }
 
@@ -291,11 +301,17 @@
 {
   my $self = shift;
   my $root = shift;
-  return if ($self->{'set'}->{$root->{'cmdname'}});
 
-  if (exists($root->{'extra'}->{'text_arg'})) {
-    $self->set_conf($root->{'cmdname'}, $root->{'extra'}->{'text_arg'});
-    if ($root->{'cmdname'} eq 'documentencoding'
+  my $cmdname = $root->{'cmdname'};
+  $cmdname = 'shortcontents' if ($cmdname eq 'summarycontents');
+
+  return if ($self->{'set'}->{$cmdname});
+
+  if ($misc_commands{$cmdname} eq 'skipline') {
+    $self->set_conf($cmdname, 1);
+  } elsif (exists($root->{'extra'}->{'text_arg'})) {
+    $self->set_conf($cmdname, $root->{'extra'}->{'text_arg'});
+    if ($cmdname eq 'documentencoding'
         and defined($root->{'extra'})
         and defined($root->{'extra'}->{'perl_encoding'})
         and !$self->{'perl_encoding'}) {
@@ -314,16 +330,14 @@
       #  binmode($filehandle, ":encoding($encoding)");
       #}
     }
-  } elsif ($misc_commands{$root->{'cmdname'}} eq 'skipline') {
-    $self->set_conf($root->{'cmdname'}, 1);
   } elsif ($root->{'extra'} and $root->{'extra'}->{'misc_args'} 
            and exists($root->{'extra'}->{'misc_args'}->[0])) {
-    $self->set_conf($root->{'cmdname'}, $root->{'extra'}->{'misc_args'}->[0]);
-    if ($root->{'cmdname'} eq 'paragraphindent') {
+    $self->set_conf($cmdname, $root->{'extra'}->{'misc_args'}->[0]);
+    if ($cmdname eq 'paragraphindent') {
       if ($root->{'extra'}->{'misc_args'}->[0] eq 'asis') {
         delete $self->{'ignored_types'}->{'empty_spaces_before_paragraph'};
       } else {
-        $self->set_conf($root->{'cmdname'}, 0)
+        $self->set_conf($cmdname, 0)
           if ($root->{'extra'}->{'misc_args'}->[0] eq 'none');
         $self->{'ignored_types'}->{'empty_spaces_before_paragraph'} = 1;
       }



reply via email to

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