GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
HTML::Clean(3) User Contributed Perl Documentation HTML::Clean(3)

HTML::Clean - Cleans up HTML code for web browsers, not humans

  use HTML::Clean;
  $h = HTML::Clean->new($filename); # or..
  $h = HTML::Clean->new($htmlcode);

  $h->compat();
  $h->strip();
  $data = $h->data();
  print $$data;

The HTML::Clean module encapsulates a number of common techniques for minimizing the size of HTML files. You can typically save between 10% and 50% of the size of a HTML file using these methods. It provides the following features:
Remove unneeded whitespace (begining of line, etc)
Remove unneeded META elements.
Remove HTML comments (except for styles, javascript and SSI)
Replace tags with equivilant shorter tags (<strong> --> <b>)
etc.

The entire proces is configurable, so you can pick and choose what you want to clean.

This creates a new HTML::Clean object. A Prerequisite for all other functions in this module.

The $dataorfile parameter supplies the input HTML, either a filename, or a reference to a scalar value holding the HTML, for example:

  $h = HTML::Clean->new("/htdocs/index.html");
  $html = "<strong>Hello!</strong>";
  $h = HTML::Clean->new(\$html);

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.

This function allows you to reinitialize the HTML data used by the current object. This is useful if you are processing many files.

$dataorfile has the same usage as the new method.

Return 0 for an error, 1 for success.

Get/set the optimization level. $level is a number from 1 to 9.

Returns the current HTML data as a scalar reference.

Removes excess space from HTML

You can control the optimizations used by specifying them in the %options hash reference.

The following options are recognized:

boolean values (0 or 1 values)
  whitespace    Remove excess whitespace
  shortertags   <strong> -> <b>, etc..
  blink         No blink tags.
  contenttype   Remove default contenttype.
  comments      Remove excess comments.
  entities      &quot; -> ", 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
    
parameterized values
  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: <b></b>.
              The default is 'b i font center'
    

This function improves the cross-platform compatibility of your HTML. Currently checks for the following problems:
Insuring all IMG tags have ALT elements.
Use of Arial, Futura, or Verdana as a font face.
Positioning the <TITLE> tag immediately after the <head> tag.

This function converts pages created with Microsoft Frontpage to something a Unix server will understand a bit better. This function currently does the following:
Converts Frontpage 'hit counters' into a unix specific format.
Removes some frontpage specific html comments

FrontPage::Web, FrontPage::File

Distribution Site - http://people.itu.int/~lindner/

Paul Lindner for the International Telecommunication Union (ITU)

Pavel Kuptsov <admin@modernperl.ru>

The HTML::Strip module is Copyright (c) 1998,99 by the ITU, Geneva Switzerland. All rights reserved.

You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.

2019-09-13 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.