in reply to Template Toolkit "Pre-Processor"
From the syntax exmples in the docs it seems you only have to parse
[% PROCESS template var=val var=val ... %] [% INCLUDE template var=val var=val ... %]
Since there's no tag nesting, it can be done with regexes.
A first ad-hoc attempt, not tested:
my $re = qr{ \[%-? # start tag \s* (?:PROCESS|INCLUDE) \s+ (\S+) # template name .*? # any parameters you're not interested in -?%\] # end tag }xs;
Try if it matches all you need, if not refine it.
And yes, that's only an ad-hoc solution, and wo't scale very well.
(Update: template name is probably \S+, \w+ is too restrictive)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Template Toolkit "Pre-Processor"
by pc88mxer (Vicar) on Feb 29, 2008 at 16:11 UTC |