.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "HTML::Tidy 3pm" .TH HTML::Tidy 3pm "2014-08-15" "perl v5.20.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" HTML::Tidy \- (X)HTML validation in a Perl object .SH "VERSION" .IX Header "VERSION" Version 1.56 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use HTML::Tidy; \& \& my $tidy = HTML::Tidy\->new( {config_file => \*(Aqpath/to/config\*(Aq} ); \& $tidy\->ignore( type => TIDY_WARNING, type => TIDY_INFO ); \& $tidy\->parse( "foo.html", $contents_of_foo ); \& \& for my $message ( $tidy\->messages ) { \& print $message\->as_string; \& } .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\f(CW\*(C`HTML::Tidy\*(C'\fR is an \s-1HTML\s0 checker in a handy dandy object. It's meant as a replacement for HTML::Lint. If you're currently an HTML::Lint user looking to migrate, see the section \*(L"Converting from HTML::Lint\*(R". .SH "EXPORTS" .IX Header "EXPORTS" Message types \f(CW\*(C`TIDY_ERROR\*(C'\fR, \f(CW\*(C`TIDY_WARNING\*(C'\fR and \f(CW\*(C`TIDY_INFO\*(C'\fR. .PP Everything else is an object method. .SH "METHODS" .IX Header "METHODS" .SS "\fInew()\fP" .IX Subsection "new()" Create an HTML::Tidy object. .PP .Vb 1 \& my $tidy = HTML::Tidy\->new(); .Ve .PP Optionally you can give a hashref of configuration parms. .PP .Vb 1 \& my $tidy = HTML::Tidy\->new( {config_file => \*(Aqpath/to/tidy.cfg\*(Aq} ); .Ve .PP This configuration file will be read and used when you clean or parse an \s-1HTML\s0 file. .PP You can also pass options directly to tidyp. .PP .Vb 4 \& my $tidy = HTML::Tidy\->new( { \& output_xhtml => 1, \& tidy_mark => 0, \& } ); .Ve .PP See \f(CW\*(C`tidyp \-help\-config\*(C'\fR for the list of options supported by tidyp. .PP The following options are not supported by \f(CW\*(C`HTML::Tidy\*(C'\fR: .IP "\(bu" 4 quiet .SS "\fImessages()\fP" .IX Subsection "messages()" Returns the messages accumulated. .SS "\fIclear_messages()\fP" .IX Subsection "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 \&\fIparse()\fR you'll be accumulating more in the list. .SS "ignore( parm => value [, parm => value ] )" .IX Subsection "ignore( parm => value [, parm => value ] )" Specify types of messages to ignore. Note that the ignore flags must be set \fBbefore\fR calling \f(CW\*(C`parse()\*(C'\fR. You can call \f(CW\*(C`ignore()\*(C'\fR as many times as necessary to set up all your restrictions; the options will stack up. .IP "\(bu" 4 type => TIDY_INFO|TIDY_WARNING|TIDY_ERROR .Sp 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. .Sp .Vb 1 \& $tidy\->ignore( type => TIDY_WARNING ); .Ve .IP "\(bu" 4 text => qr/regex/ .IP "\(bu" 4 text => [ qr/regex1/, qr/regex2/, ... ] .Sp 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 \fItext\fR parm may be either a regex, or a reference to a list of regexes. .Sp .Vb 2 \& $tidy\->ignore( text => qr/DOCTYPE/ ); \& $tidy\->ignore( text => [ qr/unsupported/, qr/proprietary/i ] ); .Ve .ie n .SS "parse( $filename, $str [, $str...] )" .el .SS "parse( \f(CW$filename\fP, \f(CW$str\fP [, \f(CW$str\fP...] )" .IX Subsection "parse( $filename, $str [, $str...] )" Parses a string, or list of strings, that make up a single \s-1HTML\s0 file. .PP The \fI\f(CI$filename\fI\fR parm is only used as an identifier for your use. The file is not actually read and opened. .PP Returns true if all went \s-1OK,\s0 or false if there was some problem calling tidy, or parsing tidy's output. .ie n .SS "clean( $str [, $str...] )" .el .SS "clean( \f(CW$str\fP [, \f(CW$str\fP...] )" .IX Subsection "clean( $str [, $str...] )" Cleans a string, or list of strings, that make up a single \s-1HTML\s0 file. .PP Returns the cleaned string as a single string. .SH "INSTALLING TIDYP" .IX Header "INSTALLING TIDYP" \&\f(CW\*(C`HTML::Tidy\*(C'\fR requires that \f(CW\*(C`tidyp\*(C'\fR 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 . .ie n .SH "CONVERTING FROM ""HTML::Lint""" .el .SH "CONVERTING FROM \f(CWHTML::Lint\fP" .IX Header "CONVERTING FROM HTML::Lint" \&\f(CW\*(C`HTML::Tidy\*(C'\fR is different from \f(CW\*(C`HTML::Lint\*(C'\fR in a number of crucial ways. .IP "\(bu" 4 It's not pure Perl .Sp \&\f(CW\*(C`HTML::Tidy\*(C'\fR is mostly a happy wrapper around tidyp. .IP "\(bu" 4 The real work is done by someone else .Sp 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. .IP "\(bu" 4 It's no longer bundled with its \f(CW\*(C`Test::\*(C'\fR counterpart .Sp HTML::Lint came bundled with \f(CW\*(C`Test::HTML::Lint\*(C'\fR, but Test::HTML::Tidy is a separate distribution. This saves the people who don't want the \f(CW\*(C`Test::\*(C'\fR framework from pulling it in, and all its prerequisite modules. .SH "BUGS & FEEDBACK" .IX Header "BUGS & FEEDBACK" Please report any bugs or feature requests at the issue tracker on github . I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. .PP Please do \s-1NOT\s0 use . .SH "SUPPORT" .IX Header "SUPPORT" You can find documentation for this module with the perldoc command. .PP .Vb 1 \& perldoc HTML::Tidy .Ve .PP You can also look for information at: .IP "\(bu" 4 HTML::Tidy's issue queue at github .Sp .IP "\(bu" 4 AnnoCPAN: Annotated \s-1CPAN\s0 documentation .Sp .IP "\(bu" 4 \&\s-1CPAN\s0 Ratings .Sp .IP "\(bu" 4 search.cpan.org .Sp .IP "\(bu" 4 Git source code repository .Sp .SH "ACKNOWLEDGEMENTS" .IX Header "ACKNOWLEDGEMENTS" Thanks to Jonathan Rockway and Robert Bachmann for contributions. .SH "AUTHOR" .IX Header "AUTHOR" Andy Lester, \f(CW\*(C`\*(C'\fR .SH "COPYRIGHT & LICENSE" .IX Header "COPYRIGHT & LICENSE" Copyright (C) 2005\-2013 by Andy Lester .PP This library is free software. You mean modify or distribute it under the Artistic License v2.0.