Re: Kanarie Template System

new topic     » goto parent     » topic index » view thread      » older message » newer message

Juergen Luethje wrote:
> In the Kanarie documentation you write, concerning the Conditionals
> example:
> "If the language-field is set to something different (or not set at all),
> none of the versions will be used."
> 
> What happens if a field is not set, or a list doesn't contain any items?
> It seems to me, that the corresponding entry in the template then also
> just will be skipped, but I'm not sure. Perhaps you can include that
> info in the documentation, too.

That's right: a field that is not set, and empty lists generate nothing. Will
add it to the documentation.

> If a "dummy list" in the template simply will be ignored by Kanarie,
> then this can be elegantly misused smile for creating block comments,
> e.g.:
> {comment:}
> This is a block comment, using the revolutionary Kanarie Template System.
> {:comment}

Great idea!

> Two more questions, for which I didn't find an answer in the
> documentation:
> It looks to me, as if the *names* of the fields, list items etc. are
> case insensitive, and the *values* of the fields, list items etc. are
> case sensitive. Is this true?

Yes it is. I think I might have to change it: it's not logical. What would be it
be: both case-sensitive or both case-insensitive?

> Generally speaking about redefinitions: Is it sufficient to redefine
> only the tag characters for 'open' and for 'close', because any other
> Kanarie tag characters are *inside* these characters?
> Redefining the other tag characters seems to me just "for optical
> reasons". Is this true?

True. Even the close-character doesn't need to be redefined: only the
open-character is essential to find a tag in text.

> Another idea. :o)
> How about an optional 'else' condition?
> Your language example then could look like this (using * to indicate
> 'else'):
> 
> <html>
>    <body>
>    {language=en:} This is the English version.
>    {:language=nl:} Dit is de Nederlandse versie.
>    {:language=fr:} Ceci est la version Fran=E7aise.
>    {:language=*:} Sorry, this language is currently not supported.{:langu=
> age}
>    </body>
> </html>

I like the idea. Just to make things simple, the =* isn't even necessary:
{lang=en:}en{:lang=nl:}nl{:lang=fr:}fr{:lang:}other{:lang}

> With nested fields, I mean that the *name* of field A depends on the
> *value* of field B, which is included in field A. With 'nested fields',
> we can achieve the same as above, by using a template like this:
> 
> <html>
>    <body>
>    {text_{language}}
>    </body>
> </html>

The current parser reads the file, and parses everything in one pass. I think
this requires recursive handling. And I think it would not make programming using
Kanarie any easier.
KISS: Keep It Simple, Sydney.

--
tommy online: http://users.telenet.be/tommycarlier
Euphoria Message Board: http://uboard.proboards32.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu