Template-Plugin-HTML-Strip-0.01/0000755000175000017500000000000010351443640020014 5ustar gsimmonsgsimmons00000000000000Template-Plugin-HTML-Strip-0.01/t/0000755000175000017500000000000010351443640020257 5ustar gsimmonsgsimmons00000000000000Template-Plugin-HTML-Strip-0.01/t/00_compile.t0000644000175000017500000000013110345511712022365 0ustar gsimmonsgsimmons00000000000000use strict; use Test::More tests => 1; BEGIN { use_ok 'Template::Plugin::HTML::Strip' } Template-Plugin-HTML-Strip-0.01/t/02_pod-coverage.t0000644000175000017500000000024410346705213023321 0ustar gsimmonsgsimmons00000000000000use Test::More; eval 'use Test::Pod::Coverage 1.00'; plan skip_all => 'Test::Pod::Coverage 1.00 required for testing POD coverage' if $@; all_pod_coverage_ok(); Template-Plugin-HTML-Strip-0.01/t/01_pod.t0000644000175000017500000000020210346705221021520 0ustar gsimmonsgsimmons00000000000000use Test::More; eval 'use Test::Pod 1.00'; plan skip_all => 'Test::Pod 1.00 required for testing POD' if $@; all_pod_files_ok(); Template-Plugin-HTML-Strip-0.01/t/03_output.t0000644000175000017500000000157710351435150022315 0ustar gsimmonsgsimmons00000000000000use strict; use Template::Test; test_expect(\*DATA); __END__ --test-- [% USE HTML.Strip -%] [% FILTER html_strip -%]

The power to enact removals has ultimately fallen into the wrong hands.

[%- END %] --expect-- The power to enact removals has ultimately fallen into the wrong hands. --test-- [% USE HTML.Strip 'strip' -%] [% FILTER strip -%] Even to remove attributes and their values!? [%- END %] --expect-- Even to remove attributes and their values!? --test-- [% USE HTML.Strip -%] [% FILTER html_strip striptags = [ 'strong' 'small' ] -%] Even their contents! I am afraid. [%- END %] --expect-- --test-- [% USE HTML.Strip -%] [% FILTER html_strip emit_spaces = 0 -%]

Istronglysuggestweleaveimmediately. [%- END %] --expect-- Istronglysuggestweleaveimmediately. Template-Plugin-HTML-Strip-0.01/lib/0000755000175000017500000000000010351443640020562 5ustar gsimmonsgsimmons00000000000000Template-Plugin-HTML-Strip-0.01/lib/Template/0000755000175000017500000000000010351443640022335 5ustar gsimmonsgsimmons00000000000000Template-Plugin-HTML-Strip-0.01/lib/Template/Plugin/0000755000175000017500000000000010351443640023573 5ustar gsimmonsgsimmons00000000000000Template-Plugin-HTML-Strip-0.01/lib/Template/Plugin/HTML/0000755000175000017500000000000010351443640024337 5ustar gsimmonsgsimmons00000000000000Template-Plugin-HTML-Strip-0.01/lib/Template/Plugin/HTML/Strip.pm0000644000175000017500000000470410351443353026004 0ustar gsimmonsgsimmons00000000000000package Template::Plugin::HTML::Strip; use 5.006; use strict; our $VERSION = '0.01'; use Template::Plugin::Filter; use base 'Template::Plugin::Filter'; use HTML::Strip; my $FILTER_NAME = 'html_strip'; sub init { my $self = shift; $self->{_DYNAMIC} = 1; $self->install_filter($self->{_ARGS}->[0] || $FILTER_NAME); return $self; } sub filter { my ($self, $text, undef, $config) = @_; $config = $self->merge_config($config); my $hs = HTML::Strip->new(%$config); return $hs->parse($text); } 1; __END__ =head1 NAME Template::Plugin::HTML::Strip - HTML::Strip filter for Template Toolkit =head1 SYNOPSIS [% USE HTML.Strip %] [% FILTER html_strip %] People for the Preservation of Presentational Markup

HTML::Strip - A cause for concern?

