- Timestamp:
- 10/30/08 17:27:32 (2 months ago)
- Files:
-
- 1 modified
-
src/perl6/STD_syntax_highlight (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/perl6/STD_syntax_highlight
r22824 r22826 5 5 use warnings; 6 6 use utf8; 7 use feature qw(say); 7 8 use English; 8 9 use Getopt::Long; … … 93 94 my $r = STD->parsefile($file,$what); 94 95 96 =item write_html_file 97 98 Writes the html file to filename or to STDOUT 99 =cut 100 sub write_html_file { 101 my ($html_file, $html) = @_; 102 if($html_file eq '-') { 103 say $html; 104 } else { 105 open FILE, ">$html_file" or 106 die "Cannot open $html_file for writing: $OS_ERROR\n"; 107 say FILE $html; 108 close FILE; 109 } 110 } 111 95 112 =item highlight_match 96 113 … … 107 124 if($simple_html) { 108 125 traverse_match($r,$name,0,$events,$opt); 109 my $output = highlight_perl6_simple($::ORIG,$events,$opt); 110 if($simple_html eq '-') { 111 print $output; 112 } else { 113 open FILE, ">$simple_html" or 114 die "Cannot open $simple_html for writing: $OS_ERROR\n"; 115 print FILE $output; 116 close FILE; 117 } 126 my $html = highlight_perl6_simple($::ORIG,$events,$opt); 127 write_html_file $simple_html, $html; 118 128 } 119 129 if($full_html) { 120 130 traverse_match($r,$name,0,$events,$opt); 121 my $output = highlight_perl6($::ORIG,$events,$opt); 122 if($full_html eq '-') { 123 print $output; 124 } else { 125 open FILE, ">$full_html" or 126 die "Cannot open $full_html for writing: $OS_ERROR\n"; 127 print FILE $output; 128 close FILE; 129 } 131 my $html = highlight_perl6($::ORIG,$events,$opt); 132 write_html_file $full_html, $html; 130 133 } 131 134 if($redspans_html) { 132 my $output = highlight_perl6_redspans(); 133 if($redspans_html eq '-') { 134 print $output; 135 } else { 136 open FILE, ">$redspans_html" or 137 die "Cannot open $redspans_html for writing: $OS_ERROR\n"; 138 print FILE $output; 139 close FILE; 140 } 135 my $html = highlight_perl6_redspans(); 136 write_html_file $redspans_html, $html; 141 137 } 142 138 }
