On 12/22/05, Mike Orr <[EMAIL PROTECTED]> wrote:
> I'm fine with optional Kid preprocessors that cover over some of the 
> annoyances:
>
> #####
> <FOR expr="r in records" attr="value">     =>
>         <div py:for="r in records" attr="value">
>
> #####
> <FOR expr="r in records" tag="span" attr="value">   =>
>         <span py:for="r in records" attr="value">
>
> #####
> <?python <![CDATA[
>         is_insufficient = level < 100
> ]]> python>    =>
> <?python
>         is_insufficient = level &amp; 100
> ?>
>                 Although a more pleasant spelling for <![CDATA[ would
> be nice.  Maybe <?python-cdata ... ?>

A preprocessor that is not doing XML could look entirely different
(even Cheetah-like). But, something like what you're proposing would
likely be far easier to implement.

> #####
> That py:layout feature.
> http://lesscode.org/projects/kid/ticket/105

You can basically do that today using py:def.

http://lesscode.org/projects/kid/wiki/DefBasedLayoutTemplateRecipe

But, the syntax suggested in the ticket is a bit cleaner and easier
for that style of layout.

>
> #####
> Some kind of if/else.  I can't think of a fesasble way without two
> child elements though, and this may be worse than the original
> problem.
>
> <IFELSE expr="records">
>         <THEN>
>                 # Draw table.
>          </THEN>
>         <ELSE>
>                 <div><em>No records.</em></div>
>         </ELSE>
> </IFELSE>             =>
>
> <div py:if="records">
>         # Draw table
> </div>
> <div py:if="not (records)">
>         <div><em>No records.</em></div>
> </div>

I agree that if/else is tricky with an XML-ish syntax.

>
>
> > And py:match
> > is addictive when you use it (and, as far as I know, Cheetah has
> > nothing like it).
>
> No, but nobody has asked for it either.

I doubt anyone would ask for it... Cheetah knows nothing about
document structure, so it has nothing to match on. (Thus implementing
something like py:match for Cheetah would be difficult and go against
Cheetah's grain of just working with unstructured text) It's still a
useful feature!

py:match lets you do things like that py:layout feature without
putting *any* special markup in the individual pages (other than the
reference to the layout template, of course).

Kevin

Reply via email to