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: Sat, 08 Oct 2011 09:59:19 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        11/10/08 09:59:19

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

Log message:
        Set defaults for preformatted and string contexts for @-commands without
        arguments instead of considering that customizations are done for all 
        contexts.
        
        Use BEFORE_TOC_LINES and similar.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/texi2any.pl?cvsroot=texinfo&r1=1.66&r2=1.67
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Common.pm?cvsroot=texinfo&r1=1.72&r2=1.73
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/HTML.pm?cvsroot=texinfo&r1=1.174&r2=1.175

Patches:
Index: texi2any.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/texi2any.pl,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -b -r1.66 -r1.67
--- texi2any.pl 2 Oct 2011 20:31:19 -0000       1.66
+++ texi2any.pl 8 Oct 2011 09:59:18 -0000       1.67
@@ -119,7 +119,6 @@
   return Locale::Messages::dpgettext($messages_textdomain, $context, $msgid);
 }
 
-# FIXME use something else than srcdir?
 my $srcdir = defined $ENV{'srcdir'} ? $ENV{'srcdir'} : dirname $0;
 # FIXME
 my $libsrcdir = "$srcdir/../texi2html";

Index: Texinfo/Common.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Common.pm,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -b -r1.72 -r1.73
--- Texinfo/Common.pm   2 Oct 2011 20:31:20 -0000       1.72
+++ Texinfo/Common.pm   8 Oct 2011 09:59:19 -0000       1.73
@@ -148,7 +148,8 @@
   'ACTIVE_ICONS', 'PASSIVE_ICONS',
   'DEFAULT_RULE', 'BIG_RULE',
   'MENU_ENTRY_COLON', 'INDEX_ENTRY_COLON', 'MENU_SYMBOL', 'DO_ABOUT',
-  'CSS_FILES', 'CSS_REFS');
+  'CSS_FILES', 'CSS_REFS', 'BEFORE_OVERVIEW', 'AFTER_OVERVIEW',
+  'BEFORE_TOC_LINES', 'AFTER_TOC_LINES');
 
 my %valid_options;
 foreach my $var (@document_settable_at_commands, @document_global_at_commands,

Index: Texinfo/Convert/HTML.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/HTML.pm,v
retrieving revision 1.174
retrieving revision 1.175
diff -u -b -r1.174 -r1.175
--- Texinfo/Convert/HTML.pm     6 Oct 2011 22:52:00 -0000       1.174
+++ Texinfo/Convert/HTML.pm     8 Oct 2011 09:59:19 -0000       1.175
@@ -1091,18 +1091,18 @@
 $default_commands_formatting{'normal'}->{"\t"} = '&nbsp;';
 $default_commands_formatting{'normal'}->{"\n"} = '&nbsp;';
 
-foreach my $command (keys(%{$default_commands_formatting{'normal'}})) {
-  $default_commands_formatting{'preformatted'}->{$command} = 
-     $default_commands_formatting{'normal'}->{$command};
-#       unless 
exists($default_commands_formatting{'preformatted'}->{$command});
-  $default_commands_formatting{'string'}->{$command} =
-     $default_commands_formatting{'normal'}->{$command};
-#       unless exists($default_commands_formatting{'string'}->{$command});
-}
+#foreach my $command (keys(%{$default_commands_formatting{'normal'}})) {
+#  $default_commands_formatting{'preformatted'}->{$command} = 
+#     $default_commands_formatting{'normal'}->{$command};
+#  $default_commands_formatting{'string'}->{$command} =
+#     $default_commands_formatting{'normal'}->{$command};
+#}
 
 $default_commands_formatting{'normal'}->{'enddots'} 
     = '<small class="enddots">...</small>';
+$default_commands_formatting{'preformatted'}->{'enddots'} = '...';
 $default_commands_formatting{'normal'}->{'*'} = '<br>';
+$default_commands_formatting{'preformatted'}->{'*'} = "\n";
 
 
 sub _convert_no_arg_command($$$)
@@ -4122,8 +4122,40 @@
                                                   $self->{'htmlxref_files'});
   }
 
