texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp texi2any.pl Texinfo/Structuring.pm T...


From: Patrice Dumas
Subject: texinfo/tp texi2any.pl Texinfo/Structuring.pm T...
Date: Tue, 12 Apr 2011 23:52:54 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        11/04/12 23:52:54

Modified files:
        tp             : texi2any.pl 
        tp/Texinfo     : Structuring.pm 
        tp/Texinfo/Convert: Converter.pm HTML.pm 

Log message:
        Add a texi2html style.
        
        Handle correctly document with element but without the command used 
        for elements.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/texi2any.pl?cvsroot=texinfo&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Structuring.pm?cvsroot=texinfo&r1=1.52&r2=1.53
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Converter.pm?cvsroot=texinfo&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/HTML.pm?cvsroot=texinfo&r1=1.17&r2=1.18

Patches:
Index: texi2any.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/texi2any.pl,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- texi2any.pl 5 Apr 2011 22:43:36 -0000       1.29
+++ texi2any.pl 12 Apr 2011 23:52:53 -0000      1.30
@@ -369,6 +369,39 @@
   return $error_count;
 }
 
+sub _set_variables_texi2html()
+{
+  set_from_cmdline('USE_SETFILENAME', 0);
+  set_from_cmdline('USE_SETFILENAME_EXTENSION', 0);
+  set_from_cmdline('footnotestyle', 'separate');
+  set_from_cmdline('INLINE_CONTENTS', 0);
+  set_from_cmdline('FORCE', 1);
+  set_from_cmdline('AVOID_MENU_REDUNDANCY', 1);
+  set_from_cmdline('TOP_HEADING_AT_BEGINNING', 1);
+  set_from_cmdline('TOP_FILE', '');
+  set_from_cmdline('USE_ACCESSKEY', 0);
+  set_from_cmdline('NODE_NAME_IN_MENU', 0);
+  set_from_cmdline('OVERVIEW_LINK_TO_TOC', 0);
+  set_from_cmdline('USE_UP_FOR_ADJACENT_NODES', 1);
+  set_from_cmdline('USE_REL_REV', 0);
+  set_from_cmdline('USE_LINKS', 0);
+  set_from_cmdline('USE_NODES', undef);
+  set_from_cmdline('USE_SECTIONS', 1);
+  set_from_cmdline('NODE_FILENAMES', 0);
+  set_from_cmdline('USE_NUMERIC_ENTITY', 1);
+  set_from_cmdline('SPLIT', '');
+  set_from_cmdline('SPLIT_INDEX', 100);
+  set_from_cmdline('PROGRAM_NAME_IN_FOOTER', 1);
+  set_from_cmdline('HEADER_IN_TABLE', 1);
+  set_from_cmdline('SHORT_REF', 0);
+  set_from_cmdline('USE_TITLEPAGE_FOR_TITLE', 1);
+  # FIXME
+#  $MENU_ENTRY_COLON = '';
+#  $INDEX_ENTRY_COLON = '';
+
+  set_from_cmdline('ENABLE_ENCODING_USE_ENTITY', 1);
+}
+
 my $result_options = Getopt::Long::GetOptions (
  'macro-expand|E=s' => sub { push @texi2dvi_args, '-E'; 
                              set_from_cmdline('MACRO_EXPAND', $_[1]); },
@@ -445,6 +478,9 @@
      # special case, this is a pseudo format for debug
      if ($var eq 'DEBUGCOUNT') {
        $format = 'debugcount';
+     } elsif ($var eq 'TEXI2HTML') {
+       $format = 'html';
+       _set_variables_texi2html();
      } else {
      # this is very wrong, but a way to avoid a spurious warning.
        no warnings 'once';

Index: Texinfo/Structuring.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Structuring.pm,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -b -r1.52 -r1.53
--- Texinfo/Structuring.pm      12 Apr 2011 21:29:06 -0000      1.52
+++ Texinfo/Structuring.pm      12 Apr 2011 23:52:53 -0000      1.53
@@ -616,7 +616,7 @@
   my $elements = shift;
   my $split = shift;
 
-  return undef if (!$elements);
+  return undef if (!$elements or address@hidden);
 
   my $split_level;
   if ($split eq 'chapter') {
@@ -813,7 +813,8 @@
   
   my $command = $element->{'extra'}->{'element_command'};
   if (!defined($command)) {
-    my $result = "BUG: no associated command ";
+    # happens when there are only nodes and sections are used as elements
+    my $result = "No associated command ";
     $result .= "(type $element->{'type'})" if (defined($element->{'type'}));
     return $result;
   }

Index: Texinfo/Convert/Converter.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Converter.pm,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- Texinfo/Convert/Converter.pm        10 Apr 2011 20:36:28 -0000      1.11
+++ Texinfo/Convert/Converter.pm        12 Apr 2011 23:52:53 -0000      1.12
@@ -300,6 +300,8 @@
         $outfile .= '.'.$self->get_conf('EXTENSION') 
           if (defined($self->get_conf('EXTENSION')) 
               and $self->get_conf('EXTENSION') ne '');
+      } else {
+        $document_name = $outfile;
       }
     } elsif ($input_basename ne '') {
       $outfile = $input_basename;

Index: Texinfo/Convert/HTML.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/HTML.pm,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- Texinfo/Convert/HTML.pm     12 Apr 2011 21:29:06 -0000      1.17
+++ Texinfo/Convert/HTML.pm     12 Apr 2011 23:52:53 -0000      1.18
@@ -839,10 +839,12 @@
 
   my $result = '';
 
-  die "BUG: no 'element_command' for $element\n" 
-    if (!$element->{'extra'}->{'element_command'});
-  die "BUG: no target for $element\n" 
-    if (!$self->{'targets'}->{$element->{'extra'}->{'element_command'}});
+  # This may happen if there are only nodes and sections are used as elements
+  #die "BUG: no 'element_command' for $element" 
+  #  if (!$element->{'extra'}->{'element_command'});
+  die "BUG: no target for $element" 
+    if ($element->{'extra'}->{'element_command'} and
+        !$self->{'targets'}->{$element->{'extra'}->{'element_command'}});
   print STDERR "NEW ELEMENT 
$self->{'targets'}->{$element->{'extra'}->{'element_command'}}->{'id'}\n"
     if ($self->get_conf('DEBUG'));
 
@@ -951,12 +953,9 @@
 
   if ($elements) {
     foreach my $element (@$elements) {
-      if (!defined($element->{'extra'}->{'element_command'})) {
-        print STDERR "BUG: no element_command for $element\n";
-      }
       foreach my $root_command(@{$element->{'contents'}}) {
-        # FIXME this happens before the first element, for type 'text_root'.
-        # What should be done in that case?
+        # FIXME this happens for type 'text_root' which precedes the 
+        # root commands.  The target may also already be set for top node.
         next if (!defined($root_command->{'cmdname'}) 
                  or $self->{'targets'}->{$root_command});
         if ($Texinfo::Common::root_commands{$root_command->{'cmdname'}}) {
@@ -1071,7 +1070,7 @@
                 and $self->get_conf('EXTENSION') ne '');
 
   if (!$self->get_conf('SPLIT')) {
-    my $page = shift @$pages;
+    my $page = $pages->[0];
     $page->{'filename'} = $self->{'document_name'}.$extension;
     $page->{'out_filename'} = $self->get_conf('OUTFILE');
   } else {
@@ -1147,6 +1146,8 @@
       $self->_set_page_file($page, $filename) if (defined($filename));
     }
     $self->{'file_counters'}->{$page->{'filename'}}++;
+    print STDERR "Page $page: 
$page->{'filename'}($self->{'file_counters'}->{$page->{'filename'}})\n"
+      if ($self->get_conf('DEBUG'));
   }
   if ($special_pages) {
     my $previous_page = $pages->[-1];
@@ -1155,6 +1156,8 @@
       $page->{'prev_page'} = $previous_page;
       $previous_page->{'next_page'} = $page;
       $previous_page = $page;
+      print STDERR "Special page $page: 
$page->{'filename'}($self->{'file_counters'}->{$page->{'filename'}})\n"
+        if ($self->get_conf('DEBUG'));
     }
   }
 }
@@ -1420,7 +1423,7 @@
       return $self->_external_node_reference($element_target, $type, 
$filename);
     } else {
       $command = $element_target->{'extra'}->{'element_command'};
-      $target = $self->{'targets'}->{$command};
+      $target = $self->{'targets'}->{$command} if ($command);
     }
   } else {
     return undef;



reply via email to

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