The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.


Template::Plugin::Clickable - Make URLs clickable in HTML


  [% USE Clickable %]
  [% FILTER clickable %]
  URL is
  [% END %]

this will become:

  URL is <a href=""></a>


Template::Plugin::Clickable is a plugin for TT, which allows you to filter HTMLs clickable.


  [% FILTER clickable target => '_blank' %]
  [% message.body | html %]
  [% END %]

target option enables you to set target attribute in A links. none by default.


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 right now!
  [% END %]

this will become:

  Visit <a href=""></a> right now!


If you use this module with html filter, you should be careful not to break tags or brackets around the URLs. For example if you have a following URL form,


Clickable plugin will filter this into:

  <a href=""><></a>

which is bad for HTML viewing. However, if you HTML filter them first and then clickable filter, you'll get:

  &lt;<a href=""></a>;

which href part is wrong.

You'd better try Template::Plugin::TagRescue in this case.

  [% USE Clickable -%]
  [% USE TagRescue -%]
  [% FILTER html_except_for('a') -%]
  [% FILTER clickable -%]
  [%- END %]
  [%- END %]

will give you the right format.


Tatsuhiko Miyagawa <>

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


Template, URI::Find, Template::Plugin::TagRescue