/[sysadmin-cookbook-html]/bin/html.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /bin/html.pl

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

revision 2 by dpavlin, Wed May 13 20:16:30 2009 UTC revision 3 by dpavlin, Wed May 13 20:23:53 2009 UTC
# Line 35  my $last_level = 0; Line 35  my $last_level = 0;
35  my $toc_html = '';  my $toc_html = '';
36  sub header {  sub header {
37          my ($level, $content) = @_;          my ($level, $content) = @_;
38            my $display = $content;
39            $display =~ s{^\d+[\.-]}{};
40            $display =~ s{-}{ }g;
41          html qq|<a name=$content></a>|;          html qq|<a name=$content></a>|;
42          html qq|<h$level>$content</h$level>|;          html qq|<h$level>$display</h$level>|;
43    
44          if ( $last_level > $level ) {          if ( $last_level > $level ) {
45                  $toc_html .= "</ul>";                  $toc_html .= "</ul>";
46          } elsif ( $last_level < $level ) {          } elsif ( $last_level < $level ) {
47                  $toc_html .= "<ul>";                  $toc_html .= "<ul>";
48          }          }
49          $toc_html .= qq|<li><a href="#$content">$content</li>|;          $toc_html .= qq|<li><a href="#$content">$display</li>|;
50          $last_level = $level;          $last_level = $level;
51  }  }
52    

Legend:
Removed from v.2  
changed lines
  Added in v.3

  ViewVC Help
Powered by ViewVC 1.1.26