texi2html-cvs
[Top][All Lists]
Advanced

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

[Texi2html-cvs] Changes to texi2html/texi2html.pl


From: Patrice Dumas
Subject: [Texi2html-cvs] Changes to texi2html/texi2html.pl
Date: Mon, 14 Nov 2005 06:16:27 -0500

Index: texi2html/texi2html.pl
diff -u texi2html/texi2html.pl:1.150 texi2html/texi2html.pl:1.151
--- texi2html/texi2html.pl:1.150        Sun Aug 28 08:39:55 2005
+++ texi2html/texi2html.pl      Mon Nov 14 11:13:58 2005
@@ -62,7 +62,7 @@
 
#--##############################################################################
 
 # CVS version:
-# $Id: texi2html.pl,v 1.150 2005/08/28 08:39:55 pertusus Exp $
+# $Id: texi2html.pl,v 1.151 2005/11/14 11:13:58 pertusus Exp $
 
 # Homepage:
 my $T2H_HOMEPAGE = "http://www.nongnu.org/texi2html/";;
@@ -1160,12 +1160,6 @@
 # raw formats which are expanded especially
 my @raw_regions = ('html', 'verbatim', 'tex', 'xml', 'docbook');
 
-# special raw formats which are expanded between second and third pass
-# and are replaced by specific commands. It takes precedence over 
-# raw_regions.
-#FIXME it is not modifiable by the user!
-my @special_regions = ();
-
 # regions expanded or not depending on the value of this hash
 my %text_macros = (
      'iftex' => 0, 
@@ -2308,21 +2302,15 @@
 push (@Texi2HTML::Config::EXPAND, $Texi2HTML::Config::EXPAND) if 
($Texi2HTML::Config::EXPAND);
 
 unshift @texi2html_config_dirs, @Texi2HTML::Config::CONF_DIRS;
-# correct %text_macros and @special_regions based on command line and init
+# correct %text_macros based on command line and init
 # variables
 $text_macros{'menu'} = 1 if ($Texi2HTML::Config::SHOW_MENU);
 
-push @special_regions, 'tex' if ($Texi2HTML::Config::L2H);
-
 foreach my $expanded (@Texi2HTML::Config::EXPAND)
 {
     $text_macros{"if$expanded"} = 1 if (exists($text_macros{"if$expanded"}));
     next unless (exists($text_macros{$expanded}));
-    if (grep {$_ eq $expanded} @special_regions)
-    {
-         $text_macros{$expanded} = 'special'; 
-    }
-    elsif (grep {$_ eq $expanded} @raw_regions)
+    if (grep {$_ eq $expanded} @raw_regions)
     {
          $text_macros{$expanded} = 'raw'; 
     }
@@ -3750,7 +3738,7 @@
         }
         $line_nr = shift (@lines_numbers);
         #print STDERR "PASS_STRUCTURE: $_";
-        if (!$state->{'raw'} and !$state->{'special'} and !$state->{'verb'})
+        if (!$state->{'raw'} and !$state->{'verb'})
         {
             my $tag = '';
             if (/^\s*\@(\w+)\b/)
@@ -7326,7 +7314,7 @@
     my $value;
     #print STDERR "do_text_macro $type\n";
 
-    if ($text_macros{$type} eq 'raw' or $text_macros{$type} eq 'special')
+    if ($text_macros{$type} eq 'raw')
     {
         $state->{'raw'} = $type;
         #print STDERR "RAW\n";
@@ -9339,7 +9327,7 @@
     local $_ = $line;
     #print STDERR "SCAN_STRUCTURE: $line";
     #dump_stack ($text, $stack, $state); 
-    if (!$state->{'raw'} and !$state->{'special'} and 
(!exists($state->{'region_lines'})))
+    if (!$state->{'raw'} and (!exists($state->{'region_lines'})))
     { 
         if (!$state->{'verb'} and $state->{'menu'} and /^\*/o)
         {
@@ -9398,10 +9386,9 @@
         #
         # see more examples in formatting directory
 
-        if ($state->{'raw'} or $state->{'special'}) 
+        if ($state->{'raw'}) 
         {
             my $tag = $state->{'raw'};
-            $tag = $state->{'special'} unless $tag;
             ################# debug 
             if (! @$stack or ($stack->[-1]->{'style'} ne $tag))
             {
@@ -9414,10 +9401,10 @@
             if (s/^(.*?)address@hidden// or s/^(.*?)address@hidden//)
             {
                 add_prev ($text, $stack, $1);
+                delete $state->{'raw'};
                 my $style = pop @$stack;
-                if ($state->{'special'})
+                if (defined($Texi2HTML::Config::command_handler{$tag})) 
                 { # replace the special region by what init_special give
-                    delete $state->{'special'};
                     if ($style->{'text'} !~ /^\s*$/)
                     {
                         add_prev ($text, $stack, 
init_special($style->{'style'}, $style->{'text'}));
@@ -9428,8 +9415,7 @@
                 {
                     my $after_macro = '';
                     $after_macro = ' ' unless (/^\s*$/);
-                    add_prev ($text, $stack, $style->{'text'} . 
"address@hidden $state->{'raw'}" . $after_macro);
-                    delete $state->{'raw'};
+                    add_prev ($text, $stack, $style->{'text'} . 
"address@hidden $tag" . $after_macro);
                 }
                 unless (no_line($_))
                 {
@@ -9440,8 +9426,8 @@
             else
             {
                 add_prev ($text, $stack, $_);
-                last unless ($state->{'special'}); 
-                return;
+                return if 
(defined($Texi2HTML::Config::command_handler{$tag})); 
+                last;
             }
         }
        
@@ -9570,11 +9556,7 @@
             elsif (defined($text_macros{$macro}))
             {
                    #print STDERR "TEXT_MACRO: $macro\n";
-                if ($text_macros{$macro} eq 'special')
-                {
-                     $state->{'special'} = $macro;
-                }
-                elsif ($text_macros{$macro} eq 'raw')
+                if ($text_macros{$macro} eq 'raw')
                 {
                     $state->{'raw'} = $macro;
                     #print STDERR "RAW\n";
@@ -9607,13 +9589,13 @@
                 }
                 # if it is a raw formatting command or a menu command
                 # we must keep it for later
-                my $macro_kept;
-                if ($state->{'raw'} or ($macro eq 'menu'))
+                my $macro_kept; 
+                if (($state->{'raw'} and 
(!defined($Texi2HTML::Config::command_handler{$macro}))) or ($macro eq 'menu'))
                 {
                     add_prev($text, $stack, "address@hidden");
                     $macro_kept = 1;
                 }
-                if ($state->{'raw'} or $state->{'special'})
+                if ($state->{'raw'})
                 {
                     push @$stack, { 'style' => $macro, 'text' => '' };
                 }
@@ -11352,14 +11334,12 @@
         if (defined($Texi2HTML::Config::command_handler{$style}) and
           defined($Texi2HTML::Config::command_handler{$style}->{'expand'}))
         {
-             if ($count != $special_commands{$style}->{'count'})
-             {
-                  print STDERR "Bug? count in address@hidden and structure 
differ\n";
-             }
-             else
+             my $struct_count = 1+ $special_commands{$style}->{'max'} - 
$special_commands{$style}->{'count'};
+             if (($count != $struct_count) and $T2H_DEBUG)
              {
-                  $special_commands{$style}->{'count'}--;  
+                  print STDERR "count $count in address@hidden $style and 
structure $struct_count differ\n";
              }
+             $special_commands{$style}->{'count'}--;  
         }
         my $result = $Texi2HTML::Config::command_handler{$style}->{'expand'}
               ($style,$count,$state,$text);
@@ -12087,6 +12067,12 @@
     }
 }
 exit(0) if ($Texi2HTML::Config::DUMP_TEXI or 
defined($Texi2HTML::Config::MACRO_EXPAND));
+
+foreach my $style (keys(%special_commands))
+{
+  $special_commands{$style}->{'max'} = $special_commands{$style}->{'count'};
+}
+
 rearrange_elements();
 do_names();
 if (@{$region_lines{'documentdescription'}} and 
(!defined($Texi2HTML::Config::DOCUMENT_DESCRIPTION)))
@@ -12119,9 +12105,9 @@
 foreach my $special (keys(%special_commands))
 {
     my $count = $special_commands{$special}->{'count'};
-    if ($count != 0)
+    if (($count != 0) and $T2H_VERBOSE)
     {
-         echo_warn ("Still $count special address@hidden not processed\n");
+         echo_warn ("$count special address@hidden were not processed.\n");
     }
 }
 if ($Texi2HTML::Config::IDX_SUMMARY)




reply via email to

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