[Templates] Template::Plugin::Clickable

[prev] [thread] [next] [Date index for 2004/12/23]

From: Stephen Quinney
Subject: [Templates] Template::Plugin::Clickable
Date: 12:34 on 23 Dec 2004
I am hoping someone here might be able to suggest a workaround for a
small problem I am having with the Clickable plugin. I want to filter
some text, e.g. the body of an email message to turn it into HTML and
make the embedded URLs into proper HTML links. The plugin does this
well with one gotcha, people often send URLs in the form:

<http://www.template-toolkit.org/>;

as suggested in RFC 2396 Appendix E.

URI::Find and the clickable plugin handle this form, but not quite as
I want them to.

[% USE Clickable -%]
[% FILTER clickable -%]
<http://www.template-toolkit.org/>;
[%- END %]

gives:

<a href="http://www.template-toolkit.org/"><http://www.template-toolkit.org/></a>;

so, the href is fine but there's those less-than, and greater-than
characters in the text, which is bad for HTML viewing.

If I HTML filter them first so the input text is effectively like:

&lt;http://www.template-toolkit.org/&gt;

I get this output:

&lt;<a href="http://www.template-toolkit.org/&gt">http://www.template-toolkit.org/&gt</a>;;

so the URL is now wrong.

If I did the Clickable filter and then filtered any special HTML
characters I would get something like:

&lt;a href=&quot;http://www.template-toolkit.org/&quot;&gt;&lt;http://www.template-toolkit.org/&gt;&lt;/a&gt;

Which I really do not want.

Any thoughts on how to get around this problem?

Thanks in advance,

Stephen Quinney

_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

[Templates] Template::Plugin::Clickable
Stephen Quinney 12:34 on 23 Dec 2004

Re: [Templates] Template::Plugin::Clickable
Perrin Harkins 16:04 on 23 Dec 2004

Re: [Templates] Template::Plugin::Clickable
Stephen Quinney 16:19 on 23 Dec 2004

Re: [Templates] Template::Plugin::Clickable
Tatsuhiko Miyagawa 18:57 on 23 Dec 2004

Re: [Templates] Template::Plugin::Clickable
Perrin Harkins 19:00 on 23 Dec 2004

Re: [Templates] Template::Plugin::Clickable
Tatsuhiko Miyagawa 19:06 on 23 Dec 2004

Re: [Templates] Template::Plugin::Clickable
Stephen Quinney 19:58 on 23 Dec 2004

Re: [Templates] Template::Plugin::Clickable
Tatsuhiko Miyagawa 06:52 on 24 Dec 2004

Generated at 08:56 on 15 Mar 2005 by mariachi v0.52