texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp texi2any.pl Texinfo/Common.pm Texinf...


From: Patrice Dumas
Subject: texinfo/tp texi2any.pl Texinfo/Common.pm Texinf...
Date: Sun, 02 Oct 2011 20:31:21 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        11/10/02 20:31:21

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

Log message:
        Check values of split and handle rightly bad values.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/texi2any.pl?cvsroot=texinfo&r1=1.65&r2=1.66
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Common.pm?cvsroot=texinfo&r1=1.71&r2=1.72
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Structuring.pm?cvsroot=texinfo&r1=1.93&r2=1.94
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/HTML.pm?cvsroot=texinfo&r1=1.169&r2=1.170

Patches:
Index: texi2any.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/texi2any.pl,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -b -r1.65 -r1.66
--- texi2any.pl 2 Oct 2011 11:17:21 -0000       1.65
+++ texi2any.pl 2 Oct 2011 20:31:19 -0000       1.66
@@ -640,7 +640,16 @@
       die sprintf(__("%s: --footnote-style arg must be `separate' or `end', 
not `%s'.\n"), $real_command_name, $_[1]);
     }
   },
- 'split=s' => sub { set_from_cmdline('SPLIT', $_[1]); },
+ 'split=s' => sub {  my $split = $_[1];
+                     my @messages 
+                       = Texinfo::Common::warn_unknown_split($_[1], \&__);
+                     if (@messages) {
+                       foreach my $message (@messages) {
+                         document_warn($message);
+                       }
+                       $split = $Texinfo::Convert::HTML::defaults{'SPLIT'};
+                     }
+                     set_from_cmdline('SPLIT', $split); },
  'no-split' => sub { set_from_cmdline('SPLIT', ''); 
                      set_from_cmdline('SPLIT_SIZE', undef);},
  'headers!' => sub { set_from_cmdline('HEADERS', $_[1]);

Index: Texinfo/Common.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Common.pm,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -b -r1.71 -r1.72
--- Texinfo/Common.pm   30 Sep 2011 22:31:30 -0000      1.71
+++ Texinfo/Common.pm   2 Oct 2011 20:31:20 -0000       1.72
@@ -765,17 +765,35 @@
   }
 
   if (! $Texinfo::Documentlanguages::language_codes{$lang_code}) {
-    push @messages, sprintf(&$gettext("%s is not a valid language code"), 
+    push @messages, sprintf(&$gettext(N__("%s is not a valid language code")), 
                             $lang_code);
   }
   if (defined($region_code) 
        and ! $Texinfo::Documentlanguages::region_codes{$region_code}) {
-    push @messages, sprintf(&$gettext("%s is not a valid region code"), 
+    push @messages, sprintf(&$gettext(N__("%s is not a valid region code")), 
                             $region_code);
   }
   return @messages;
 }
 
+my %possible_split = (
+  'chapter' => 1,
+  'section' => 1,
+  'node' => 1,
+);
+
+sub warn_unknown_split($$) {
+  my $split = shift;
+  my $gettext = shift;
+
+  my @messages = ();
+  if ($split and !$possible_split{$split}) {
+    push @messages, sprintf(&$gettext(N__("%s is not a valid split 
possibility")),
+                            $split);
+  }
+  return @messages;
+}
+
 # This should do the job, or at least don't do wrong if $self
 # is not defined, as could be the case if called from 
 # Texinfo::Convert::Text.

Index: Texinfo/Structuring.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Structuring.pm,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -b -r1.93 -r1.94
--- Texinfo/Structuring.pm      2 Oct 2011 13:15:21 -0000       1.93
+++ Texinfo/Structuring.pm      2 Oct 2011 20:31:21 -0000       1.94
@@ -698,6 +698,8 @@
     $split_level = 1;
   } elsif ($split eq 'section') {
     $split_level = 2;
+  } elsif ($split ne 'node') {
+    warn "Unknown split specification: $split\n";
   }
 
   my @pages = ();
@@ -711,7 +713,7 @@
       $level = 
$element->{'extra'}->{'node'}->{'associated_section'}->{'level'};
     }
     #print STDERR "level($split_level) $level 
"._print_element_command_texi($element)."\n";
-    if ($split eq 'node' or (defined($level) and $split_level >= $level)
+    if (!defined($split_level) or (defined($level) and $split_level >= $level)
         or address@hidden) {
       push @pages, {'type' => 'page',
                     'extra' => {'element' => $element}};
@@ -1372,7 +1374,7 @@
   } else {
     $elements = split_by_section($tree);
   }
-  # $split may be 'section', 'chapter', a false value. Else means 'node'.
+  # $split may be 'section', 'chapter', 'node' or a false value.
   my $pages = split_pages($elements, $split);
   elements_directions($parser, $elements);
   elements_file_directions($parser, $elements);
@@ -1570,6 +1572,10 @@
 
 The elements are split at chapter or other toplevel sectioning elements.
 
+=item node
+
+Each element has its own page.
+
 =item section
 
 The elements are split at sectioning commands below chapter.
@@ -1578,10 +1584,6 @@
 
 No splitting, only one page is returned, holding all the elements.
 
-=item anything else
-
-Each element has its own page.
-
 =back
 
 Pages are regular tree items with type I<page>, holding their elements

Index: Texinfo/Convert/HTML.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/HTML.pm,v
retrieving revision 1.169
retrieving revision 1.170
diff -u -b -r1.169 -r1.170
--- Texinfo/Convert/HTML.pm     2 Oct 2011 19:11:58 -0000       1.169
+++ Texinfo/Convert/HTML.pm     2 Oct 2011 20:31:21 -0000       1.170
@@ -4221,6 +4221,11 @@
   $self->{'multiple_pass'} = [];
   $self->_new_document_context('_toplevel_context');
 
+  if ($self->get_conf('SPLIT') and $self->get_conf('SPLIT') ne 'chapter'
+      and $self->get_conf('SPLIT') ne 'section'
+      and $self->get_conf('SPLIT') ne 'node') {
+    $self->force_conf('SPLIT', 'node');
+  }
   #$self->_translate_names();
 
   return $self;



reply via email to

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