HTML::Widget::Filter::HTMLStrip - HTML Strip Filter


HTML-Widget documentation Contained in the HTML-Widget distribution.

Index


Code Index:

NAME

Top

HTML::Widget::Filter::HTMLStrip - HTML Strip Filter

SYNOPSIS

Top

    my $f = $widget->filter( 'HTMLStrip', 'foo' )->allow( 'br', 'a' );

DESCRIPTION

Top

HTML Strip Filter.

METHODS

Top

allow

Accepts a list of HTML tags which shouldn't be stripped

filter

AUTHOR

Top

Lyo Kato, lyo.kato@gmail.com

LICENSE

Top

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


HTML-Widget documentation Contained in the HTML-Widget distribution.
package HTML::Widget::Filter::HTMLStrip;

use warnings;
use strict;
use base 'HTML::Widget::Filter';
use HTML::Scrubber;

__PACKAGE__->mk_accessors(qw/allow/);

sub filter {
    my ( $self, $value ) = @_;
    my $allowed = $self->allow || [];
    my $scrubber = HTML::Scrubber->new( allow => $allowed );
    return $scrubber->scrub($value);
}

1;