Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: syntax highlighting of code in perlmonks forums

by Arguile (Hermit)
on Jun 10, 2003 at 05:44 UTC ( #264545=note: print w/replies, xml ) Need Help??

in reply to syntax highlighting of code in perlmonks forums

I’d strongly disagree with doing this within the monastery for a ton of reasons, most already hashed out in other posts. That said, I used to see the code sections syntax highlighted.

Well before this site became nicer with XML and CSS support nashdj created pmproxy2 as a rewriting proxy to create his own themes.

I stumbled across Perl::Syntax::Highlight and thought it would be cool to add syntax highlighting to his rewriting proxy. After a bit of work, it provided CSS control over each type of code element. It worked well for my needs at the time, but it has its issues.

Update: Heh, I found some old screenshots from it. Here, here, and one from rewriting here.

Now that the site is cleaner (XML, CSS, etc.), I’ve been meaning to rewrite it properly. I have a framework using XML::SAX and Apache + mod_perl started if you’d be interested in continuing it.

Basically it rewrites the documents using event based rules; calling either XSLT or Perl filters. Using the value of the host header to rewrite URIs to point back to it instead of, adding syntax highlighting to stand alone code sections and javascript controls to turn the CSS behind them on and off for each section, etc.

The framework and a bunch of the event handler are there, I just don’t really care enough about syntax highlighting anymore to finish it (the new custom CSS feature on the site is enough for me). So if you’re interested either check out the original pmproxy2 or I can email you the code (it’s way to many modules and snippets to post here).

The old code may suit your needs with few changes to the regexps. Parsing HMTL with regexps isn’t great, but the old killed HTML::Parser more often than not ;).

  • Comment on Re: syntax highlighting of code in perlmonks forums

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://264545]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2018-05-20 18:05 GMT
Find Nodes?
    Voting Booth?