Graham TerMarsch > Template-Plugin-LinkTarget-0.02 > Template::Plugin::LinkTarget

Download:
Template-Plugin-LinkTarget-0.02.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.02   Source  

NAME ^

Template::Plugin::LinkTarget - TT filter to add "target" attribute to all HTML links

SYNOPSIS ^

  [% USE LinkTarget(target="_blank" exclude=['www.example.com']) %]
  ...
  [% FILTER linktarget %]
    <a href="http://www.google.com/">Google</a>
  [% END %]
  ...
  [% text | linktarget %]

DESCRIPTION ^

Template::Plugin::LinkTarget is a filter plugin for TT, which adds a target attribute to all HTML links found in the filtered text.

Through the use of the exclude option, you can specify URLs that are not given a new target attribute. This can be used to set up a filter that leaves internal links alone but that sets up external links to open in a new browser window. exclude accepts a list of regular expressions, so you can be as elaborate as you'd like.

The target option specifies what target you'd like to give to links, defaulting to "_blank".

METHODS ^

init()

Initializes the template plugin.

filter($text, $args, $conf)

Filters the given text, and adds the "target" attribute to links.

AUTHOR ^

Graham TerMarsch (cpan@howlingfrog.com)

COPYRIGHT ^

Copyright (C) 2008, Graham TerMarsch. All Rights Reserved.

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

SEE ALSO ^

Template::Plugin::Filter.

syntax highlighting: