Alternative version of HTML::Tidy
by Michael Houghton other posts by this author
Jan 30 2005 11:45AM messages near this date
view in the new Beta List Site
Re: Alternative version of HTML::Tidy
|
RE: Contents of Perl-XML Digest, Vol 12, Issue 18
& XSLT Hi all,
I've been using HTML Tidy extensively in a custom content management
system for about three and a half years, with an IPC::Open3 wrapper to
the tidy binary - a pre-libtidy solution that has served me quite well
until recently, when I concluded I needed some more speed, and slightly
more informative output.
I decided to switch to the HTML::Tidy CPAN module, but didn't find an
easy way to pass in configuration directives etc.
Having noted that the XS in HTML::Tidy is somewhat monolithic, I've
spent a little time writing a slightly more modular XS wrapper from
scratch. It seems to have been a useful way to learn XS if nothing
else, but it should be useful as the basis of more work.
The broad brush of the new API is as follows:
use HTML::Tidy::Simple;
$tidy = new HTML::Tidy::Simple(
input_file => $html_file, # or from string: input =>
$html
config_file => $cfg_file, # optionally specify a tidy
config file
config => { 'output-xhtml' => 'yes' } # optionally specify config
directives
);
my $status = $tidy-> status; # tidy processor status
my $result = $tidy-> result; # tidied result
my $errs = $tidy-> errors; # produces a hash of error
counts
# (AccessWarning, Warning,
Error, ConfigError)
my $errlog = $tidy-> error_log; # the HTML Tidy error log
It's my feeling that the API here is different enough to break
compatibility with HTML::Tidy - hence the name - but I felt I'd get
this out there anyway, and perhaps merge back into HTML::Tidy (if Mr
Lester is in agreement) at some point in the future.
I'm planning on submitting this new module to CPAN, but before I do
so, I'd like to ask if anyone could help me test it out. If you'd like
to, let me know by email.
I should have a version that is ready to be sent to people for testing
within the next day or so.
Thanks in advance
Mike Houghton
_______________________________________________
Perl-XML mailing list
Perl-XML@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
|