On 2012-11-13 07:12, Aristotle Pagaltzis wrote:
> * Brian Katzung <
bri...@kappacs.com> [2012-10-09 21:10]:
>> Absolutely bare-bones syntax (it is my hope that even non-programmer
>> users (with some limited training) can edit templates)
>
> Looking at your docs, to be frank, I don’t think you succeed at this
> one. In my experience, non-programmers do best with Template Toolkit
> syntax that limits itself to the most basic features, i.e. basically
> Template::Simple or Template::Tiny. Function calls like you have are
> programming, and punctuation-heavy syntax scares them. Of course, if
> you administer training, you will overcome this to some extent, thus
> maybe for your own purposes TemplateLite’s misses in this department
> are not apparent.
>
> Regards
Thank you for your note, Aristotle.
Here's what I would consider a typical use case for Text::TemplateLite:
"nicely" displaying the number of matches returned by a query using
Template and Text::TemplateLite:
# The Template Toolkit template:
my $tt_tpl = q{Your search returned [% IF m == 0 %]no matches[%
ELSIF m == 1 %]1 match[% ELSE %][% m %] matches[% END %].};
# The Text::TemplateLite template:
my $tl_tpl = q{Your search returned <<??(=($m, 0), 'no matches',
=($m, 1), '1 match', $m' matches')>>.};
# (Substitute "ifel" for "??" if desired)
From reading the docs, I don't see how to do this at all using
Template::Simple, and Template::Tiny doesn't like the conditionals (per
its documentation, and confirmed in my testing).
I would say that "if condition/elsif condition/else/end" is programming
too, and it looks to me like there's plenty of punctuation to go around.
The T:TL syntax has the benefit of being easily "balance"-checkable in
an editor such as vim.
I'm expecting that most users will use an existing template as a
prototype, and that the remaining users won't be too shaken by a syntax
I believe is pretty close to a spreadsheet cell formula. I guess time
will tell. :-)