[Templates] how do I find all parsed tags?

Sean McAfee eefacm at gmail.com
Mon Jun 30 19:44:48 BST 2008


On Mon, Jun 30, 2008 at 11:15 AM, Blue Eyed Devil <
eyed_devil_blue at hotmail.com> wrote:

>   The reasons as to why a particular feature is desired/needed may not be
> evident until the need presents itself. This would be one of such times.
>
>  Maybe something along the lines (semi-pseudocode):
>
>  ...
>  my @all_tags = $parser->tags;
>  $output .= $_->new->execute() for @tags;
>

Just be aware that my solution gives you only the lexical content of the
tags, so that the tag [% FOO | html %] would be returned as "FOO | html",
not just "FOO".  And if you had a tag [% FOO; BAR; BAZ %], you'd get the
string "FOO; BAR; BAZ".  If you need to get at the actual semantics of the
document--for example, if you needed the three separate tags "FOO", "BAR",
and "BAZ" above--you'll need to roll your own code to get it, or find the
right place to hook into the existing framework.


--Sean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.template-toolkit.org/pipermail/templates/attachments/20080630/182cefdf/attachment.htm 


More information about the templates mailing list