Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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 perl.com 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 perlmonks.org, 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 perlmonks.org killed HTML::Parser more often than not ;).


In reply to Re: syntax highlighting of code in perlmonks forums by Arguile
in thread syntax highlighting of code in perlmonks forums by aquarium

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2024-03-29 04:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found