HTML::JFilter - module for filtering HTML
Version 0.1
based on HTML::Parser
use HTML::JFilter;
$filter = new HTML::JFilter <<'*END*'
b i code pre br
a: href name
font: color size style
*END*
$filteredHTML = $filter->doSTRING($enteredHTML);
$filter = new HTML::JFilter $allowedTags [, $removeComments]
Creates a new HTML::JFilter object.
The $allowedTags is a string that contains all allowed HTML tags and their allowed attributes. The format is:
tagname tagname tagname ....
tagname tagname : attribute attribute ...
# comment
tagname # comment
tagname ; comment
tagname ' comment
...
The $removeComments specifies whether to remove the comments in the HTML. The possible values are:
no - leave them alone
ssi - remove only the SSI ones
yes (or any other true value) - remove all comments
The default is ``yes''.
Returns the created object in case of success, die()s otherwise.
$filter->doFILE( $fromfile, $tofile);
Reads the contents of $fromfile, processes them and writes the result into $tofile.
Both $fromfile and $tofile may be either filenames of FILEHANDLEs or IO objects.
$result = $filter->doSTRING( $htmltext );
Processes the HTML in the variable and returns the result.
You can import all following functions to your namespace by use HTML:JParser qw(function_name). Otherwise you
have to specify the package name like this: HTML::JParser::function_name(...
print html_tag( $tagname, \%parameters);
This function returns a string containing the tag $tagname with all the %parameters properly quoted. Eg.
print html_tag( 'a', {href => q<JavaScript:Foo( "bar", 'baz' )>, target => '_blank'});
$tag = "<FOO bar=" . arg_escape( $argument ) . ">";
Returns the $argument quoted and escaped.
Jan Krynicky <Jenda@Krynicky.cz> http://Jenda.Krynicky.cz
Copyright (c) 2002 Jan Krynicky <Jenda@Krynicky.cz>. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.