? src/Perl Index: src/PerlTidy.pm =================================================================== RCS file: /cvsroot/perltidy/perltidy/src/PerlTidy.pm,v retrieving revision 1.3 diff -a -u -r1.3 PerlTidy.pm --- src/PerlTidy.pm 12 Feb 2002 14:01:10 -0000 1.3 +++ src/PerlTidy.pm 17 Mar 2002 21:38:18 -0000 @@ -2987,36 +2987,39 @@ $html_file_opened = 1; unless ( $rOpts->{'html-pre-only'} ) { + + my $title = $input_file; + $title = escape_html($title); + $html_fh->print( <<"HTML_START"); - - - + + + +$title HTML_START # use css linked to another file if ( $rOpts->{'html-linked-style-sheet'} ) { $html_fh->print( - qq()); + qq()); $html_fh->print( <<"ENDCSS"); -$input_file - - + + ENDCSS } # use css embedded in this file elsif ( !$rOpts->{'nohtml-style-sheets'} ) { $html_fh->print( <<'ENDCSS'); - -$input_file - - + + + ENDCSS } @@ -3024,16 +3027,18 @@ else { $html_fh->print( <<"HTML_START"); -$input_file - -{'html-color-background'}\" TEXT=\"$rOpts->{'html-color-punctuation'}\"> + +{'html-color-background'}\" text=\"$rOpts->{'html-color-punctuation'}\"> HTML_START } } + my $fname_comment = $input_file; + $fname_comment =~ s/--+/-/g; # protect HTML comment tag + $html_fh->print( <<"END_PRE"); - -
+
+
 END_PRE
 
     bless {
@@ -3363,12 +3368,12 @@
     return unless $self->{_html_file_opened};
     my $html_fh = $self->{_html_fh};
     $html_fh->print( <<"PRE_END");
-
+
PRE_END unless ( $rOpts->{'html-pre-only'} ) { $html_fh->print( <<"HTML_END"); - - + + HTML_END } $html_fh->close(); @@ -3417,15 +3422,7 @@ return $token if ( $type eq 'b' ); # skip a blank return $token if ( $token =~ /^\s*$/ ); - if ($missing_html_entities) { - $token =~ s/\&/&/g; - $token =~ s/\/>/g; - $token =~ s/\"/"/g; - } - else { - encode_entities($token); - } + $token = escape_html($token); # get the short abbreviation for this token type my $short_name = $token_short_names{$type}; @@ -3436,7 +3433,7 @@ # handle style sheets.. if ( !$rOpts->{'nohtml-style-sheets'} ) { if ( $short_name ne 'pu' ) { - $token = qq() . $token . ""; + $token = qq() . $token . ""; } } @@ -3445,10 +3442,25 @@ my $color = $html_color{$short_name}; if ( $color && ( $color ne $rOpts->{'html-color-punctuation'} ) ) { - $token = qq() . $token . ""; + $token = qq() . $token . ""; } - if ( $html_italic{$short_name} ) { $token = "$token" } - if ( $html_bold{$short_name} ) { $token = "$token" } + if ( $html_italic{$short_name} ) { $token = "$token" } + if ( $html_bold{$short_name} ) { $token = "$token" } + } + return $token; +} + +sub escape_html { + + my $token = shift; + if ($missing_html_entities) { + $token =~ s/\&/&/g; + $token =~ s/\/>/g; + $token =~ s/\"/"/g; + } + else { + HTML::Entities::encode_entities($token); } return $token; } Index: src/Tidy.pm =================================================================== RCS file: /cvsroot/perltidy/perltidy/src/Tidy.pm,v retrieving revision 1.10 diff -a -u -r1.10 Tidy.pm --- src/Tidy.pm 15 Mar 2002 20:42:37 -0000 1.10 +++ src/Tidy.pm 17 Mar 2002 21:38:40 -0000 @@ -3064,36 +3064,39 @@ } unless ( $rOpts->{'html-pre-only'} ) { + + my $title = $input_file; + $title = escape_html($title); + $html_fh->print( <<"HTML_START"); - - - + + + +$title HTML_START # use css linked to another file if ( $rOpts->{'html-linked-style-sheet'} ) { $html_fh->print( - qq()); + qq()); $html_fh->print( <<"ENDCSS"); -$input_file - - + + ENDCSS } # use css embedded in this file elsif ( !$rOpts->{'nohtml-style-sheets'} ) { $html_fh->print( <<'ENDCSS'); - -$input_file - - + + + ENDCSS } @@ -3101,16 +3104,18 @@ else { $html_fh->print( <<"HTML_START"); -$input_file - -{'html-color-background'}\" TEXT=\"$rOpts->{'html-color-punctuation'}\"> + +{'html-color-background'}\" text=\"$rOpts->{'html-color-punctuation'}\"> HTML_START } } + my $fname_comment = $input_file; + $fname_comment =~ s/--+/-/g; # protect HTML comment tags + $html_fh->print( <<"END_PRE"); - -
+
+
 END_PRE
 
     bless {
@@ -3440,12 +3445,12 @@
     return unless $self->{_html_file_opened};
     my $html_fh = $self->{_html_fh};
     $html_fh->print( <<"PRE_END");
-
+
PRE_END unless ( $rOpts->{'html-pre-only'} ) { $html_fh->print( <<"HTML_END"); - - + + HTML_END } eval { $html_fh->close() }; @@ -3494,15 +3499,7 @@ return $token if ( $type eq 'b' ); # skip a blank return $token if ( $token =~ /^\s*$/ ); - if ($missing_html_entities) { - $token =~ s/\&/&/g; - $token =~ s/\/>/g; - $token =~ s/\"/"/g; - } - else { - HTML::Entities::encode_entities($token); - } + $token = escape_html($token); # get the short abbreviation for this token type my $short_name = $token_short_names{$type}; @@ -3513,7 +3510,7 @@ # handle style sheets.. if ( !$rOpts->{'nohtml-style-sheets'} ) { if ( $short_name ne 'pu' ) { - $token = qq() . $token . ""; + $token = qq() . $token . ""; } } @@ -3522,10 +3519,25 @@ my $color = $html_color{$short_name}; if ( $color && ( $color ne $rOpts->{'html-color-punctuation'} ) ) { - $token = qq() . $token . ""; + $token = qq() . $token . ""; } - if ( $html_italic{$short_name} ) { $token = "$token" } - if ( $html_bold{$short_name} ) { $token = "$token" } + if ( $html_italic{$short_name} ) { $token = "$token" } + if ( $html_bold{$short_name} ) { $token = "$token" } + } + return $token; +} + +sub escape_html { + + my $token = shift; + if ($missing_html_entities) { + $token =~ s/\&/&/g; + $token =~ s/\/>/g; + $token =~ s/\"/"/g; + } + else { + HTML::Entities::encode_entities($token); } return $token; }