The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Solstice::StripScripts - A subclass of HTML::StripScripts that contains our customized whitelists

SYNOPSIS

  use Solstice::StripScripts;

DESCRIPTION

Superclass

HTML::StripScripts

Export

No symbols exported.

Functions

init_context_whitelist ()

Returns a reference to the Context whitelist, which determines which tags may appear at each point in the document, and which other tags may be nested within them.

It is a hash, and the keys are context names, such as Flow and Inline.

The values in the hash are hashrefs. The keys in these subhashes are lowercase tag names, and the values are context names, specifying the context that the tag provides to any other tags nested within it.

The special context EMPTY as a value in a subhash indicates that nothing can be nested within that tag.

init_attrib_whitelist ()

Returns a reference to the Attrib whitelist, which determines which attributes each tag can have and the values that those attributes can take.

It is a hash, and the keys are lowercase tag names.

The values in the hash are hashrefs. The keys in these subhashes are lowercase attribute names, and the values are attribute value class names, which are short strings describing the type of values that the attribute can take, such as color or number.

init_attval_whitelist ()

Returns a reference to the AttVal whitelist, which is a hash that maps attribute value class names from the Attrib whitelist to coderefs to subs to validate (and optionally transform) a particular attribute value.

The filter calls the attribute value validation subs with the following parameters:

filter

A reference to the filter object.

tagname

The lowercase name of the tag in which the attribute appears.

attrname

The name of the attribute.

attrval

The attribute value found in the input document, in canonical form (see "CANONICAL FORM").

The validation sub can return undef to indicate that the attribute should be removed from the tag, or it can return the new value for the attribute, in canonical form.

init_style_whitelist ()

Returns a reference to the Style whitelist, which determines which CSS style directives are permitted in style tag attributes. The keys are value names such as color and background-color, and the values are class names to be used as keys into the AttVal whitelist.

init_class_whitelist ()

Returns a reference to the Class whitelist, which determines which CSS class names are permitted in class tag attributes. The keys are the class names.

init_deinter_whitelist

Returns a reference to the DeInter whitelist, which determines which inline tags the filter should attempt to automatically de-interleave if they are encountered interleaved. For example, the filter will transform:

  <b>hello <i>world</b> !</i>

Into:

  <b>hello <i>world</i></b><i> !</i>

because both b and i appear as keys in the DeInter whitelist.

ATTRIBUTE VALUE HANDLER SUBS

References to the following subs appear in the AttVal whitelist returned by the init_attval_whitelist() method.

Private Functions

_hss_attval_style( FILTER, TAGNAME, ATTRNAME, ATTRVAL )

Attribute value hander for the style attribute.

_hss_attval_class( FILTER, TAGNAME, ATTRNAME, ATTRVAL )

Attribute value hander for the class attribute.

_hss_attval_size ( FILTER, TAGNAME, ATTRNAME, ATTRVAL )

Attribute value handler for attributes who's values are some sort of size or length.

_hss_attval_number ( FILTER, TAGNAME, ATTRNAME, ATTRVAL )

Attribute value handler for attributes who's values are a simple integer.

_hss_attval_color ( FILTER, TAGNAME, ATTRNAME, ATTRVAL )

Attribute value handler for color attributes.

_hss_attval_text ( FILTER, TAGNAME, ATTRNAME, ATTRVAL )

Attribute value handler for text attributes.

_hss_attval_word ( FILTER, TAGNAME, ATTRNAME, ATTRVAL )

Attribute value handler for attributes who's values must consist of a single short word, with minus characters permitted.

_hss_attval_wordlist ( FILTER, TAGNAME, ATTRNAME, ATTRVAL )

Attribute value handler for attributes who's values must consist of one or more words, separated by spaces and/or commas.

_hss_attval_wordlistq ( FILTER, TAGNAME, ATTRNAME, ATTRVAL )

Attribute value handler for attributes who's values must consist of one or more words, separated by commas, with optional doublequotes around words and spaces allowed within the doublequotes.

_hss_attval_href ( FILTER, TAGNAME, ATTRNAME, ATTRVAL )

Attribute value handler for href type attributes. If the AllowHref configuration option is set, uses the validate_href_attribute() method to check the attribute value.

_hss_attval_src ( FILTER, TAGNAME, ATTRNAME, ATTRVAL )

Attribute value handler for src type attributes. If the AllowSrc configuration option is set, uses the validate_src_attribute() method to check the attribute value.

_hss_attval_stylesrc ( FILTER, TAGNAME, ATTRNAME, ATTRVAL )

Attribute value handler for src type style pseudo attributes.

_hss_attval_novalue ( FILTER, TAGNAME, ATTRNAME, ATTRVAL )

Attribute value handler for attributes that have no value or a value that is ignored. Just returns the attribute name as the value.

Modules Used

HTML::StripScripts.

AUTHOR

Catalyst Group, <catalyst@u.washington.edu>

VERSION

$Revision: 3387 $

COPYRIGHT

Copyright 1998-2007 Office of Learning Technologies, University of Washington

Licensed under the Educational Community License, Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at: http://www.opensource.org/licenses/ecl1.php

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.