fergal sayeth:
If you want to avoid programming in your HTML files and you want HTML that can be previewed and editted in HTML tools then Petal is there already.
Your second point I agree with: Petal does maintain HTML that can be previewed and edited in HTML tools.
But I disagree with your first point. I think Petal allows for programming in HTML. Sure the syntax of the programming language looks a bit different, but it's still programming in my book. And in a previous post you literally said: "petal's loops" --- now since you said that Petal had loops and since loops are a programming construct, you can program in petal...
begin round two of fergal versus princepawn :) -- round one
took place here
condition
petal
<span tal:condition="true:user/is_authenticated">
Yo, authenticated!
</span>
tt
[% IF user.is_authenticated %]
Yo, authenticated!
[% END %]
seamstress
<div class="auth_dialog">
<span sid="authed">
Yo, authenticated!
</span>
<span sid="not_authed">
NOT authed
</span>
</div>
use html::auth_dialog;
my $tree = html::auth_dialog->new;
$tree->highlander
(auth_dialog =>
[
authed => sub { $_[0]->authenticated }
not_authed => sub { 1 }
],
$model
);
print $tree->as_HTML;
loop
petal
<tag tal:repeat="element_name EXPRESSION">
blah blah blah
</tag>
tt
[% FOREACH s IN EXPRESSION %]
* [% s %]
[% END %]
seamstress
There are a number of looping methods abstracted into
HTML::Element::Library for use with Seamstress in a disciplined
object-oriented fashion...
<div class="elemid">
blah blah blah
</div>
my $li = $tree->look_down(class => 'elemid');
my @items = qw(bread butter vodka);
$tree->iter($li => @items);
| [reply] [d/l] [select] |
Depends what you mean by "programming". You need more than conditionals and iteration of preexisting lists to be able to do general programming. Petal does not give you a turing complete language or anything like it. It simply gives you a way to render a perl data structure in HTML, adding the ability to render lists as repeated HTML and to conditionally drop certain sections of the template.
That is not programming. For example, the rendering is guaranteed to terminate and while it is possible to set variable and keep state, this is rarely done - the only time I'd ever do it would be to make a short way of referring data at the end of a very long path expression.
I guess it comes down to taste, I really like Petal's style of doing things.
| [reply] |