Kenichi Ishigaki > HTML-Filter-Callbacks-0.05 > HTML::Filter::Callbacks::Tag

Download:
HTML-Filter-Callbacks-0.05.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Source   Latest Release: HTML-Filter-Callbacks-0.10

NAME ^

HTML::Filter::Callbacks::Tag

DESCRIPTION ^

This will be passed to the callbacks you add to the HTML::Filter::Callbacks object. See the SYNOPSIS of HTML::Filter::Callbacks for usage.

METHODS ^

new

creates an object.

set

used internally to initialize the object.

name

returns the tag name.

attr

takes an attribute name and returns the attribute value or undef if there's no attribute of the name.

text

returns any text (everything other than tags) before the tag. This typically returns white spaces between the tags for an open (start) tag, and the content of the tag for a close (end) tag, but don't count on that as HTMLs are not always well-structured.

You can replace the text by passing an extra argument.

add_attr

takes an attribute name and its value to add to the tag. If there's an attribute of the name, the value will be replaced.

remove_attr

takes an attribute name to remove. You can also pass a regular expression if you remove arbitrary attributes.

replace_attr

takes an attribute name and its value to replace. You can also pass a regular expression if you replace arbitrary attributes.

remove_tag

removes the tag entirely. Note that this only removes a start or end tag, not the pair. So you usually need to add another callback to remove the counterpart.

remove_text

removes the text before the tag.

remove_text_and_tag

removes both the text and the tag.

append

takes an HTML to insert after the tag. As of this writing, you need to escape the HTML by yourself if necessary.

prepend

takes an HTML to insert just before the tag, namely between the skipped text and the tag. As of this writing, you need to escape the HTML by yourself if necessary.

as_string

returns an HTML expression of the tag (with the skipped and inserted texts).

AUTHOR ^

Kenichi Ishigaki, <ishigaki@cpan.org>

COPYRIGHT AND LICENSE ^

Copyright (C) 2009 by Kenichi Ishigaki.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: