Template-Plugin-HtmlToText-0.03000777000000000000 011052447516 17055 5ustar00unknownunknown000000000000Build.PL000444000000000000 104610507105323 20413 0ustar00unknownunknown000000000000Template-Plugin-HtmlToText-0.03use strict; use warnings; use Module::Build; my $builder = Module::Build->new( module_name => 'Template::Plugin::HtmlToText', license => 'perl', dist_author => 'Fayland Lam ', dist_version_from => 'lib/Template/Plugin/HtmlToText.pm', create_makefile_pl => 'traditional', build_requires => { 'Test::More' => 0, 'Template' => 0, 'HTML::TreeBuilder' => 0, 'HTML::FormatText' => 0, }, ); $builder->create_build_script(); 1;Changes000444000000000000 25410507105323 20372 0ustar00unknownunknown000000000000Template-Plugin-HtmlToText-0.03Revision history for Template-Plugin-HtmlToText 0.01 2006/8/31 better doc 0.01 Date/time First version, released on an unsuspecting world. Makefile.PL000444000000000000 113711052447516 21103 0ustar00unknownunknown000000000000Template-Plugin-HtmlToText-0.03# Note: this file was auto-generated by Module::Build::Compat version 0.2808_01 use ExtUtils::MakeMaker; WriteMakefile ( 'NAME' => 'Template::Plugin::HtmlToText', 'VERSION_FROM' => 'lib/Template/Plugin/HtmlToText.pm', 'PREREQ_PM' => { 'HTML::FormatText' => 0, 'HTML::TreeBuilder' => 0, 'Template' => 0, 'Test::More' => 0 }, 'INSTALLDIRS' => 'site', 'EXE_FILES' => [], 'PL_FILES' => {} ) ; MANIFEST000444000000000000 21710507105323 20227 0ustar00unknownunknown000000000000Template-Plugin-HtmlToText-0.03Build.PL Changes lib/Template/Plugin/HtmlToText.pm Makefile.PL MANIFEST META.yml # Will be created by "make dist" README t/00-load.t META.yml000444000000000000 106111052447516 20376 0ustar00unknownunknown000000000000Template-Plugin-HtmlToText-0.03--- name: Template-Plugin-HtmlToText version: 0.03 author: - 'Fayland Lam ' abstract: Plugin interface to HTML::FormatText license: perl resources: license: http://dev.perl.org/licenses/ build_requires: HTML::FormatText: 0 HTML::TreeBuilder: 0 Template: 0 Test::More: 0 provides: Template::Plugin::HtmlToText: file: lib/Template/Plugin/HtmlToText.pm version: 0.03 generated_by: Module::Build version 0.280801 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.2.html version: 1.2 README000444000000000000 277610507105323 20012 0ustar00unknownunknown000000000000Template-Plugin-HtmlToText-0.03Template-Plugin-HtmlToText The README is used to introduce the module and provide instructions on how to install the module, any machine dependencies it may have (for example C compilers and installed libraries) and any other information that should be provided before the module is installed. A README file is required for CPAN modules since CPAN extracts the README file from a module distribution so that people browsing the archive can use it get an idea of the modules uses. It is usually a good idea to provide version information here so that people can decide whether fixes for the module are worth downloading. INSTALLATION To install this module, run the following commands: perl Makefile.PL make make test make install SUPPORT AND DOCUMENTATION After installing, you can find documentation for this module with the perldoc command. perldoc Template::Plugin::HtmlToText You can also look for information at: Search CPAN http://search.cpan.org/dist/Template-Plugin-HtmlToText CPAN Request Tracker: http://rt.cpan.org/NoAuth/Bugs.html?Dist=Template-Plugin-HtmlToText AnnoCPAN, annotated CPAN documentation: http://annocpan.org/dist/Template-Plugin-HtmlToText CPAN Ratings: http://cpanratings.perl.org/d/Template-Plugin-HtmlToText COPYRIGHT AND LICENCE Copyright (C) 2006 Fayland Lam This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. lib000777000000000000 011052447516 17544 5ustar00unknownunknown000000000000Template-Plugin-HtmlToText-0.03Template000777000000000000 011052447516 21317 5ustar00unknownunknown000000000000Template-Plugin-HtmlToText-0.03/libPlugin000777000000000000 011052447516 22555 5ustar00unknownunknown000000000000Template-Plugin-HtmlToText-0.03/lib/TemplateHtmlToText.pm000444000000000000 316211052447376 25326 0ustar00unknownunknown000000000000Template-Plugin-HtmlToText-0.03/lib/Template/Pluginpackage Template::Plugin::HtmlToText; use strict; use vars qw( @ISA $VERSION ); use base qw( Template::Plugin ); use Template::Plugin; $VERSION = '0.03'; sub new { my ($class, $context, $arg) = @_; $context->define_filter('html2text', [ \&html2text => 1 ]); return \&tt_wrap; } sub html2text { my ($context, $args) = @_; return sub { my $html = shift; return $html unless ($html =~ m#(<|>)#s); require HTML::TreeBuilder; my $tree = HTML::TreeBuilder->new->parse($html); require HTML::FormatText; my $formatter = HTML::FormatText->new(%{$args}); my $text = $formatter->format($tree); return $text; } } 1; __END__ =head1 NAME Template::Plugin::HtmlToText - Plugin interface to HTML::FormatText =head1 SYNOPSIS Quick summary of what the module does. Perhaps a little code snippet. [% USE HtmlToText %] # use html2text FILTER to var 'myhtml' or 'myhtmltext' [% myhtml FILTER html2text(leftmargin => 0, rightmargin => 50) %] [% myhtmltext | html2text %] # not to a var, but to html code [% FILTER html2text %] heavy [% END %] [%# output is "heavy", no %] =head1 DESCRIPTION This plugin provides an interface to the HTML::FormatText module which format HTML as plaintext. =head1 AUTHOR Fayland Lam, C<< >> =head1 COPYRIGHT & LICENSE Copyright 2006 Fayland Lam, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut t000777000000000000 011052447516 17241 5ustar00unknownunknown000000000000Template-Plugin-HtmlToText-0.0300-load.t000444000000000000 14510507105322 20661 0ustar00unknownunknown000000000000Template-Plugin-HtmlToText-0.03/t#!perl -T use Test::More tests => 1; BEGIN { use_ok( 'Template::Plugin::HtmlToText' ); }