/[texi2html]/texi2html/texi2html.pl
ViewVC logotype

Diff of /texi2html/texi2html.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.147 by pertusus, Tue Aug 23 06:58:03 2005 UTC revision 1.148 by pertusus, Tue Aug 23 23:51:08 2005 UTC
# Line 277  $NEW_CROSSREF_STYLE Line 277  $NEW_CROSSREF_STYLE
277  %ACTIVE_ICONS  %ACTIVE_ICONS
278  %NAVIGATION_TEXT  %NAVIGATION_TEXT
279  %PASSIVE_ICONS  %PASSIVE_ICONS
280    %BUTTONS_NAME
281  %BUTTONS_GOTO  %BUTTONS_GOTO
282  %BUTTONS_EXAMPLE  %BUTTONS_EXAMPLE
283  @CHAPTER_BUTTONS  @CHAPTER_BUTTONS
# Line 418  $complex_format_map Line 419  $complex_format_map
419  %style_map  %style_map
420  %style_map_pre  %style_map_pre
421  %style_map_texi  %style_map_texi
422  %unformatted_text_simple_map_texi  %simple_format_simple_map_texi
423  %unformatted_text_style_map_texi  %simple_format_style_map_texi
424  %unformatted_text_texi_map  %simple_format_texi_map
425  %paragraph_style  %paragraph_style
426  %things_map  %things_map
427  %pre_map  %pre_map
# Line 644  require "$ENV{T2H_HOME}/$translation_fil Line 645  require "$ENV{T2H_HOME}/$translation_fil
645  # @T2H_TRANSLATIONS_FILE@  # @T2H_TRANSLATIONS_FILE@
646  my $index_name = -1;  my $index_name = -1;
647  my @index_to_hash = ('style_map', 'style_map_pre', 'style_map_texi');  my @index_to_hash = ('style_map', 'style_map_pre', 'style_map_texi');
648  foreach my $hash (\%style_map, \%style_map_pre, \%style_map_texi, \%unformatted_text_style_map_texi)  foreach my $hash (\%style_map, \%style_map_pre, \%style_map_texi, \%simple_format_style_map_texi)
649  {  {
650      $index_name++;      $index_name++;
651      my $name = $index_to_hash[$index_name];      my $name = $index_to_hash[$index_name];
# Line 657  foreach my $hash (\%style_map, \%style_m Line 658  foreach my $hash (\%style_map, \%style_m
658      }      }
659  }  }
660    
661  sub t2h_utf8_accent($$)  sub t2h_utf8_accent($$$)
662  {  {
663      my $accent = shift;      my $accent = shift;
664      my $args = shift;      my $args = shift;
665      my $style_stack = shift;      my $style_stack = shift;
666        
667      my $text = $args->[0];      my $text = $args->[0];
668        #print STDERR "$accent\[".scalar(@$style_stack) ."\] (@$style_stack)\n";
669      if ($accent eq 'dotless')      if ($accent eq 'dotless')
670      { # \x{0131}\x{0308} for @dotless{i} @" doesn't lead to NFC 00ef.      { # \x{0131}\x{0308} for @dotless{i} @" doesn't lead to NFC 00ef.
671          if (($text eq 'i') and (!defined($style_stack->[-2]) or (!defined($unicode_accents{$style_stack->[-2]})) or ($style_stack->[-2] eq 'tieaccent')))          if (($text eq 'i') and (!defined($style_stack->[-1]) or (!defined($unicode_accents{$style_stack->[-1]})) or ($style_stack->[-1] eq 'tieaccent')))
672          {          {
673               return "\x{0131}";               return "\x{0131}";
674          }          }
# Line 680  sub t2h_utf8_accent($$) Line 681  sub t2h_utf8_accent($$)
681      return ascii_accents($text, $accent);      return ascii_accents($text, $accent);
682  }  }
683    
684  sub t2h_utf8_normal_text($)  sub t2h_utf8_normal_text($$$$$)
685  {  {
686      my $text = shift;      my $text = shift;
687      $text =~ s/---/\x{2014}/g;      my $in_raw_text = shift;
688      $text =~ s/--/\x{2013}/g;      my $in_preformatted = shift;
689      $text =~ s/``/\x{201C}/g;      my $in_code =shift;
690      $text =~ s/''/\x{201D}/g;      my $style_stack = shift;
691        $text = &$protect_text($text) unless($in_raw_text);
692        $text = uc($text) if (in_small_caps($style_stack));
693    
694        if (!$in_code and !$in_preformatted)
695        {
696            $text =~ s/---/\x{2014}/g;
697            $text =~ s/--/\x{2013}/g;
698            $text =~ s/``/\x{201C}/g;
699            $text =~ s/''/\x{201D}/g;
700        }
701      return $text;      return $text;
702  }  }
703    
704  sub t2h_cross_manual_normal_text($)  sub t2h_cross_manual_normal_text($$$$$)
705  {  {
706     my $text = shift;     my $text = shift;
707       my $in_raw_text = shift;
708       my $in_preformatted = shift;
709       my $in_code =shift;
710       my $style_stack = shift;
711    
712       $text = uc($text) if (in_small_caps($style_stack));
713     $text = main::normalise_space($text);     $text = main::normalise_space($text);
714     my $result = '';     my $result = '';
715     while ($text ne '')     while ($text ne '')
# Line 922  my $things_map_ref = \%Texi2HTML::Config Line 939  my $things_map_ref = \%Texi2HTML::Config
939  my $pre_map_ref = \%Texi2HTML::Config::pre_map;  my $pre_map_ref = \%Texi2HTML::Config::pre_map;
940  my $texi_map_ref = \%Texi2HTML::Config::texi_map;  my $texi_map_ref = \%Texi2HTML::Config::texi_map;
941    
942  # delete from hash if we are using te new interface  # delete from hash if we are using the new interface
943  foreach my $code (keys(%code_style_map))  foreach my $code (keys(%code_style_map))
944  {  {
945      delete ($code_style_map{$code})      delete ($code_style_map{$code})
# Line 1224  my $documentdescription; # text in @docu Line 1241  my $documentdescription; # text in @docu
1241    
1242  # shorthand for Texi2HTML::Config::VERBOSE  # shorthand for Texi2HTML::Config::VERBOSE
1243  my $T2H_VERBOSE;  my $T2H_VERBOSE;
1244    my $T2H_DEBUG;
1245    
1246  sub echo_warn($;$);  sub echo_warn($;$);
1247  #print STDERR "" . &$I('test i18n: \' , \a \\ %% %{unknown}a %known % %{known}  \\', { 'known' => 'a known string', 'no' => 'nope'}); exit 0;  #print STDERR "" . &$I('test i18n: \' , \a \\ %% %{unknown}a %known % %{known}  \\', { 'known' => 'a known string', 'no' => 'nope'}); exit 0;
# Line 1310  sub set_document_language ($;$$) Line 1328  sub set_document_language ($;$$)
1328          $cmd_line_lang = 1 if ($from_command_line);          $cmd_line_lang = 1 if ($from_command_line);
1329          if (!$Texi2HTML::Config::TEST)          if (!$Texi2HTML::Config::TEST)
1330          {          {
1331                print STDERR "# Setting date in $Texi2HTML::Config::LANG\n" if ($T2H_DEBUG);
1332              $Texi2HTML::THISDOC{'today'} = Texi2HTML::I18n::pretty_date($Texi2HTML::Config::LANG);  # like "20 September 1993";              $Texi2HTML::THISDOC{'today'} = Texi2HTML::I18n::pretty_date($Texi2HTML::Config::LANG);  # like "20 September 1993";
1333          }          }
1334          else          else
# Line 1387  sub cross_manual_links($$) Line 1406  sub cross_manual_links($$)
1406      my $nodes_hash = shift;      my $nodes_hash = shift;
1407      my $cross_reference_hash = shift;      my $cross_reference_hash = shift;
1408    
1409        print STDERR "# Doing ".scalar(keys(%$nodes_hash)) .
1410            " cross manual links\n" if ($T2H_DEBUG);
1411      $simple_map_texi_ref = \%cross_ref_simple_map_texi;      $simple_map_texi_ref = \%cross_ref_simple_map_texi;
1412      $style_map_texi_ref = \%cross_ref_style_map_texi;      $style_map_texi_ref = \%cross_ref_style_map_texi;
1413      $texi_map_ref = \%cross_ref_texi_map;      $texi_map_ref = \%cross_ref_texi_map;
# Line 2273  if (@ARGV > 1) Line 2294  if (@ARGV > 1)
2294      }      }
2295  }  }
2296  # $T2H_DEBUG and $T2H_VERBOSE are shorthands  # $T2H_DEBUG and $T2H_VERBOSE are shorthands
2297  my $T2H_DEBUG = $Texi2HTML::Config::DEBUG;  $T2H_DEBUG = $Texi2HTML::Config::DEBUG;
2298  $T2H_VERBOSE = $Texi2HTML::Config::VERBOSE;  $T2H_VERBOSE = $Texi2HTML::Config::VERBOSE;
2299    
2300  #+++############################################################################  #+++############################################################################
# Line 5712  sub get_node($) Line 5733  sub get_node($)
5733  # get the html names from the texi for all elements  # get the html names from the texi for all elements
5734  sub do_names()  sub do_names()
5735  {  {
5736        print STDERR "# Doing ". scalar(keys(%nodes)) . " nodes, ".
5737            scalar(keys(%sections)) . " sections in ". $#elements_list .
5738            " elements\n" if ($T2H_DEBUG);
5739      # for nodes and anchors we haven't any state defined      # for nodes and anchors we haven't any state defined
5740      # This seems right, however, as we don't want @refs or @footnotes      # This seems right, however, as we don't want @refs or @footnotes
5741      # or @anchors within nodes, section commands or anchors.      # or @anchors within nodes, section commands or anchors.
# Line 5720  sub do_names() Line 5744  sub do_names()
5744          next if ($nodes{$node}->{'index_page'}); # some nodes are index pages.          next if ($nodes{$node}->{'index_page'}); # some nodes are index pages.
5745          $nodes{$node}->{'text'} = substitute_line ($nodes{$node}->{'texi'});          $nodes{$node}->{'text'} = substitute_line ($nodes{$node}->{'texi'});
5746          $nodes{$node}->{'name'} = $nodes{$node}->{'text'};          $nodes{$node}->{'name'} = $nodes{$node}->{'text'};
5747          $nodes{$node}->{'no_texi'} = &$Texi2HTML::Config::protect_text(remove_texi($nodes{$node}->{'texi'}));          $nodes{$node}->{'no_texi'} = remove_texi($nodes{$node}->{'texi'});
5748          # FIXME UNFORMATTED: could be a line          $nodes{$node}->{'simple_format'} = simple_format(undef, $nodes{$node}->{'texi'});
         $nodes{$node}->{'unformatted'} = unformatted_text(undef, $nodes{$node}->{'texi'});  
5749          # FIXME : what to do if $nodes{$node}->{'external_node'} and          # FIXME : what to do if $nodes{$node}->{'external_node'} and
5750          # $nodes{$node}->{'seen'}          # $nodes{$node}->{'seen'}
5751      }      }
# Line 5730  sub do_names() Line 5753  sub do_names()
5753      {      {
5754          my $section = $sections{$number};          my $section = $sections{$number};
5755          $section->{'name'} = substitute_line($section->{'texi'});          $section->{'name'} = substitute_line($section->{'texi'});
5756          $section->{'text'} = $section->{'number'} . " " . $section->{'name'};          # FIXME the user should be able to give a raw texinfo himself
5757            $section->{'text'} = &$Texi2HTML::Config::protect_text($section->{'number'}) . " " . $section->{'name'};
5758          $section->{'text'} =~ s/^\s*//;          $section->{'text'} =~ s/^\s*//;
5759          $section->{'no_texi'} = &$Texi2HTML::Config::protect_text($section->{'number'} . " " .remove_texi($section->{'texi'}));          $section->{'no_texi'} = $section->{'number'} . " " .remove_texi($section->{'texi'});
5760          $section->{'no_texi'} =~ s/^\s*//;          $section->{'no_texi'} =~ s/^\s*//;
5761          # FIXME UNFORMATTED: could be a line          $section->{'simple_format'} = &$Texi2HTML::Config::protect_text($section->{'number'}) . " " .simple_format(undef,$section->{'texi'});
5762          $section->{'unformatted'} = &$Texi2HTML::Config::protect_text($section->{'number'}) . " " .unformatted_text(undef,$section->{'texi'});          $section->{'simple_format'} =~ s/^\s*//;
         $section->{'unformatted'} =~ s/^\s*//;  
5763      }      }
5764      my $tocnr = 1;      my $tocnr = 1;
5765      foreach my $element (@elements_list)      foreach my $element (@elements_list)
# Line 5750  sub do_names() Line 5773  sub do_names()
5773          if ($element->{'index_page'})          if ($element->{'index_page'})
5774          {          {
5775              my $page = $element->{'page'};              my $page = $element->{'page'};
5776              my $sec_name = $element->{'element_ref'}->{'text'};              # FIXME the user should be able to give a raw texinfo himself
5777              $element->{'text'} = ($page->{First} ne $page->{Last} ?              my $letter_raw =  ($page->{'first_letter'} ne $page->{'last_letter'} ?
5778                  "$sec_name: $page->{First} -- $page->{Last}" :                  "$page->{'first_letter'} -- $page->{'last_letter'}" :
5779                  "$sec_name: $page->{First}");                  "$page->{'first_letter'}");
5780              $sec_name = $element->{'element_ref'}->{'no_texi'};              $element->{'text'} = "$element->{'element_ref'}->{'text'}: "
5781              $element->{'no_texi'} = &$Texi2HTML::Config::protect_text($page->{First} ne $page->{Last} ?                  . &$Texi2HTML::Config::protect_text($letter_raw);
5782                  "$sec_name: $page->{First} -- $page->{Last}" :              $element->{'no_texi'} =
5783                  "$sec_name: $page->{First}");                  "$element->{'element_ref'}->{'no_texi'}: $letter_raw";
5784              $sec_name = $element->{'element_ref'}->{'unformatted'};              $element->{'simple_format'} = "$element->{'element_ref'}->{'simple_format'}: "
5785              $element->{'unformatted'} = $page->{First} ne $page->{Last} ?                  . &$Texi2HTML::Config::protect_text($letter_raw);
                 "$sec_name: " . &$Texi2HTML::Config::protect_text("$page->{First} -- $page->{Last}") :  
                 "$sec_name: " . &$Texi2HTML::Config::protect_text("$page->{First}");  
5786          }          }
5787      }      }
5788  }  }
# Line 5897  sub by_alpha Line 5918  sub by_alpha
5918    
5919  # returns an array of index entries pages splitted by letters  # returns an array of index entries pages splitted by letters
5920  # each page has the following members:  # each page has the following members:
5921  # {First}            first letter on that page  # {'first_letter'}            first letter on that page
5922  # {Last}             last letter on that page  # {'last_letter'}             last letter on that page
5923  # {Letters}          ref on an array with all the letters for that page  # {Letters}          ref on an array with all the letters for that page
5924  # {EntriesByLetter}  ref on a hash. Each key is a letter, with value  # {EntriesByLetter}  ref on a hash. Each key is a letter, with value
5925  #                    a ref on arrays of index entries begining with this letter  #                    a ref on arrays of index entries begining with this letter
# Line 5926  sub get_index_pages($) Line 5947  sub get_index_pages($)
5947          {          {
5948              if ($i > $Texi2HTML::Config::SPLIT_INDEX)              if ($i > $Texi2HTML::Config::SPLIT_INDEX)
5949              {              {
5950                  $page->{Last} = $prev_letter;                  $page->{'last_letter'} = $prev_letter;
5951                  push @$Pages, $page;                  push @$Pages, $page;
5952                  $i=0;                  $i=0;
5953              }              }
# Line 5935  sub get_index_pages($) Line 5956  sub get_index_pages($)
5956                  $page = {};                  $page = {};
5957                  $page->{Letters} = [];                  $page->{Letters} = [];
5958                  $page->{EntriesByLetter} = {};                  $page->{EntriesByLetter} = {};
5959                  $page->{First} = $letter;                  $page->{'first_letter'} = $letter;
5960              }              }
5961              push @{$page->{Letters}}, $letter;              push @{$page->{Letters}}, $letter;
5962              $page->{EntriesByLetter}->{$letter} = [@{$EntriesByLetter->{$letter}}];              $page->{EntriesByLetter}->{$letter} = [@{$EntriesByLetter->{$letter}}];
5963              $i += scalar(@{$EntriesByLetter->{$letter}});              $i += scalar(@{$EntriesByLetter->{$letter}});
5964              $prev_letter = $letter;              $prev_letter = $letter;
5965          }          }
5966          $page->{Last} = $Letters[$#Letters];          $page->{'last_letter'} = $Letters[$#Letters];
5967          push @$Pages, $page;          push @$Pages, $page;
5968      }      }
5969      else      else
5970      {      {
5971          warn "$WARN Bad Texi2HTML::Config::SPLIT_INDEX: $Texi2HTML::Config::SPLIT_INDEX\n" if ($Texi2HTML::Config::SPLIT_INDEX);          warn "$WARN Bad Texi2HTML::Config::SPLIT_INDEX: $Texi2HTML::Config::SPLIT_INDEX\n" if ($Texi2HTML::Config::SPLIT_INDEX);
5972          $page->{First} = $Letters[0];          $page->{'first_letter'} = $Letters[0];
5973          $page->{Last} = $Letters[$#Letters];          $page->{'last_letter'} = $Letters[$#Letters];
5974          $page->{Letters} = \@Letters;          $page->{Letters} = \@Letters;
5975          $page->{EntriesByLetter} = $EntriesByLetter;          $page->{EntriesByLetter} = $EntriesByLetter;
5976          push @$Pages, $page;          push @$Pages, $page;
# Line 6075  sub pass_text() Line 6096  sub pass_text()
6096          my $thing_texi = $Texi2HTML::THISDOC{$doc_thing . '_texi'};          my $thing_texi = $Texi2HTML::THISDOC{$doc_thing . '_texi'};
6097          $Texi2HTML::THISDOC{$doc_thing} = substitute_line($thing_texi);          $Texi2HTML::THISDOC{$doc_thing} = substitute_line($thing_texi);
6098          $Texi2HTML::THISDOC{$doc_thing . '_no_texi'} =          $Texi2HTML::THISDOC{$doc_thing . '_no_texi'} =
6099             &$Texi2HTML::Config::protect_text(remove_texi($thing_texi));             remove_texi($thing_texi);
6100          # FIXME: UNFORMATTED: could it be a line          $Texi2HTML::THISDOC{$doc_thing . '_simple_format'} =
6101          $Texi2HTML::THISDOC{$doc_thing . '_unformatted'} =             simple_format(undef, $thing_texi);
            unformatted_text(undef, $thing_texi);  
6102      }      }
6103    
6104      # find Top name      # find Top name
6105      my $element_top_text = '';      my $element_top_text = '';
6106      my $top_no_texi = '';      my $top_no_texi = '';
6107      my $top_unformatted = '';      my $top_simple_format = '';
6108      my $top_name;      my $top_name;
6109      if ($element_top and $element_top->{'text'} and (!$node_top or ($element_top ne $node_top)))      if ($element_top and $element_top->{'text'} and (!$node_top or ($element_top ne $node_top)))
6110      {      {
6111          $element_top_text = $element_top->{'text'};          $element_top_text = $element_top->{'text'};
6112          $top_no_texi = $element_top->{'no_texi'};          $top_no_texi = $element_top->{'no_texi'};
6113          $top_unformatted =  $element_top->{'unformatted'};          $top_simple_format =  $element_top->{'simple_format'};
6114      }      }
6115      foreach my $possible_top_name ($Texi2HTML::Config::TOP_HEADING,      foreach my $possible_top_name ($Texi2HTML::Config::TOP_HEADING,
6116           $element_top_text, $Texi2HTML::THISDOC{'title'},           $element_top_text, $Texi2HTML::THISDOC{'title'},
# Line 6105  sub pass_text() Line 6125  sub pass_text()
6125      foreach my $possible_top_no_texi ($Texi2HTML::Config::TOP_HEADING,      foreach my $possible_top_no_texi ($Texi2HTML::Config::TOP_HEADING,
6126           $top_no_texi, $Texi2HTML::THISDOC{'title_no_texi'},           $top_no_texi, $Texi2HTML::THISDOC{'title_no_texi'},
6127           $Texi2HTML::THISDOC{'shorttitle_no_texi'},           $Texi2HTML::THISDOC{'shorttitle_no_texi'},
6128           &$I('Top',{},{'remove_texi' => 1, 'no_protection' => 1}))           &$I('Top',{},{'remove_texi' => 1}))
6129      {      {
6130           if (defined($possible_top_no_texi) and $possible_top_no_texi ne '')           if (defined($possible_top_no_texi) and $possible_top_no_texi ne '')
6131           {           {
# Line 6114  sub pass_text() Line 6134  sub pass_text()
6134           }           }
6135      }      }
6136            
6137      foreach my $possible_top_unformatted ($top_unformatted,      foreach my $possible_top_simple_format ($top_simple_format,
6138           $Texi2HTML::THISDOC{'title_unformatted'},           $Texi2HTML::THISDOC{'title_simple_format'},
6139           $Texi2HTML::THISDOC{'shorttitle_unformatted'},           $Texi2HTML::THISDOC{'shorttitle_simple_format'},
6140           # FIXME UNFORMATTED           &$I('Top',{}, {'simple_format' => 1}))
          &$I('Top',{}, {'unformatted' => 1}))  
6141      {      {
6142           if (defined($possible_top_unformatted) and $possible_top_unformatted ne '')           if (defined($possible_top_simple_format) and $possible_top_simple_format ne '')
6143           {           {
6144               $top_unformatted = $possible_top_unformatted;               $top_simple_format = $possible_top_simple_format;
6145               last;               last;
6146           }           }
6147      }      }
# Line 6144  sub pass_text() Line 6163  sub pass_text()
6163          my $thing_texi = $Texi2HTML::THISDOC{$doc_thing . '_texi'};          my $thing_texi = $Texi2HTML::THISDOC{$doc_thing . '_texi'};
6164          $Texi2HTML::THISDOC{$doc_thing} = substitute_line($thing_texi);          $Texi2HTML::THISDOC{$doc_thing} = substitute_line($thing_texi);
6165          $Texi2HTML::THISDOC{$doc_thing . '_no_texi'} =          $Texi2HTML::THISDOC{$doc_thing . '_no_texi'} =
6166             &$Texi2HTML::Config::protect_text(remove_texi($thing_texi));             remove_texi($thing_texi);
6167          # FIXME: UNFORMATTED: could it be a line          $Texi2HTML::THISDOC{$doc_thing . '_simple_format'} =
6168          $Texi2HTML::THISDOC{$doc_thing . '_unformatted'} =             simple_format(undef, $thing_texi);
            unformatted_text(undef, $thing_texi);  
6169      }      }
6170    
6171      for my $key (keys %Texi2HTML::THISDOC)      for my $key (keys %Texi2HTML::THISDOC)
# Line 6212  print STDERR "!!$key\n" if (!defined($Te Line 6230  print STDERR "!!$key\n" if (!defined($Te
6230          (          (
6231           'First',   $element_first->{'no_texi'},           'First',   $element_first->{'no_texi'},
6232           'Last',    $element_last->{'no_texi'},           'Last',    $element_last->{'no_texi'},
6233           'About',    &$I('About This Document', {}, {'remove_texi' => 1, 'no_protection' => 1} ),           'About',    &$I('About This Document', {}, {'remove_texi' => 1} ),
6234           'Contents', &$I('Table of Contents', {}, {'remove_texi' => 1, 'no_protection' => 1} ),           'Contents', &$I('Table of Contents', {}, {'remove_texi' => 1} ),
6235           'Overview', &$I('Short Table of Contents', {}, {'remove_texi' => 1, 'no_protection' => 1} ),           'Overview', &$I('Short Table of Contents', {}, {'remove_texi' => 1} ),
6236           'Top',      $top_no_texi,           'Top',      $top_no_texi,
6237           'Footnotes', &$I('Footnotes', {}, {'remove_texi' => 1, 'no_protection' => 1} ),           'Footnotes', &$I('Footnotes', {}, {'remove_texi' => 1} ),
6238          );          );
6239      $Texi2HTML::NO_TEXI{'Index'} = $element_chapter_index->{'no_texi'} if (defined($element_chapter_index));      $Texi2HTML::NO_TEXI{'Index'} = $element_chapter_index->{'no_texi'} if (defined($element_chapter_index));
6240       # FIXME UNFORMATTED      %Texi2HTML::SIMPLE_TEXT =
     %Texi2HTML::UNFORMATTED =  
6241          (          (
6242           'First',   $element_first->{'unformatted'},           'First',   $element_first->{'simple_format'},
6243           'Last',    $element_last->{'unformatted'},           'Last',    $element_last->{'simple_format'},
6244           'About',    &$I('About This Document', {}, {'unformatted' => 1}),           'About',    &$I('About This Document', {}, {'simple_format' => 1}),
6245           'Contents', &$I('Table of Contents',{},  {'unformatted' => 1}),           'Contents', &$I('Table of Contents',{},  {'simple_format' => 1}),
6246           'Overview', &$I('Short Table of Contents', {}, {'unformatted' => 1}),           'Overview', &$I('Short Table of Contents', {}, {'simple_format' => 1}),
6247           'Top',      $top_unformatted,           'Top',      $top_simple_format,
6248           'Footnotes', &$I('Footnotes', {},{'unformatted' => 1}),           'Footnotes', &$I('Footnotes', {},{'simple_format' => 1}),
6249          );          );
6250      $Texi2HTML::UNFORMATTED{'Index'} = $element_chapter_index->{'unformatted'} if (defined($element_chapter_index));      $Texi2HTML::SIMPLE_TEXT{'Index'} = $element_chapter_index->{'simple_format'} if (defined($element_chapter_index));
6251      $Texi2HTML::TITLEPAGE = '';      $Texi2HTML::TITLEPAGE = '';
6252      $Texi2HTML::TITLEPAGE = substitute_text({}, @{$region_lines{'titlepage'}})      $Texi2HTML::TITLEPAGE = substitute_text({}, @{$region_lines{'titlepage'}})
6253          if (@{$region_lines{'titlepage'}});          if (@{$region_lines{'titlepage'}});
# Line 6445  print STDERR "!!$key\n" if (!defined($Te Line 6462  print STDERR "!!$key\n" if (!defined($Te
6462                          }                          }
6463                          $Texi2HTML::NAME{$direction} = $elem->{'text'};                          $Texi2HTML::NAME{$direction} = $elem->{'text'};
6464                          $Texi2HTML::NO_TEXI{$direction} = $elem->{'no_texi'};                          $Texi2HTML::NO_TEXI{$direction} = $elem->{'no_texi'};
6465                          $Texi2HTML::UNFORMATTED{$direction} = $elem->{'unformatted'};                          $Texi2HTML::SIMPLE_TEXT{$direction} = $elem->{'simple_format'};
6466                          #print STDERR "$direction ($element->{'texi'}): \n  NO_TEXI: $Texi2HTML::NO_TEXI{$direction}\n  NAME $Texi2HTML::NAME{$direction}\n  NODE $Texi2HTML::NODE{$direction}\n  HREF $Texi2HTML::HREF{$direction}\n\n";                          #print STDERR "$direction ($element->{'texi'}): \n  NO_TEXI: $Texi2HTML::NO_TEXI{$direction}\n  NAME $Texi2HTML::NAME{$direction}\n  NODE $Texi2HTML::NODE{$direction}\n  HREF $Texi2HTML::HREF{$direction}\n\n";
6467                      }                      }
6468                      #print STDERR "\nDone hrefs for $element->{'texi'}\n";                      #print STDERR "\nDone hrefs for $element->{'texi'}\n";
# Line 6597  print STDERR "!!$key\n" if (!defined($Te Line 6614  print STDERR "!!$key\n" if (!defined($Te
6614          # (we could do both)          # (we could do both)
6615          $Texi2HTML::NAME{$direction} = undef;          $Texi2HTML::NAME{$direction} = undef;
6616          $Texi2HTML::NO_TEXI{$direction} = undef;          $Texi2HTML::NO_TEXI{$direction} = undef;
6617          $Texi2HTML::UNFORMATTED{$direction} = undef;          $Texi2HTML::SIMPLE_TEXT{$direction} = undef;
6618          $Texi2HTML::NODE{$direction} = undef;          $Texi2HTML::NODE{$direction} = undef;
6619    
6620          $Texi2HTML::THIS_ELEMENT = undef;          $Texi2HTML::THIS_ELEMENT = undef;
# Line 6612  print STDERR "!!$key\n" if (!defined($Te Line 6629  print STDERR "!!$key\n" if (!defined($Te
6629          $Texi2HTML::HREF{'Footnotes'} = '#' . $footnote_element->{'id'};          $Texi2HTML::HREF{'Footnotes'} = '#' . $footnote_element->{'id'};
6630          $Texi2HTML::NAME{'This'} = $Texi2HTML::NAME{'Footnotes'};          $Texi2HTML::NAME{'This'} = $Texi2HTML::NAME{'Footnotes'};
6631          $Texi2HTML::NO_TEXI{'This'} = $Texi2HTML::NO_TEXI{'Footnotes'};          $Texi2HTML::NO_TEXI{'This'} = $Texi2HTML::NO_TEXI{'Footnotes'};
6632          $Texi2HTML::UNFORMATTED{'This'} = $Texi2HTML::UNFORMATTED{'Footnotes'};          $Texi2HTML::SIMPLE_TEXT{'This'} = $Texi2HTML::SIMPLE_TEXT{'Footnotes'};
6633          $Texi2HTML::THIS_SECTION = \@foot_lines;          $Texi2HTML::THIS_SECTION = \@foot_lines;
6634          $Texi2HTML::THIS_HEADER = [ &$Texi2HTML::Config::anchor($footnote_element->{'id'}) . "\n" ];          $Texi2HTML::THIS_HEADER = [ &$Texi2HTML::Config::anchor($footnote_element->{'id'}) . "\n" ];
6635          #&$Texi2HTML::Config::print_Footnotes(\*FILE);          #&$Texi2HTML::Config::print_Footnotes(\*FILE);
# Line 6634  print STDERR "!!$key\n" if (!defined($Te Line 6651  print STDERR "!!$key\n" if (!defined($Te
6651          $Texi2HTML::HREF{'Contents'} = "#SEC_Contents";          $Texi2HTML::HREF{'Contents'} = "#SEC_Contents";
6652          $Texi2HTML::NAME{'This'} = $Texi2HTML::NAME{'Contents'};          $Texi2HTML::NAME{'This'} = $Texi2HTML::NAME{'Contents'};
6653          $Texi2HTML::NO_TEXI{'This'} = $Texi2HTML::NO_TEXI{'Contents'};          $Texi2HTML::NO_TEXI{'This'} = $Texi2HTML::NO_TEXI{'Contents'};
6654          $Texi2HTML::UNFORMATTED{'This'} = $Texi2HTML::UNFORMATTED{'Contents'};          $Texi2HTML::SIMPLE_TEXT{'This'} = $Texi2HTML::SIMPLE_TEXT{'Contents'};
6655          $Texi2HTML::THIS_SECTION = $Texi2HTML::TOC_LINES;          $Texi2HTML::THIS_SECTION = $Texi2HTML::TOC_LINES;
6656          $Texi2HTML::THIS_HEADER = [ &$Texi2HTML::Config::anchor("SEC_Contents") . "\n" ];          $Texi2HTML::THIS_HEADER = [ &$Texi2HTML::Config::anchor("SEC_Contents") . "\n" ];
6657          #&$Texi2HTML::Config::print_Toc(\*FILE);          #&$Texi2HTML::Config::print_Toc(\*FILE);
# Line 6656  print STDERR "!!$key\n" if (!defined($Te Line 6673  print STDERR "!!$key\n" if (!defined($Te
6673          $Texi2HTML::HREF{Overview} = "#SEC_Overview";          $Texi2HTML::HREF{Overview} = "#SEC_Overview";
6674          $Texi2HTML::NAME{This} = $Texi2HTML::NAME{Overview};          $Texi2HTML::NAME{This} = $Texi2HTML::NAME{Overview};
6675          $Texi2HTML::NO_TEXI{This} = $Texi2HTML::NO_TEXI{Overview};          $Texi2HTML::NO_TEXI{This} = $Texi2HTML::NO_TEXI{Overview};
6676          $Texi2HTML::UNFORMATTED{This} = $Texi2HTML::UNFORMATTED{Overview};          $Texi2HTML::SIMPLE_TEXT{This} = $Texi2HTML::SIMPLE_TEXT{Overview};
6677          $Texi2HTML::THIS_SECTION = $Texi2HTML::OVERVIEW;          $Texi2HTML::THIS_SECTION = $Texi2HTML::OVERVIEW;
6678          $Texi2HTML::THIS_HEADER = [ &$Texi2HTML::Config::anchor("SEC_Overview") . "\n" ];          $Texi2HTML::THIS_HEADER = [ &$Texi2HTML::Config::anchor("SEC_Overview") . "\n" ];
6679          #&$Texi2HTML::Config::print_Overview(\*FILE);          #&$Texi2HTML::Config::print_Overview(\*FILE);
# Line 6679  print STDERR "!!$key\n" if (!defined($Te Line 6696  print STDERR "!!$key\n" if (!defined($Te
6696          $Texi2HTML::HREF{About} = "#SEC_About";          $Texi2HTML::HREF{About} = "#SEC_About";
6697          $Texi2HTML::NAME{This} = $Texi2HTML::NAME{About};          $Texi2HTML::NAME{This} = $Texi2HTML::NAME{About};
6698          $Texi2HTML::NO_TEXI{This} = $Texi2HTML::NO_TEXI{About};          $Texi2HTML::NO_TEXI{This} = $Texi2HTML::NO_TEXI{About};
6699          $Texi2HTML::UNFORMATTED{This} = $Texi2HTML::UNFORMATTED{About};          $Texi2HTML::SIMPLE_TEXT{This} = $Texi2HTML::SIMPLE_TEXT{About};
6700          $Texi2HTML::THIS_SECTION = [$about_body];          $Texi2HTML::THIS_SECTION = [$about_body];
6701          $Texi2HTML::THIS_HEADER = [ &$Texi2HTML::Config::anchor("SEC_About") . "\n" ];          $Texi2HTML::THIS_HEADER = [ &$Texi2HTML::Config::anchor("SEC_About") . "\n" ];
6702          #&$Texi2HTML::Config::print_About(\*FILE);          #&$Texi2HTML::Config::print_About(\*FILE);
# Line 6790  sub do_node_files() Line 6807  sub do_node_files()
6807          my $file = "${docu_rdir}$node->{'node_file'}";          my $file = "${docu_rdir}$node->{'node_file'}";
6808          $Texi2HTML::NODE{'This'} = $node->{'text'};          $Texi2HTML::NODE{'This'} = $node->{'text'};
6809          $Texi2HTML::NO_TEXI{'This'} = $node->{'no_texi'};          $Texi2HTML::NO_TEXI{'This'} = $node->{'no_texi'};
6810          $Texi2HTML::UNFORMATTED{'This'} = $node->{'no_texi'};          $Texi2HTML::SIMPLE_TEXT{'This'} = $node->{'simple_format'};
6811          $Texi2HTML::NAME{'This'} = $node->{'text'};          $Texi2HTML::NAME{'This'} = $node->{'text'};
6812          $Texi2HTML::HREF{'This'} = "$node->{'file'}#$node->{'id'}";          $Texi2HTML::HREF{'This'} = "$node->{'file'}#$node->{'id'}";
6813          open (NODEFILE, "> $file") || die "$ERROR Can't open $file for writing: $!\n";          open (NODEFILE, "> $file") || die "$ERROR Can't open $file for writing: $!\n";
# Line 7738  sub do_text($;$) Line 7755  sub do_text($;$)
7755      my $text = shift;      my $text = shift;
7756      my $state = shift;      my $state = shift;
7757      return $text if ($state->{'keep_texi'});      return $text if ($state->{'keep_texi'});
7758      if (defined($state) and !$state->{'preformatted'} and !$state->{'code_style'})      my $remove_texi = 1 if ($state->{'remove_texi'} and !$state->{'simple_format'});
7759      {      return (&$Texi2HTML::Config::normal_text($text, $remove_texi, $state->{'preformatted'}, $state->{'code_style'},$state->{'style_stack'}));
7760    #    if (defined($state) and !$state->{'preformatted'} and !$state->{'code_style'})
7761    #    {
7762          # in normal text `` and '' serve as quotes, --- is for a long dash          # in normal text `` and '' serve as quotes, --- is for a long dash
7763          # and -- for a medium dash.          # and -- for a medium dash.
7764          # (see texinfo.txi, @node Conventions)          # (see texinfo.txi, @node Conventions)
7765          $text = &$Texi2HTML::Config::normal_text($text);  #        $text = &$Texi2HTML::Config::normal_text($text);
7766      }  #    }
7767      if ($state->{'no_protection'})  #    if ($state->{'remove_texi'} and !$state->{'simple_format'})
7768      {  #    {
7769          return $text;  #        return $text;
7770      }  #    }
7771      return &$Texi2HTML::Config::protect_text($text);  #    return &$Texi2HTML::Config::protect_text($text);
7772  }  }
7773    
7774  sub end_simple_format($$)  sub end_simple_format($$)
# Line 8043  sub do_acronym_like($$$$$) Line 8062  sub do_acronym_like($$$$$)
8062    
8063      my $explanation_lines;      my $explanation_lines;
8064      my $explanation_text;      my $explanation_text;
8065      my $explanation_unformatted;      my $explanation_simple_format;
8066    
8067      if (defined($explanation))      if (defined($explanation))
8068      {      {
# Line 8057  sub do_acronym_like($$$$$) Line 8076  sub do_acronym_like($$$$$)
8076      return '' if ($acronym_texi eq '');      return '' if ($acronym_texi eq '');
8077            
8078      my $with_explanation = 0;      my $with_explanation = 0;
8079      my $normalized_text =  cross_manual_line (normalise_node($acronym_texi));      my $normalized_text =  cross_manual_line(normalise_node($acronym_texi));
8080      if (defined($explanation))      if (defined($explanation))
8081      {      {
8082          $with_explanation = 1;          $with_explanation = 1;
# Line 8078  sub do_acronym_like($$$$$) Line 8097  sub do_acronym_like($$$$$)
8097                $text .= $line                $text .= $line
8098           }           }
8099           $text =~ s/ $//;           $text =~ s/ $//;
8100           my $unformatted_state = duplicate_state($state);           my $simple_format_state = duplicate_state($state);
8101           # FIXME UNFORMATTED           $explanation_simple_format = simple_format($simple_format_state,$text);
          $unformatted_state->{'unformatted'} = 1;  
          $explanation_unformatted = substitute_line($text, $unformatted_state);  
8102           $explanation_text = substitute_line($text, duplicate_state($state));           $explanation_text = substitute_line($text, duplicate_state($state));
8103      }      }
8104      return &$Texi2HTML::Config::acronym_like($command, $acronym_texi, substitute_line ($acronym_texi, duplicate_state($state)),      return &$Texi2HTML::Config::acronym_like($command, $acronym_texi, substitute_line($acronym_texi, duplicate_state($state)),
8105         $with_explanation, $explanation_lines, $explanation_text, $explanation_unformatted);         $with_explanation, $explanation_lines, $explanation_text, $explanation_simple_format);
8106  }  }
8107    
8108  sub do_caption_shortcaption($$$$$)  sub do_caption_shortcaption($$$$$)
# Line 8261  sub do_image($$$$) Line 8278  sub do_image($$$$)
8278      {      {
8279           $file_name = "$base.$args[4]";           $file_name = "$base.$args[4]";
8280      }      }
8281        # FIXME there should instead be a list of file extension to search for.
8282      elsif ($image = locate_include_file("$base.png"))      elsif ($image = locate_include_file("$base.png"))
8283      {      {
8284           $file_name = "$base.png";           $file_name = "$base.png";
# Line 8278  sub do_image($$$$) Line 8296  sub do_image($$$$)
8296          $image = "$base.jpg";          $image = "$base.jpg";
8297          $image = "$base.$args[4]" if (defined($args[4]) and ($args[4] ne ''));          $image = "$base.$args[4]" if (defined($args[4]) and ($args[4] ne ''));
8298          $file_name = $image;          $file_name = $image;
8299            # FIXME should be a warning
8300          echo_error ("no image file for $base, (using $image)", $line_nr);          echo_error ("no image file for $base, (using $image)", $line_nr);
8301          #warn "$ERROR no image file for $base, (using $image) : $text\n";          #warn "$ERROR no image file for $base, (using $image) : $text\n";
8302      } # FIXME use full file name for alt instead of base when there is no      }
8303        # alttext ?      my $alt;
8304      if ($args[3] =~ /\S/)      if ($args[3] =~ /\S/)
8305      {      {
8306          # FIXME makeinfo don't do that.          # FIXME makeinfo don't do that. Maybe it should be remove_texi or
8307            # simple_format?
8308          $args[3] = do_text($args[3]);          $args[3] = do_text($args[3]);
8309          $base = $args[3] if ($args[3] =~ /\S/);          $alt = $args[3] if ($args[3] =~ /\S/);
8310      }      }
8311      return &$Texi2HTML::Config::image(      return &$Texi2HTML::Config::image($path_to_working_dir . $image, $base,
8312      &$Texi2HTML::Config::protect_text($path_to_working_dir . $image),      $state->{'preformatted'}, $file_name, $alt);
     &$Texi2HTML::Config::protect_text($base),  
     $state->{'preformatted'}, &$Texi2HTML::Config::protect_text($file_name));  
8313  }  }
8314    
8315  sub duplicate_state($)  sub duplicate_state($)
# Line 8555  sub do_index_entries($$$) Line 8573  sub do_index_entries($$$)
8573  # Doesn't protect html  # Doesn't protect html
8574  sub remove_texi(@)  sub remove_texi(@)
8575  {  {
8576  # FIXME default should be not to protect.      return substitute_text ({ 'remove_texi' => 1}, @_);
     return substitute_text ({ 'remove_texi' => 1, 'no_protection' => 1 }, @_);  
8577  }  }
8578    
8579  # Same as remove texi but protect text and use special maps for @-commands  # Same as remove texi but protect text and use special maps for @-commands
8580  sub unformatted_text($@)  sub simple_format($@)
8581  {  {
8582      my $state = shift;      my $state = shift;
8583      $state = {} if (!defined($state));      $state = {} if (!defined($state));
 # FIXME default should be not to protect.  
8584      $state->{'remove_texi'} = 1;      $state->{'remove_texi'} = 1;
8585      $simple_map_texi_ref = \%Texi2HTML::Config::unformatted_text_simple_map_texi;      $state->{'simple_format'} = 1;
8586      $style_map_texi_ref = \%Texi2HTML::Config::unformatted_text_style_map_texi;  # FIXME currently it is only used for lines
8587      $texi_map_ref = \%Texi2HTML::Config::unformatted_text_texi_map;      $state->{'no_paragraph'} = 1;
8588        $simple_map_texi_ref = \%Texi2HTML::Config::simple_format_simple_map_texi;
8589        $style_map_texi_ref = \%Texi2HTML::Config::simple_format_style_map_texi;
8590        $texi_map_ref = \%Texi2HTML::Config::simple_format_texi_map;
8591      my $text = substitute_text($state, @_);      my $text = substitute_text($state, @_);
8592      $simple_map_texi_ref = \%Texi2HTML::Config::simple_map_texi;      $simple_map_texi_ref = \%Texi2HTML::Config::simple_map_texi;
8593      $style_map_texi_ref = \%Texi2HTML::Config::style_map_texi;      $style_map_texi_ref = \%Texi2HTML::Config::style_map_texi;
# Line 9006  sub scan_texi($$$$;$) Line 9025  sub scan_texi($$$$;$)
9025              elsif (defined($text_macros{$macro}))              elsif (defined($text_macros{$macro}))
9026              {              {
9027                  my $tag;                  my $tag;
9028                  ($_, $tag) = do_text_macro ($macro, $_, $state, $stack, $line_nr);                  ($_, $tag) = do_text_macro($macro, $_, $state, $stack, $line_nr);
9029                  # if it is a raw formatting command or a menu command                  # if it is a raw formatting command or a menu command
9030                  # we must keep it for later, unless we are in an 'ignored'.                  # we must keep it for later, unless we are in an 'ignored'.
9031                  # if in 'arg_expansion' we keep everything.                  # if in 'arg_expansion' we keep everything.
# Line 10169  sub scan_line($$$$;$) Line 10188  sub scan_line($$$$;$)
10188                  if (s/^(\s+)(.*)//o)                  if (s/^(\s+)(.*)//o)
10189                  {                  {
10190                      my $arg = $2;                      my $arg = $2;
10191  #                    if ($macro eq 'verbatiminclude')                      my $style_id = cross_manual_line (normalise_space($arg));
10192  #                    {                      my $style = substitute_line (&$Texi2HTML::Config::listoffloats_style($arg));
10193  #                        my $file = locate_include_file($arg);                      if (exists ($floats{$style_id}))
10194  #                        if (defined($file))                      {
10195  #                        {                           close_paragraph($text, $stack, $state, $line_nr);
10196  #                            if (!open(VERBINCLUDE, $file))                           my @listoffloats_entries = ();
10197  #                            {                           foreach my $float (@{$floats{$style_id}->{'floats'}})
 #                                echo_warn ("Can't read file $file: $!",$line_nr);  
 #                            }  
 #                            else  
 #                            {  
 #                                my $verb_text = '';  
 #                                while (my $line = <VERBINCLUDE>)  
 #                                {  
 #                                    $verb_text .= $line;  
 #                                }  
 #                                add_prev($text, $stack, &$Texi2HTML::Config::raw('verbatim',$verb_text));  
 #                                close VERBINCLUDE;  
 #                            }  
 #                        }  
 #                        else  
 #                        {  
 #                            echo_error ("Can't find $arg, skipping", $line_nr);  
 #                        }  
 #                    }  
 #                    elsif ($macro eq 'listoffloats')  
 #                    {  
                          my $style_id = cross_manual_line (normalise_space($arg));  
                          my $style = substitute_line (&$Texi2HTML::Config::listoffloats_style($arg));  
                          if (exists ($floats{$style_id}))  
                          {  
                               close_paragraph($text, $stack, $state, $line_nr);  
                               my @listoffloats_entries = ();  
                               foreach my $float (@{$floats{$style_id}->{'floats'}})  
                               {  
                                    my $float_style = substitute_line(&$Texi2HTML::Config::listoffloats_float_style($arg, $float));  
                                    my $caption_lines = &$Texi2HTML::Config::listoffloats_caption($float);  
                                    my $caption = substitute_text({ 'multiple_pass' => 1 }, @$caption_lines);  
                                    push @listoffloats_entries, &$Texi2HTML::Config::listoffloats_entry($arg, $float, $float_style, $caption, href($float, $state->{'element'}->{'file'}));  
                               }  
                               add_prev($text, $stack, &$Texi2HTML::Config::listoffloats($arg, $style, \@listoffloats_entries));  
                          }  
                          else  
10198                           {                           {
10199                                echo_warn ("Unknown float style $arg", $line_nr);                                my $float_style = substitute_line(&$Texi2HTML::Config::listoffloats_float_style($arg, $float));
10200                                  my $caption_lines = &$Texi2HTML::Config::listoffloats_caption($float);
10201                                  my $caption = substitute_text({ 'multiple_pass' => 1 }, @$caption_lines);
10202                                  push @listoffloats_entries, &$Texi2HTML::Config::listoffloats_entry($arg, $float, $float_style, $caption, href($float, $state->{'element'}->{'file'}));
10203                           }                           }
10204  #                    }                           add_prev($text, $stack, &$Texi2HTML::Config::listoffloats($arg, $style, \@listoffloats_entries));
10205                        }
10206                        else
10207                        {
10208                             echo_warn ("Unknown float style $arg", $line_nr);
10209                        }
10210                  }                  }
10211                  else                  else
10212                  {                  {
# Line 10248  sub scan_line($$$$;$) Line 10239  sub scan_line($$$$;$)
10239                  push (@$stack, { 'style' => $macro, 'text' => '', 'arg_nr' => 0 });                  push (@$stack, { 'style' => $macro, 'text' => '', 'arg_nr' => 0 });
10240                  $state->{'no_paragraph'}++ if ($no_paragraph_macro{$macro});                  $state->{'no_paragraph'}++ if ($no_paragraph_macro{$macro});
10241                  open_arg($macro, 0, $state);                  open_arg($macro, 0, $state);
10242                  push (@{$state->{'style_stack'}}, $macro) if (defined($style_type{$macro}) and (($style_type{$macro} eq 'style') or ($style_type{$macro} eq 'accent')));                  if (defined($style_type{$macro}) and (($style_type{$macro} eq 'style') or ($style_type{$macro} eq 'accent')))
10243                    {
10244                         push (@{$state->{'style_stack'}}, $macro);
10245                         #print STDERR "# Stacked $macro (@{$state->{'style_stack'}})\n" if ($T2H_DEBUG);
10246                    }
10247                  next;                  next;
10248              }              }
10249    
# Line 10270  sub scan_line($$$$;$) Line 10265  sub scan_line($$$$;$)
10265                       $_ = '';                       $_ = '';
10266                       next;                       next;
10267                  }                  }
10268                  # @ at the end of line may protect te end of line even when                  # @ at the end of line may protect the end of line even when
10269                  # keeping texi                  # keeping texi
10270                  if ($macro eq "\n")                  if ($macro eq "\n")
10271                  {                  {
# Line 10737  sub scan_line($$$$;$) Line 10732  sub scan_line($$$$;$)
10732                  if (@$stack and defined($stack->[-1]->{'style'}))                  if (@$stack and defined($stack->[-1]->{'style'}))
10733                  {                  {
10734                      my $macro = $stack->[-1]->{'style'};                      my $macro = $stack->[-1]->{'style'};
10735                      if (($macro eq 'cmd_line') and  $brace and ($brace eq '}'))                      if (($macro eq 'cmd_line') and  defined($brace) and ($brace eq '}'))
10736                      {                      {
10737                           add_prev($text, $stack, '}');                           add_prev($text, $stack, '}');
10738                           unless ($state->{'keep_texi'} or $state->{'remove_texi'})                           unless ($state->{'keep_texi'} or $state->{'remove_texi'})
# Line 10767  sub scan_line($$$$;$) Line 10762  sub scan_line($$$$;$)
10762                      if ($macro)                      if ($macro)
10763                      {                      {
10764                          $style->{'no_close'} = 1 if ($state->{'no_close'});                          $style->{'no_close'} = 1 if ($state->{'no_close'});
10765                            if ($style_map_ref->{$macro} and !$style->{'no_close'} and (defined($style_type{$macro})) and (($style_type{$macro} eq 'style') or ($style_type{$macro} eq 'accent')))
10766                            {
10767                                my $style = pop @{$state->{'style_stack'}};
10768                                print STDERR "Bug: $style on 'style_stack', not $macro\n" if ($style ne $macro);
10769                                #print STDERR "# Unstacked from style_stack $style, remaining: (@{$state->{'style_stack'}})\n" if ($T2H_DEBUG);
10770                            }
10771                          if ($state->{'keep_texi'})                          if ($state->{'keep_texi'})
10772                          { # don't expand macros in anchor and ref                          { # don't expand macros in anchor and ref
10773                              close_arg ($macro, $style->{'arg_nr'}, $state);                              close_arg ($macro, $style->{'arg_nr'}, $state);
# Line 10774  sub scan_line($$$$;$) Line 10775  sub scan_line($$$$;$)
10775                          }                          }
10776                          else                          else
10777                          {                          {
10778                              if ($style_map_ref->{$macro} and !$style->{'no_close'} and (defined($style_type{'$macro'})) and (($style_type{'$macro'} eq 'style') or ($style_type{'$macro'} eq 'accent')))                              #print STDERR "# Unstack from main $macro (@{$state->{'style_stack'}})\n" if ($T2H_DEBUG);
                             {  
                                 my $style = pop @{$state->{'style_stack'}};  
                                 print STDERR "Bug: $style on 'style_stack', not $macro\n" if ($style ne $macro);  
                             }  
10779                              $result = do_simple($macro, $style->{'text'}, $state, $style->{'args'}, $line_nr, $style->{'no_open'}, $style->{'no_close'});                              $result = do_simple($macro, $style->{'text'}, $state, $style->{'args'}, $line_nr, $style->{'no_open'}, $style->{'no_close'});
10780                              if ($state->{'code_style'} < 0)                              if ($state->{'code_style'} < 0)
10781                              {                              {
# Line 10951  sub open_cmd_line($$$$) Line 10948  sub open_cmd_line($$$$)
10948      my $args = shift;      my $args = shift;
10949      my $function = shift;      my $function = shift;
10950      push @$stack, {'style' => 'cmd_line', 'text' => '', 'arg_nr' => 0};      push @$stack, {'style' => 'cmd_line', 'text' => '', 'arg_nr' => 0};
10951      foreach my $hash (\%Texi2HTML::Config::style_map, \%Texi2HTML::Config::style_map_pre, \%Texi2HTML::Config::style_map_texi, \%Texi2HTML::Config::unformatted_text_style_map_texi)      foreach my $hash (\%Texi2HTML::Config::style_map, \%Texi2HTML::Config::style_map_pre, \%Texi2HTML::Config::style_map_texi, \%Texi2HTML::Config::simple_format_style_map_texi)
10952      {      {
10953           $hash->{'cmd_line'}->{'args'} = $args;           $hash->{'cmd_line'}->{'args'} = $args;
10954           $hash->{'cmd_line'}->{'function'} = $function;           $hash->{'cmd_line'}->{'function'} = $function;
# Line 11723  sub dump_stack($$$) Line 11720  sub dump_stack($$$)
11720      {      {
11721          print STDERR "text: UNDEF\n";          print STDERR "text: UNDEF\n";
11722      }      }
11723      print STDERR "state: ";      my $in_remove = 0;
11724        my $in_simple_format = 0;
11725        my $in_keep = 0;
11726        $in_keep = 1 if ($state->{'keep_texi'});
11727        if (!$in_keep)
11728        {
11729            $in_simple_format = 1 if ($state->{'simple_format'});
11730            $in_remove = 1 if ($state->{'remove_texi'}  and !$in_simple_format);
11731        }
11732        print STDERR "state(k${in_keep}s${in_simple_format}r${in_remove}): ";
11733      foreach my $key (keys(%$state))      foreach my $key (keys(%$state))
11734      {      {
11735          my $value = 'UNDEF';          my $value = 'UNDEF';
11736          $value = $state->{$key} if (defined($state->{$key}));          $value = $state->{$key} if (defined($state->{$key}));
11737          print STDERR "$key: $value ";          print STDERR "$key: $value " if (!ref($value));
11738      }      }
11739      print STDERR "\n";      print STDERR "\n";
11740      my $stack_level = $#$stack + 1;      my $stack_level = $#$stack + 1;
# Line 11753  sub dump_stack($$$) Line 11759  sub dump_stack($$$)
11759          }          }
11760          print STDERR "\n";          print STDERR "\n";
11761      }      }
11762        if (defined($state->{'style_stack'}))
11763        {
11764            print STDERR "style_stack: ";
11765            foreach my $style (@{$state->{'style_stack'}})
11766            {
11767                print STDERR "($style) ";
11768            }
11769            print STDERR "\n";
11770        }
11771  }  }
11772    
11773  # for debugging  # for debugging
# Line 11785  sub substitute_line($;$) Line 11800  sub substitute_line($;$)
11800      my $state = shift;      my $state = shift;
11801      $state = {} if (!defined($state));      $state = {} if (!defined($state));
11802      $state->{'no_paragraph'} = 1;      $state->{'no_paragraph'} = 1;
11803      # FIXME UNFORMATTED      # this is usefull when called from &$I
11804      return unformatted_text($state, $line) if ($state->{'unformatted'});      return simple_format($state, $line) if ($state->{'simple_format'});
11805      return substitute_text($state, $line);      return substitute_text($state, $line);
11806  }  }
11807    

Legend:
Removed from v.1.147  
changed lines
  Added in v.1.148

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26