r4355 - in /packages/libtemplate-plugin-clickable-perl: ./ branches/
branches/upstream/ branches/upstream/current/
branches/upstream/current/lib/ branches/upstream/current/lib/Template/
branches/upstream/current/lib/Template/Plugin/ branches/upstream/current/t/
tags/
eloy at users.alioth.debian.org
eloy at users.alioth.debian.org
Thu Nov 23 14:55:30 CET 2006
Author: eloy
Date: Thu Nov 23 14:55:30 2006
New Revision: 4355
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=4355
Log:
[svn-inject] Installing original source of libtemplate-plugin-clickable-perl
Added:
packages/libtemplate-plugin-clickable-perl/
packages/libtemplate-plugin-clickable-perl/branches/
packages/libtemplate-plugin-clickable-perl/branches/upstream/
packages/libtemplate-plugin-clickable-perl/branches/upstream/current/
packages/libtemplate-plugin-clickable-perl/branches/upstream/current/Changes
packages/libtemplate-plugin-clickable-perl/branches/upstream/current/MANIFEST
packages/libtemplate-plugin-clickable-perl/branches/upstream/current/META.yml
packages/libtemplate-plugin-clickable-perl/branches/upstream/current/Makefile.PL
packages/libtemplate-plugin-clickable-perl/branches/upstream/current/README
packages/libtemplate-plugin-clickable-perl/branches/upstream/current/lib/
packages/libtemplate-plugin-clickable-perl/branches/upstream/current/lib/Template/
packages/libtemplate-plugin-clickable-perl/branches/upstream/current/lib/Template/Plugin/
packages/libtemplate-plugin-clickable-perl/branches/upstream/current/lib/Template/Plugin/Clickable.pm
packages/libtemplate-plugin-clickable-perl/branches/upstream/current/t/
packages/libtemplate-plugin-clickable-perl/branches/upstream/current/t/00_compile.t
packages/libtemplate-plugin-clickable-perl/branches/upstream/current/t/01_clickable.t
packages/libtemplate-plugin-clickable-perl/tags/
Added: packages/libtemplate-plugin-clickable-perl/branches/upstream/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libtemplate-plugin-clickable-perl/branches/upstream/current/Changes?rev=4355&op=file
==============================================================================
--- packages/libtemplate-plugin-clickable-perl/branches/upstream/current/Changes (added)
+++ packages/libtemplate-plugin-clickable-perl/branches/upstream/current/Changes Thu Nov 23 14:55:30 2006
@@ -1,0 +1,21 @@
+Revision history for Perl extension Template::Plugin::Clickable
+
+0.06 2006-02-20T04:54:28Z
+ - Added supporf of rel="nofollow"
+ (Thanks to Tokuhiro Matsuno)
+
+0.05 Fri Dec 24 04:08:14 JST 2004
+ - Added reference to TagRescue in POD
+ (Stephen Quinney, Satoshi Tanimoto)
+
+0.04 Wed Nov 12 02:24:56 JST 2003
+ * Added finder_class option, thanks to Tony Bowden
+
+0.03 Thu Nov 14 18:49:15 JST 2002
+ * Fixed memory leak due to Template::Plugin::Filter
+
+0.02 Sun Aug 18 19:04:30 JST 2002
+ - improved documentation
+
+0.01 Tue Apr 23 20:40:40 2002
+ - original version
Added: packages/libtemplate-plugin-clickable-perl/branches/upstream/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libtemplate-plugin-clickable-perl/branches/upstream/current/MANIFEST?rev=4355&op=file
==============================================================================
--- packages/libtemplate-plugin-clickable-perl/branches/upstream/current/MANIFEST (added)
+++ packages/libtemplate-plugin-clickable-perl/branches/upstream/current/MANIFEST Thu Nov 23 14:55:30 2006
@@ -1,0 +1,8 @@
+Changes
+MANIFEST
+Makefile.PL
+README
+lib/Template/Plugin/Clickable.pm
+t/00_compile.t
+t/01_clickable.t
+META.yml Module meta-data (added by MakeMaker)
Added: packages/libtemplate-plugin-clickable-perl/branches/upstream/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libtemplate-plugin-clickable-perl/branches/upstream/current/META.yml?rev=4355&op=file
==============================================================================
--- packages/libtemplate-plugin-clickable-perl/branches/upstream/current/META.yml (added)
+++ packages/libtemplate-plugin-clickable-perl/branches/upstream/current/META.yml Thu Nov 23 14:55:30 2006
@@ -1,0 +1,14 @@
+# http://module-build.sourceforge.net/META-spec.html
+#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
+name: Template-Plugin-Clickable
+version: 0.06
+version_from: lib/Template/Plugin/Clickable.pm
+installdirs: site
+requires:
+ Template: 2.07
+ Test::More: 0.32
+ UNIVERSAL::require: 0
+ URI::Find: 0.13
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.17
Added: packages/libtemplate-plugin-clickable-perl/branches/upstream/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libtemplate-plugin-clickable-perl/branches/upstream/current/Makefile.PL?rev=4355&op=file
==============================================================================
--- packages/libtemplate-plugin-clickable-perl/branches/upstream/current/Makefile.PL (added)
+++ packages/libtemplate-plugin-clickable-perl/branches/upstream/current/Makefile.PL Thu Nov 23 14:55:30 2006
@@ -1,0 +1,11 @@
+use ExtUtils::MakeMaker;
+WriteMakefile(
+ 'NAME' => 'Template::Plugin::Clickable',
+ 'VERSION_FROM' => 'lib/Template/Plugin/Clickable.pm', # finds $VERSION
+ 'PREREQ_PM' => {
+ 'Test::More' => 0.32,
+ 'Template' => 2.07,
+ 'URI::Find' => 0.13,
+ 'UNIVERSAL::require' => 0,
+ },
+);
Added: packages/libtemplate-plugin-clickable-perl/branches/upstream/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libtemplate-plugin-clickable-perl/branches/upstream/current/README?rev=4355&op=file
==============================================================================
--- packages/libtemplate-plugin-clickable-perl/branches/upstream/current/README (added)
+++ packages/libtemplate-plugin-clickable-perl/branches/upstream/current/README Thu Nov 23 14:55:30 2006
@@ -1,0 +1,52 @@
+NAME
+ Template::Plugin::Clickable - Make URLs clickable in HTML
+
+SYNOPSIS
+ [% USE Clickable %]
+ [% FILTER clickable %]
+ URL is http://www.tt2.org/
+ [% END %]
+
+ this will become:
+
+ URL is <a href="http://www.tt2.org/">http://www.tt2.org/</a>
+
+DESCRIPTION
+ Template::Plugin::Clickable is a plugin for TT, which allows you to
+ filter HTMLs clickable.
+
+OPTIONS
+ target
+ [% FILTER clickable target => '_blank' %]
+ [% message.body | html %]
+ [% END %]
+
+ "target" option enables you to set target attribute in A links. none
+ by default.
+
+ finder_class
+ "finder_class" option enables you to set other URI finder class
+ rather than URI::Find (default). For example,
+
+ [% FILTER clickable finder_class => 'URU::Find::Schemeless' %]
+ Visit www.example.com/join right now!
+ [% END %]
+
+ this will become:
+
+ Visit <a href="http://www.example.com/join">www.example.com/join</a> right now!
+
+NOTE
+ If you use this module with "html" filter, you should set this
+ "clickable" module after the "html" filter. Otherwise links will be also
+ escaped and thus broken.
+
+AUTHOR
+ Tatsuhiko Miyagawa <miyagawa at bulknews.net>
+
+ This library is free software; you can redistribute it and/or modify it
+ under the same terms as Perl itself.
+
+SEE ALSO
+ Template, URI::Find
+
Added: packages/libtemplate-plugin-clickable-perl/branches/upstream/current/lib/Template/Plugin/Clickable.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libtemplate-plugin-clickable-perl/branches/upstream/current/lib/Template/Plugin/Clickable.pm?rev=4355&op=file
==============================================================================
--- packages/libtemplate-plugin-clickable-perl/branches/upstream/current/lib/Template/Plugin/Clickable.pm (added)
+++ packages/libtemplate-plugin-clickable-perl/branches/upstream/current/lib/Template/Plugin/Clickable.pm Thu Nov 23 14:55:30 2006
@@ -1,0 +1,138 @@
+package Template::Plugin::Clickable;
+
+use strict;
+our $VERSION = 0.06;
+
+require Template::Plugin;
+use base qw(Template::Plugin);
+
+use vars qw($FILTER_NAME);
+$FILTER_NAME = 'clickable';
+
+use UNIVERSAL::require;
+
+sub new {
+ my($class, $context, @args) = @_;
+ my $name = $args[0] || $FILTER_NAME;
+ $context->define_filter($name, $class->filter_factory());
+ bless { }, $class;
+}
+
+sub filter_factory {
+ my $class = shift;
+ my $sub = sub {
+ my($context, @args) = @_;
+ my $config = ref $args[-1] eq 'HASH' ? pop(@args) : { };
+ return sub {
+ my $text = shift;
+ my $finder_class = $config->{finder_class} || 'URI::Find';
+ $finder_class->require or die $UNIVERSAL::require::ERROR;
+ my $finder = $finder_class->new(
+ sub {
+ my($uri, $orig_uri) = @_;
+ my $target = $config->{target} ? qq( target="$config->{target}") : '';
+ my $rel = $config->{rel} ? qq( rel="$config->{rel}") : '';
+ return qq(<a href="$uri"$target$rel>$orig_uri</a>);
+ },
+ );
+ $finder->find(\$text);
+ return $text;
+ };
+ };
+ return [ $sub, 1 ];
+}
+
+1;
+__END__
+
+=head1 NAME
+
+Template::Plugin::Clickable - Make URLs clickable in HTML
+
+=head1 SYNOPSIS
+
+ [% USE Clickable %]
+ [% FILTER clickable %]
+ URL is http://www.tt2.org/
+ [% END %]
+
+this will become:
+
+ URL is <a href="http://www.tt2.org/">http://www.tt2.org/</a>
+
+=head1 DESCRIPTION
+
+Template::Plugin::Clickable is a plugin for TT, which allows you to
+filter HTMLs clickable.
+
+=head1 OPTIONS
+
+=over 4
+
+=item target
+
+ [% FILTER clickable target => '_blank' %]
+ [% message.body | html %]
+ [% END %]
+
+C<target> option enables you to set target attribute in A links. none
+by default.
+
+=item finder_class
+
+C<finder_class> option enables you to set other URI finder class
+rather than URI::Find (default). For example,
+
+ [% FILTER clickable finder_class => 'URI::Find::Schemeless' %]
+ Visit www.example.com/join right now!
+ [% END %]
+
+this will become:
+
+ Visit <a href="http://www.example.com/join">www.example.com/join</a> right now!
+
+=back
+
+=head1 NOTE
+
+If you use this module with C<html> filter, you should be careful not
+to break tags or brackets around the URLs. For example if you have a
+following URL form,
+
+ <http://www.example.com/>
+
+Clickable plugin will filter this into:
+
+ <a href="http://www.example.com/"><http://www.example.com/></a>
+
+which is bad for HTML viewing. However, if you HTML filter them first
+and then clickable filter, you'll get:
+
+ <<a href="http://www.example.com/>">http://www.example.com/></a>;
+
+which href part is wrong.
+
+You'd better try L<Template::Plugin::TagRescue> in this case.
+
+ [% USE Clickable -%]
+ [% USE TagRescue -%]
+ [% FILTER html_except_for('a') -%]
+ [% FILTER clickable -%]
+ <http://www.example.com/>
+ [%- END %]
+ [%- END %]
+
+will give you the right format.
+
+=head1 AUTHOR
+
+Tatsuhiko Miyagawa E<lt>miyagawa at bulknews.netE<gt>
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=head1 SEE ALSO
+
+L<Template>, L<URI::Find>, L<Template::Plugin::TagRescue>
+
+=cut
Added: packages/libtemplate-plugin-clickable-perl/branches/upstream/current/t/00_compile.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libtemplate-plugin-clickable-perl/branches/upstream/current/t/00_compile.t?rev=4355&op=file
==============================================================================
--- packages/libtemplate-plugin-clickable-perl/branches/upstream/current/t/00_compile.t (added)
+++ packages/libtemplate-plugin-clickable-perl/branches/upstream/current/t/00_compile.t Thu Nov 23 14:55:30 2006
@@ -1,0 +1,4 @@
+use strict;
+use Test::More tests => 1;
+
+BEGIN { use_ok 'Template::Plugin::Clickable' }
Added: packages/libtemplate-plugin-clickable-perl/branches/upstream/current/t/01_clickable.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libtemplate-plugin-clickable-perl/branches/upstream/current/t/01_clickable.t?rev=4355&op=file
==============================================================================
--- packages/libtemplate-plugin-clickable-perl/branches/upstream/current/t/01_clickable.t (added)
+++ packages/libtemplate-plugin-clickable-perl/branches/upstream/current/t/01_clickable.t Thu Nov 23 14:55:30 2006
@@ -1,0 +1,35 @@
+use strict;
+use Template::Test;
+
+test_expect(\*DATA);
+
+__END__
+--test--
+[% USE Clickable -%]
+[% FILTER clickable -%]
+http://www.template-toolkit.org/
+[%- END %]
+--expect--
+<a href="http://www.template-toolkit.org/">http://www.template-toolkit.org/</a>
+
+--test--
+[% USE Clickable -%]
+[% FILTER clickable target => '_blank' -%]
+http://www.template-toolkit.org/
+http://www.template-toolkit.org/
+[%- END %]
+--expect--
+<a href="http://www.template-toolkit.org/" target="_blank">http://www.template-toolkit.org/</a>
+<a href="http://www.template-toolkit.org/" target="_blank">http://www.template-toolkit.org/</a>
+
+--test--
+[% USE Clickable -%]
+[% FILTER clickable target => '_blank', rel => 'nofollow' -%]
+http://www.template-toolkit.org/
+[%- END %]
+[% FILTER clickable rel => 'nofollow' -%]
+http://www.template-toolkit.org/
+[%- END %]
+--expect--
+<a href="http://www.template-toolkit.org/" target="_blank" rel="nofollow">http://www.template-toolkit.org/</a>
+<a href="http://www.template-toolkit.org/" rel="nofollow">http://www.template-toolkit.org/</a>
More information about the Pkg-perl-cvs-commits
mailing list