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
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to