| Syntax-Highlight-Mason documentation | view source | Contained in the Syntax-Highlight-Mason distribution. |
Syntax::Highlight::Mason - Perl extension to Highlight HTML::Mason code
use Syntax::Highlight::Mason;
use IO::All;
my $compiler = Syntax::Highlight::Mason->new();
while (my $file = shift @ARGV) {
my $source < io($file);
print $compiler->compile($source);
}
Produce colorized and HTML escaped code from HTML::Mason source suitable for displaying on the WWW and perhaps even in an Mason environment. Lots of things are customizable, but the defaults are pretty reasonable.
The following items can be customized:
$debug Set it to 1 to enable debugging output
$style_sheet A CSS style sheet that maps HTML ids to colors
$preamble HTML that gets inserted at the beginning of a page
$postamble HTML that gets inserted at the end of a page
$color_table A mapping of perl syntax elements to colors
@mason_highlight An array, element[0] is inserted before mason code
element[1] is inserted after mason code
These are all package Global variables, which you can just set to
your own values if desired. A simple:
$Syntax::Highlight::Mason::debug = 1;
should do the trick.
More customization can be done by passing parmeters to the
new() method if desired. You can set the preamble,
postamble, and color_table parameters here too. In
addition, you can specify your own callback subroutines which
encode perl, html, plain (text), and mason code.
The defaults use Syntax::Highlight::Perl::Improved for perl,
Syntax::Highlight::HTML for HTML, HTML::Entities::encode
for plain text, and bold blue HTML::Entities::encode for
mason code.
calls the apropriate callback subroutine set up in new()
above, depending on the type of encoding (perl, html, plain,
mason) to be performed. Output is collected for later. You
could also subclass this if you wanted to generate your own
highlighting
Henry Laxen nadine.and.henry@pobox.com
Syntax::Highlight::HTML Syntax::Highlight::Perl::Improved HTML::Mason
| Syntax-Highlight-Mason documentation | view source | Contained in the Syntax-Highlight-Mason distribution. |