I have recently fallen heir to the maintenance of a large library of HTML -- 200+ modules, somewhere between 40K and 100K lines of text. The content is a mixture of Templates (using Andy Wardley's Template-toolkit modules), imbedded Perl, JavaScript, CGI (using CGI.pm), and native HTML tags.
Most of it is pretty readable, in the sense that there are syntax and indentation rules that are (usually) followed. But it can be a bit of a long slog to trace through. After searching through a particularly obfuscated piece of "code" (something that dense is certainly not 'text'), I got to thinking about reformatting the pages into something a little more user-friendy, or at least consistant.
Figuring that someone must have already sorted out this particular Wheel, I went off to search CPAN and Google-Space for HTML Reformatters and Pretty Printers, ala perltidy(1). So far I have found several promissing candidates. I am soliciting input and opinions.
- Hident (Possibly Ancient History, since the last time it was touched was 2001)
- HTML Tidy (also known Dave Raggett's HTML tidy, currently supported out of SourceForge)
- TidyPAS (The doc indicates that it will chew up HTML as well as Pascal, but also appears to be of more historical interest.)
- HTML::PrettyPrinter and HTML::TreeBuilder (Which will give me the most flexiblity if I have to brew something up to handle the Template Code correctly.)
- Several 'Text reformatter' packages that imply that they know what HTML is. (Absolutely the last resort.)
I have not included 'WebLint', 'HTML::Clean', 'HTML::Lint', etc, since my goal is to generate human (or at least Bear) readable text, rather than optimize my pages or validate the correctness of the tags. They will be useful tools, later in maintenance cycle, but they don't do what I want to do right now.
Have I missed anyone's favorite? Does anyone have opinions pro or con?
----
I Go Back to Sleep, Now.
OGB
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
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, details, 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, summary, 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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.