Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Feature Request: Adding Colors to Source Code

by castaway (Parson)
on Mar 06, 2004 at 21:45 UTC ( #334539=note: print w/ replies, xml ) Need Help??


in reply to Feature Request: Adding Colors to Source Code

Syntax::Highlight::Perl - but Im not sure its a good idea..

C.


Comment on Re: Feature Request: Adding Colors to Source Code
Replies are listed 'Best First'.
Re: Re: Feature Request: Adding Colors to Source Code
by Juerd (Abbot) on Mar 07, 2004 at 18:23 UTC

    Syntax::Highlight::Perl - but Im not sure its a good idea..

    I think it is a very good idea, as long as it is a user setting and done using CSS. I know I would love and enable the feature as soon as I can.

    Here is the code I use at http://tnx.nl/scribble.plp:

    perl => sub { require Syntax::Highlight::Perl; my ($data) = @_; my $hl = Syntax::Highlight::Perl->new; $hl->define_substitution( '<' => '&lt;', '>' => '&gt;', '&' => '&amp;', "\t" => '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb +sp;', ' ' => '&nbsp;', ); $hl->set_format( $_ => [ "<span class=$_>", "</span>" ] ) for qw/Comment Directive Label Quote String Subroutine + Variable Keyword Builtin Operator Package Number CodeTer +m Symbol DATA/; return '<link rel=stylesheet href="/perl.css"><pre>' . $hl->format_string($data) . '</pre>'; },
    I use this together with http://tnx.nl/perl.css. This code using this style sheet renders as http://tnx.nl/2240IXCX (link dies after 30 days).

    Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://334539]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (9)
As of 2015-07-30 09:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (270 votes), past polls