Steven Armstrong ha scritto:
The cool thing about default="whatever" is that you can (mis)use it to mark slots as optional.
IMHO it makes the render="mapping" functionality even more powerfull.
Yes, +1 for the defaulting functionality: tremendously useful, makes for more elegant templates and code.
But I like more the syntax suggested by srid for specifying the default:
+ more similar to what other popular templating languages do, XSLT for one but also some java-based I think + makes templates more useful when looked at in a browser by themselves (w/o nevow rendering), when testing the l'n'f
just my .02
ciao ste
Stefano Debenedetti wrote:
But I like more the syntax suggested by srid for specifying the default:
- more similar to what other popular templating languages do, XSLT for
one but also some java-based I think
- makes templates more useful when looked at in a browser by themselves
(w/o nevow rendering), when testing the l'n'f
The problem with that is that a lot of existing templates already use <n:slot name="foo">Stuff for the web monkey to see</n:slot>, and you certainly don't want that to be the default.
Also, I'd imagine it's a valid use case to want to see some "example data" in the template, when viewed directly, and still set the default to something else.
<p class="person"> <n:slot name="fullname" default="MISSING">John Doe</n:slot> </p>
The biggest downside with the default="foo" syntax is its inability to do non-strings.
Taking all of the above into consideration, I'd suggest something like
<p class="person"> <n:slot name="fullname"> <n:slotdefault>MISSING</n:slotdefault> John Doe </n:slot> </p>
and possibly also allow the default="MISSING", to make simple case simple.
On Mar 3, 2005, at 3:40 PM, Tommi Virtanen wrote:
The problem with that is that a lot of existing templates already use <n:slot name="foo">Stuff for the web monkey to see</n:slot>, and you certainly don't want that to be the default.
Also, I'd imagine it's a valid use case to want to see some "example data" in the template, when viewed directly, and still set the default to something else.
If that's a requirement, I don't think your proposed syntax will do it, because the webmonkey will see both MISSING *and* John Doe. If that's not a requirement (and I personally don't think it needs to be, but as I don't do much webmonkeying, could be convinced otherwise), a much simpler solution is to do <n:slot name="fullname" allowDefault="true">MISSING</n:slot>. That also has the advantage of not breaking any current code and allowing arbitrary default contents.
James
James Y Knight wrote:
If that's a requirement, I don't think your proposed syntax will do it, because the webmonkey will see both MISSING *and* John Doe. If that's not a requirement (and I personally don't think it needs to be, but as I don't do much webmonkeying, could be convinced otherwise), a much
You have a point there. I always forget the ugliness that is HTML. Also, I don't see _any_ way to hide the default from the webmonkey, except for CSS :(
simpler solution is to do <n:slot name="fullname" allowDefault="true">MISSING</n:slot>. That also has the advantage of not breaking any current code and allowing arbitrary default contents.
Gag. Make XML tags lowercase only, please. Just default="true"?