-  foreach my $context (keys(%default_commands_formatting)) {
-    foreach my $command (keys(%{$default_commands_formatting{$context}})) {
+  foreach my $type (keys(%default_types_conversion)) {
+    if (exists($Texinfo::Config::types_conversion{$type})) {
+      $self->{'types_conversion'}->{$type}
+          = $Texinfo::Config::types_conversion{$type};
+    } else {
+      $self->{'types_conversion'}->{$type} 
+          = $default_types_conversion{$type};
+    }
+  }
+
+  # FIXME put value in a category in Texinfo::Common?
+  foreach my $command (keys(%misc_commands), keys(%brace_commands),
+     keys (%block_commands), keys(%no_brace_commands), 'value') {
+    if (exists($Texinfo::Config::commands_conversion{$command})) {
+      $self->{'commands_conversion'}->{$command} 
+          = $Texinfo::Config::commands_conversion{$command};
+    } else {
+      if (!$self->get_conf('SHOW_MENU') 
+           and ($command eq 'menu' or $command eq 'detailmenu')) {
+        $self->{'commands_conversion'}->{$command} = undef;
+      } elsif (exists($default_commands_conversion{$command})) {
+        $self->{'commands_conversion'}->{$command}
+           = $default_commands_conversion{$command};
+        if ($command eq 'menu' and $self->get_conf('SIMPLE_MENU')) {
+          $self->{'commands_conversion'}->{$command} 
+            = $default_commands_conversion{'example'};
+        }
+      }
+    }
+  }
+
+  #foreach my $context (keys(%default_commands_formatting)) {
+  foreach my $context ('normal', 'preformatted', 'string') {
+    foreach my $command (keys(%{$default_commands_formatting{'normal'}})) {
       if (exists 
($Texinfo::Config::commands_formatting{$context}->{$command})) {
         $self->{'commands_formatting'}->{$context}->{$command} 
            = $Texinfo::Config::commands_formatting{$context}->{$command};
@@ -4143,6 +4175,25 @@
     }
   }
 
+  # set sane defaults in case there is none and the default formatting
+  # function is used
+  foreach my $command (keys(%{$default_commands_formatting{'normal'}})) {
+    if ($self->{'commands_conversion'}->{$command} 
+        and $self->{'commands_conversion'}->{$command} eq 
$default_commands_conversion{$command}) {
+      if (!defined ($self->{'commands_formatting'}->{'normal'}->{$command})) {
+        $self->{'commands_formatting'}->{'normal'}->{$command} = '';
+      }
+      if (!defined 
($self->{'commands_formatting'}->{'preformatted'}->{$command})) {
+        $self->{'commands_formatting'}->{'preformatted'}->{$command} = 
+          $self->{'commands_formatting'}->{'normal'}->{$command};
+      }
+      if (!defined ($self->{'commands_formatting'}->{'string'}->{$command})) {
+       $self->{'commands_formatting'}->{'string'}->{$command} = 
+          $self->{'commands_formatting'}->{'preformatted'}->{$command};
+      }
+    } 
+  }
+
   foreach my $context (keys(%style_commands_formatting)) {
     foreach my $command (keys(%{$style_commands_formatting{$context}})) {
       if (exists 
($Texinfo::Config::style_commands_formatting{$context}->{$command})) {
@@ -4155,36 +4206,6 @@
     }
   }
 
-  # FIXME put value in a category in Texinfo::Common?
-  foreach my $command (keys(%misc_commands), keys(%brace_commands),
-     keys (%block_commands), keys(%no_brace_commands), 'value') {
-    if (exists($Texinfo::Config::commands_conversion{$command})) {
-      $self->{'commands_conversion'}->{$command} 
-          = $Texinfo::Config::commands_conversion{$command};
-    } else {
-      if (!$self->get_conf('SHOW_MENU') 
-           and ($command eq 'menu' or $command eq 'detailmenu')) {
-        $self->{'commands_conversion'}->{$command} = undef;
-      } elsif (exists($default_commands_conversion{$command})) {
-        $self->{'commands_conversion'}->{$command}
-           = $default_commands_conversion{$command};
-        if ($command eq 'menu' and $self->get_conf('SIMPLE_MENU')) {
-          $self->{'commands_conversion'}->{$command} 
-            = $default_commands_conversion{'example'};
-        }
-      }
-    }
-  }
-
-  foreach my $type (keys(%default_types_conversion)) {
-    if (exists($Texinfo::Config::types_conversion{$type})) {
-      $self->{'types_conversion'}->{$type}
-          = $Texinfo::Config::types_conversion{$type};
-    } else {
-      $self->{'types_conversion'}->{$type} 
-          = $default_types_conversion{$type};
-    }
-  }
   foreach my $command (keys %{$self->{'commands_conversion'}}) {
     if (exists($Texinfo::Config::commands_args{$command})) {
       $self->{'commands_args'}->{$command} 
@@ -5450,7 +5471,14 @@
   $ul_class = $NO_BULLET_LIST_CLASS if ($self->get_conf('NUMBER_SECTIONS'));
 
   my $result = '';
+  if ($contents and !defined($self->get_conf('BEFORE_TOC_LINES'))
+      or (!$contents and !defined($self->get_conf('BEFORE_OVERVIEW')))) {
   $result .= $self->_attribute_class('div', $cmdname).">\n";
+  } elsif($contents) {
+    $result .= $self->get_conf('BEFORE_TOC_LINES');
+  } else {
+    $result .= $self->get_conf('BEFORE_OVERVIEW');
+  }
 
   my $toplevel_contents;
   if (@{$section_root->{'section_childs'}} > 1) { 
@@ -5533,7 +5561,14 @@
    #   or $section_root->{'section_childs'}->[0]->{'cmdname'} ne 'top') {
     $result .= "\n</ul>";
   }
+  if ($contents and !defined($self->get_conf('AFTER_TOC_LINES'))
+      or (!$contents and !defined($self->get_conf('AFTER_OVERVIEW')))) {
   $result .= "\n</div>\n";
+  } elsif($contents) {
+    $result .= $self->get_conf('AFTER_TOC_LINES');
+  } else {
+    $result .= $self->get_conf('AFTER_OVERVIEW');
+  }
   return $result;
 }
 



reply via email to

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