[% END %] [% USE HTML.Strip 'strip' striptags = [ 'script' 'iframe' ] emit_spaces = 0 %] [% FILTER strip %]

A call to arms against the removal of our elements!

[% END %] =head1 DESCRIPTION This module is a Template Toolkit dynamic filter, which uses HTML::Strip to remove markup (primarily HTML, but also SGML, XML, etc) from filtered content during template processing. By default, the installed filter's name is 'html_strip'. This can be changed by specifying a new name as the first positional argument during plugin usage: [% USE HTML.Strip 'strip' %] [% '
Our very existence is under threat.
' | strip %] The filter can optionally take configuration options, which will be passed to HTML::Strip's constructor method: [% USE HTML.Strip striptags = [ 'applet' 'strong' ] emit_spaces = 0 %] [% FILTER html_strip %] Are we next!? [% END %] For more details on available configuration options, please refer to L. =head1 METHODS =head2 init Creates a dynamic filter and installs the filter under the value provided for the first positional argument, otherwise uses 'html_strip'. =head2 filter Receives a reference to the plugin object, along with the text to be filtered and configuration options. Using HTML::Strip, returns the filtered (stripped) text. =head1 SEE ALSO L, L =head1 AUTHOR Geoff Simmons Egsimmons@cpan.orgE =head1 COPYRIGHT AND LICENSE Copyright (C) 2005 Geoff Simmons This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut Template-Plugin-HTML-Strip-0.01/README0000644000175000017500000000145310351443455020703 0ustar gsimmonsgsimmons00000000000000Template::Plugin::HTML::Strip version 0.01 ========================================== Template::Plugin::HTML::Strip implements a wrapper around the HTML::Strip module, providing a filter for removing presentation markup (eg. HTML) during template processing within Template Toolkit. INSTALLATION To install this module type the following: perl Makefile.PL make make test make install DEPENDENCIES This module requires these other modules and libraries: * HTML::Strip * Template * Template::Test * Test::More To complete further (optional) testing, these modules are required: * Test::Pod * Test::Pod::Coverage COPYRIGHT AND LICENCE Copyright (C) 2005 Geoff Simmons This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Template-Plugin-HTML-Strip-0.01/Changes0000644000175000017500000000020310351443562021305 0ustar gsimmonsgsimmons00000000000000Revision history for Perl extension Template::Plugin::HTML::Strip. 0.01 Mon Dec 19 16:38:40 EST 2005 - original version Template-Plugin-HTML-Strip-0.01/Makefile.PL0000644000175000017500000000114410351436131021763 0ustar gsimmonsgsimmons00000000000000use 5.006; use ExtUtils::MakeMaker; WriteMakefile( NAME => 'Template::Plugin::HTML::Strip', VERSION_FROM => 'lib/Template/Plugin/HTML/Strip.pm', # finds $VERSION PREREQ_PM => { 'Test::More' => 0.62, 'HTML::Strip' => 1.04, 'Template' => 2.14, 'Template::Test' => 2.70, }, ($] >= 5.005 ? ## Add these new keywords supported since 5.005 (ABSTRACT_FROM => 'lib/Template/Plugin/HTML/Strip.pm', # retrieve abstract from module AUTHOR => 'Geoff Simmons ') : ()), ); Template-Plugin-HTML-Strip-0.01/META.yml0000644000175000017500000000075710351443637021304 0ustar gsimmonsgsimmons00000000000000# http://module-build.sourceforge.net/META-spec.html #XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# name: Template-Plugin-HTML-Strip version: 0.01 version_from: lib/Template/Plugin/HTML/Strip.pm installdirs: site requires: HTML::Strip: 1.04 Template: 2.14 Template::Test: 2.7 Test::More: 0.62 distribution_type: module generated_by: ExtUtils::MakeMaker version 6.17 Template-Plugin-HTML-Strip-0.01/MANIFEST0000644000175000017500000000021310351441406021137 0ustar gsimmonsgsimmons00000000000000Changes MANIFEST META.yml Makefile.PL README lib/Template/Plugin/HTML/Strip.pm t/00_compile.t t/01_pod.t t/02_pod-coverage.t t/03_output.t