|
NAMESyntax::Highlight::HTML - Highlight HTML syntaxVERSIONVersion 0.04SYNOPSISuse Syntax::Highlight::HTML; my $highlighter = new Syntax::Highlight::HTML; $output = $highlighter->parse($html); If $html contains the following HTML fragment: <!-- a description list --> <dl compact="compact"> <dt>some word</dt> <dd>the description of the word. Plus some <a href="/definitions/other_word" >reference</a> towards another definition. </dd> </dl> then the resulting HTML contained in $output will render like this: DESCRIPTIONThis module is designed to take raw HTML input and highlight it (using a CSS stylesheet, see "Notes" for the classes). The returned HTML code is ready for inclusion in a web page.It is intented to be used as an highlighting filter, and as such does not reformat or reindent the original HTML code. METHODS
Example To avoid surrounding the result by the "<pre>...</pre>" tags: my $highlighter = Syntax::Highlight::HTML->new(pre => 0);
Internals MethodsThe following methods are for internal use only.
NOTESThe resulting HTML uses CSS to colourize the syntax. Here are the classes that you can define in your stylesheet.
An example stylesheet can be found in eg/html-syntax.css. EXAMPLEHere is an example of generated HTML output. It was generated with the script eg/highlight.pl.The following HTML fragment (which is the beginning of <http://search.cpan.org/~saper/>) <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="stylesheet" href="/s/style.css" type="text/css"> <title>search.cpan.org: Sébastien Aperghis-Tramoni</title> </head> <body id="cpansearch"> <center><div class="logo"><a href="/"><img src="/s/img/cpan_banner.png" alt="CPAN"></a></div></center> <div class="menubar"> <a href="/">Home</a> · <a href="/author/">Authors</a> · <a href="/recent">Recent</a> · <a href="/news">News</a> · <a href="/mirror">Mirrors</a> · <a href="/faq.html">FAQ</a> · <a href="/feedback">Feedback</a> </div> <form method="get" action="/search" name="f" class="searchbox"> <input type="text" name="query" value="" size="35"> <br>in <select name="mode"> <option value="all">All</option> <option value="module" >Modules</option> <option value="dist" >Distributions</option> <option value="author" >Authors</option> </select> <input type="submit" value="CPAN Search"> </form> will be rendered like this (using the CSS stylesheet eg/html-syntax.css): CAVEATS"Syntax::Highlight::HTML" relies on "HTML::Parser" for parsing the HTML and therefore suffers from the same limitations.SEE ALSOHTML::ParserAUTHORSSébastien Aperghis-Tramoni, <sebastien@aperghis.net>BUGSPlease report any bugs or feature requests to "bug-syntax-highlight-html@rt.cpan.org", or through the web interface at <https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Syntax-Highlight-HTML>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.COPYRIGHT & LICENSECopyright (C)2004 Sébastien Aperghis-Tramoni, All Rights Reserved.This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Visit the GSP FreeBSD Man Page Interface. |