Apache-Syntax-Highlight-Perl
view release on metacpan or search on metacpan
lib/Apache/Syntax/Highlight/Perl.pm view on Meta::CPAN
require Apache::Constants;
Apache::Constants->import(qw(DECLINED OK));
}
# Test caching necessaries modules
eval { require Digest::MD5; Digest::MD5->can('md5_hex') };
$can_cache = $@ ? 0 : 1;
}
my %default_styles = (
'Comment_Normal' => 'color:#006699;font-style:italic;',
'Comment_POD' => 'color:#001144;font-style:italic;',
'Directive' => 'color:#339999;font-style:italic;',
'Label' => 'color:#993399;font-style:italic;',
'Quote' => 'color:#0000aa;',
'String' => 'color:#0000aa;',
'Subroutine' => 'color:#998800;',
'Variable_Scalar' => 'color:#008800;',
'Variable_Array' => 'color:#ff7700;',
'Variable_Hash' => 'color:#8800ff;',
'Variable_Typeglob' => 'color:#ff0033;',
'Whitespace' => '',
'Character' => 'color:#880000;',
'Keyword' => 'color:#000000;',
lib/Apache/Syntax/Highlight/Perl.pm view on Meta::CPAN
# Install the formats
if ( $r->dir_config('HighlightCSS') ) {
foreach (keys %default_styles) {
$formatter->set_format($_, [ "<span class=\"$_\">",'</span>' ] );
}
$str = '<LINK HREF="' . $r->dir_config('HighlightCSS') . '" REL="stylesheet" TYPE="text/css"><PRE>';
}
else {
while ( my($type,$style) = each %default_styles ) {
$formatter->set_format($type, [ "<span style=\"$style\">",'</span>' ] );
$str = '<PRE style="font-size:10pt;color:#333366;">';
}
}
my @lines = $formatter->format_string(<$fh>);
undef $fh;
# Adds line numbers
if ( $sln ) {
my $line_number = 1;
my $max_space = length($formatter->line_count) + 1;
@lines = map { ' ' x ($max_space - length($line_number)) . '<span class="LineNumber">' . $line_number++ . '</span> ' . $_ } @lines;
lib/Apache/Syntax/Highlight/Perl.pm view on Meta::CPAN
The CSS file is used to define styles for all the syntactical elements that
L<Syntax::Highlight::Perl|Syntax::Highlight::Perl> currently recognizes.
For each style there is a correspondant syntactical element. The elements are:
=over 4
=item Comment_Normal
Default is C<{color:#006699;font-style:italic;}>
=item Comment_POD
Default is C<{color:#001144;font-family:garamond,serif;font-size:11pt;font-style:italic;}>
=item Directive
Default is C<{color:#339999;font-style:italic;}>
=item Label
Default is C<{color:#993399;font-style:italic;}>
=item Quote
Default is C<{color:#0000aa;}>
=item String
Default is C<{color:#0000aa;}>
=item Subroutine
lib/Apache/Syntax/Highlight/Perl.pm view on Meta::CPAN
=item Whitespace
Not yet used
=item Character
Default is C<{color:#880000;}>
=item Keyword
Default is C<{color:#000000; font-weight:bold;}>
=item Builtin_Function
Default is C<{color:#000000; font-weight:bold;}>
=item Builtin_Operator
Default is C<{color:#000000; font-weight:bold;}>
=item Operator
Default is C<{color:#000000;}>
=item Bareword
Default is C<{color:#33AA33;}>
=item Package
body {font-size:10pt; color:#333366;}
.Comment_Normal {color:#006699;font-style:italic;}
.Comment_POD {color:#AAAAAA;font-style:italic;}
.Directive {color:#339999;font-style:italic;}
.Label {color:#993399;font-style:italic;}
.Quote {color:#0000aa;}
.String {color:#0000aa;}
.Subroutine {color:#998800;}
.Variable_Scalar {color:#008800;}
.Variable_Array {color:#ff7700;}
.Variable_Hash {color:#8800ff;}
.Variable_Typeglob {color:#ff0033;}
.Whitespace {}
.Character {color:#880000;}
.Keyword {color:#000000; font-weight:bold;}
.Builtin_Function {color:#000000; font-weight:bold;}
.Builtin_Operator {color:#000000; font-weight:bold;}
.Operator {color:#000000;}
.Bareword {color:#33AA33;}
.Package {color:#990000;}
.Number {color:#ff00ff;}
.Symbol {color:#000000;}
.CodeTerm {color:#AA0000;}
.DATA {color:#AAAAAA;}
.LineNumber {color:#CCCCCC;}
( run in 0.658 second using v1.01-cache-2.11-cpan-5735350b133 )