METHODS

new()

This configuration file will be read and used when you clean or parse an HTML file.

You can also pass options directly to tidyp.

my $tidy = HTML::Tidy->new( {
output_xhtml => 1,
tidy_mark => 0,
} );

See tidyp -help-config for the list of options supported by tidyp.

The following options are not supported by HTML::Tidy:

quiet

messages()

Returns the messages accumulated.

clear_messages()

Clears the list of messages, in case you want to print and clear, print and clear. If you don't clear the messages, then each time you call parse() you'll be accumulating more in the list.

ignore( parm => value [, parm => value ] )

Specify types of messages to ignore. Note that the ignore flags must be set before calling parse(). You can call ignore() as many times as necessary to set up all your restrictions; the options will stack up.

type => TIDY_INFO|TIDY_WARNING|TIDY_ERROR

Specifies the type of messages you want to ignore, either info or warnings or errors. If you wanted, you could call ignore on all three and get no messages at all.

$tidy->ignore( type => TIDY_WARNING );

text => qr/regex/

text => [ qr/regex1/, qr/regex2/, ... ]

Checks the text of the message against the specified regex or regexes, and ignores the message if there's a match. The value for the text parm may be either a regex, or a reference to a list of regexes.

parse( $filename, $str [, $str...] )

The $filename parm is only used as an identifier for your use. The file is not actually read and opened.

Returns true if all went OK, or false if there was some problem calling tidy, or parsing tidy's output.

clean( $str [, $str...] )

Cleans a string, or list of strings, that make up a single HTML file.

Returns the cleaned string as a single string.

tidyp_version()

libtidyp_version()

Returns the version of the underling tidyp library.

INSTALLING TIDYP

HTML::Tidy requires that tidyp be installed on your system. You can obtain tidyp through your distribution's package manager (make sure you install the development package with headers), or from the tidyp Git repository at http://github.com/petdance/tidyp.

CONVERTING FROM HTML::Lint

HTML::Tidy is different from HTML::Lint in a number of crucial ways.

It's not pure Perl

HTML::Tidy is mostly a happy wrapper around tidyp.

The real work is done by someone else

Changes to tidyp may come down the pipe that I don't have control over. That's the price we pay for having it do a darn good job.

It's no longer bundled with its Test:: counterpart

HTML::Lint came bundled with Test::HTML::Lint, but Test::HTML::Tidy is a separate distribution. This saves the people who don't want the Test:: framework from pulling it in, and all its prerequisite modules.

BUGS & FEEDBACK

Please report any bugs or feature requests at the issue tracker on github http://github.com/petdance/html-tidy/issues. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

As a valued partner and proud supporter of MetaCPAN, StickerYou is
happy to offer a 10% discount on all Custom Stickers,
Business Labels, Roll Labels,
Vinyl Lettering or Custom Decals. StickerYou.com
is your one-stop shop to make your business stick.
Use code METACPAN10 at checkout to apply your discount.