.\" Automatically generated by Pod::Man 2.27 (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::Clean 3pm" .TH HTML::Clean 3pm "2014-05-25" "perl v5.18.2" "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::Clean \- Cleans up HTML code for web browsers, not humans .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& use HTML::Clean; \& $h = new HTML::Clean($filename); # or.. \& $h = new HTML::Clean($htmlcode); \& \& $h\->compat(); \& $h\->strip(); \& $data = $h\->data(); \& print $$data; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" The HTML::Clean module encapsulates a number of common techniques for minimizing the size of \s-1HTML\s0 files. You can typically save between 10% and 50% of the size of a \s-1HTML\s0 file using these methods. It provides the following features: .IP "Remove unneeded whitespace (beginning of line, etc)" 8 .IX Item "Remove unneeded whitespace (beginning of line, etc)" .PD 0 .IP "Remove unneeded \s-1META\s0 elements." 8 .IX Item "Remove unneeded META elements." .IP "Remove \s-1HTML\s0 comments (except for styles, javascript and \s-1SSI\s0)" 8 .IX Item "Remove HTML comments (except for styles, javascript and SSI)" .IP "Replace tags with equivalent shorter tags ( \-\-> )" 8 .IX Item "Replace tags with equivalent shorter tags ( --> )" .IP "etc." 8 .IX Item "etc." .PD .PP The entire process is configurable, so you can pick and choose what you want to clean. .SH "THE HTML::Clean CLASS" .IX Header "THE HTML::Clean CLASS" .ie n .SS "$h = new HTML::Clean($dataorfile, [$level]);" .el .SS "\f(CW$h\fP = new HTML::Clean($dataorfile, [$level]);" .IX Subsection "$h = new HTML::Clean($dataorfile, [$level]);" This creates a new HTML::Clean object. A Prerequisite for all other functions in this module. .PP The \f(CW$dataorfile\fR parameter supplies the input \s-1HTML,\s0 either a filename, or a reference to a scalar value holding the \s-1HTML,\s0 for example: .PP .Vb 3 \& $h = new HTML::Clean("/htdocs/index.html"); \& $html = "Hello!"; \& $h = new HTML::Clean(\e$html); .Ve .PP An optional 'level' parameter controls the level of optimization performed. Levels range from 1 to 9. Level 1 includes only simple fast optimizations. Level 9 includes all optimizations. .ie n .SS "$h\->initialize($dataorfile)" .el .SS "\f(CW$h\fP\->initialize($dataorfile)" .IX Subsection "$h->initialize($dataorfile)" This function allows you to reinitialize the \s-1HTML\s0 data used by the current object. This is useful if you are processing many files. .PP \&\f(CW$dataorfile\fR has the same usage as the new method. .PP Return 0 for an error, 1 for success. .ie n .SS "$h\->level([$level])" .el .SS "\f(CW$h\fP\->level([$level])" .IX Subsection "$h->level([$level])" Get/set the optimization level. \f(CW$level\fR is a number from 1 to 9. .ie n .SS "$myref = $h\->\fIdata()\fP" .el .SS "\f(CW$myref\fP = \f(CW$h\fP\->\fIdata()\fP" .IX Subsection "$myref = $h->data()" Returns the current \s-1HTML\s0 data as a scalar reference. .SS "strip(\e%options);" .IX Subsection "strip(%options);" Removes excess space from \s-1HTML\s0 .PP You can control the optimizations used by specifying them in the \&\f(CW%options\fR hash reference. .PP The following options are recognized: .IP "boolean values (0 or 1 values)" 8 .IX Item "boolean values (0 or 1 values)" .Vb 11 \& whitespace Remove excess whitespace \& shortertags \-> , etc.. \& blink No blink tags. \& contenttype Remove default contenttype. \& comments Remove excess comments. \& entities " \-> ", etc. \& dequote remove quotes from tag parameters where possible. \& defcolor recode colors in shorter form. (#ffffff \-> white, etc.) \& javascript remove excess spaces and newlines in javascript code. \& htmldefaults remove default values for some html tags \& lowercasetags translate all HTML tags to lowercase .Ve .IP "parameterized values" 8 .IX Item "parameterized values" .Vb 2 \& meta Takes a space separated list of meta tags to remove, \& default "GENERATOR FORMATTER" \& \& emptytags Takes a space separated list of tags to remove when there is no \& content between the start and end tag, like this: . \& The default is \*(Aqb i font center\*(Aq .Ve .PP Please note that if your \s-1HTML\s0 includes preformatted regions (this means, if it includes
...
, we do not suggest removing whitespace, as it will alter the rendered defaults. .PP HTML::Clean will print out a warning if it finds a preformatted region and is requested to strip whitespace. In order to prevent this, specify that you don't want to strip whitespace \- i.e. .PP .Vb 1 \& $h\->strip( {whitespace => 0} ); .Ve .SS "\fIcompat()\fP" .IX Subsection "compat()" This function improves the cross-platform compatibility of your \s-1HTML.\s0 Currently checks for the following problems: .IP "Insuring all \s-1IMG\s0 tags have \s-1ALT\s0 elements." 8 .IX Item "Insuring all IMG tags have ALT elements." .PD 0 .IP "Use of Arial, Futura, or Verdana as a font face." 8 .IX Item "Use of Arial, Futura, or Verdana as a font face." .IP "Positioning the <\s-1TITLE\s0> tag immediately after the tag." 8 .IX Item "Positioning the tag immediately after the <head> tag." .PD .SS "\fIdefrontpage()\fP;" .IX Subsection "defrontpage();" This function converts pages created with Microsoft Frontpage to something a Unix server will understand a bit better. This function currently does the following: .IP "Converts Frontpage 'hit counters' into a unix specific format." 8 .IX Item "Converts Frontpage 'hit counters' into a unix specific format." .PD 0 .IP "Removes some frontpage specific html comments" 8 .IX Item "Removes some frontpage specific html comments" .PD .SH "SEE ALSO" .IX Header "SEE ALSO" .SS "Modules" .IX Subsection "Modules" FrontPage::Web, FrontPage::File .SS "Web Sites" .IX Subsection "Web Sites" .IP "Distribution Site \- http://people.itu.int/~lindner/" 6 .IX Item "Distribution Site - http://people.itu.int/~lindner/" .SH "AUTHORS" .IX Header "AUTHORS" Paul Lindner for the International Telecommunication Union (\s-1ITU\s0) .SH "COPYRIGHT" .IX Header "COPYRIGHT" The HTML::Strip module is Copyright (c) 1998,99 by the \s-1ITU,\s0 Geneva Switzerland. All rights reserved. .PP You may distribute under the terms of either the \s-1GNU\s0 General Public License or the Artistic License, as specified in the Perl \s-1README\s0 file.