Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Apache::CVS is a mod_perl handler that provides a web interface to CVS repositories. It's distro includes a subclass, Apache::CVS::HTML, which outputs HTML instead of plain ole text. Perl::Tidy is the core of perltidy, a utility that indents and reformats Perl scripts, as well as provides an excellent syntax highlighter via HTML and CSS. Put the two together and you have a web interface to a CVS repository with syntax highlighting.
package Apache::CVS::Tidy; use strict; use warnings; use base qw(Apache::CVS::HTML); use Perl::Tidy; use CGI qw(start_html); sub print_page_header { my $self = shift; return if $self->page_headers_sent(); $self->request()->print(start_html( -title => 'CVS Repository', -style => { src => '/path/to/perltidy.css' }, )); $self->print_path_links(); $self->page_headers_sent(1); } sub print_text_revision { my ($self,$content) = @_; my $html; perltidy( source => \$content, destination => \$html, argv => '-html -npod -css=/path/to/perltidy.css', errorfile => '/dev/null', ); # big thanks to Beatnik for this little snippet # Apache::CVS::HTML double-spaces the code, this remedies that $html =~ s/\n\n/\n/g; $self->request()->print($html); } 1;

And an example stylesheet:

body {background: #fffff3; color: #35351d} pre { color: #35351d; background: #fffff3; font-family: courier; } a { color: #de022a;} th { background: gray; } .c { color: #777777;} /* comment */ .cm { color: #35351d;} /* comma */ .co { color: #35351d;} /* colon */ .h { color: #CD5555; font-weight:bold;} /* here-doc-target */ .hh { color: #0f6d30; font-style:italic;} /* here-doc-text */ .i { color: #2c2255;} /* identifier */ .j { color: #2c2255; font-weight:bold;} /* label */ .k { color: #8d6b5f; font-weight:bold;} /* keyword */ .m { color: #2c2255; font-weight:bold;} /* subroutine */ .n { color: #B452CD;} /* numeric */ .p { color: #35351d;} /* paren */ .pd { color: #228B22; font-style:italic;} /* pod-text */ .pu { color: #35351d;} /* punctuation */ .q { color: #0f6d30;} /* quote */ .s { color: #35351d;} /* structure */ .sc { color: #35351d;} /* semicolon */ .v { color: #B452CD;} /* v-string */ .w { color: #35351d;} /* bareword */

Last note: i use the -npod option in the argv argument for perltidy() - this prevents POD from being parsed by POD::HTML. Instead, POD is simply italicized, which makes for a faster processing time.

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

In reply to Apache::CVS::HTML + Perl::Tidy by jeffa

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others studying the Monastery: (4)
    As of 2015-07-05 15:42 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 (67 votes), past polls