Re: Kanarie Template System
- Posted by "Juergen Luethje" <j.lue at gmx.de> Aug 18, 2004
- 544 views
Tommy Carlier wrote: > Juergen Luethje wrote: <snip> >> If a "dummy list" in the template simply will be ignored by Kanarie, >> then this can be elegantly misused for creating block comments, >> e.g.: >> {comment:} >> This is a block comment, using the revolutionary Kanarie Template System. >> {:comment} > > Great idea! A slightly different kind of "block comments" can be used, in order to add documentation to source code, that can be saved (and printed or whatever) separately: ---------------------------------- global function ceil (object x) {mode=doc:} ceil is the opposite of floor(). x may be an atom or a sequence. {:mode=prog:} return -floor(-x) end function {:mode} ---------------------------------- AFAIK there is a program that does a similar job with special comments in Win32Lib source code. I think using Kanarie, this can be done in a general way. <snip> >> 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? In addition to my previous reply, I have another suggestion: How about an upper() and a lower() function built into Kanarie? See the following example: -----------[ demo.ex ]----------- include kanarie.e sequence template integer data data = createData() setValue(data, "animal", "hOrSE") template = loadTemplate("demo.knr") puts(1, generate(data, template)) closeData(data) -------------[ end ]------------- -----------[ demo.knr ]---------- {animal} {ANIMAL} {Animal} {ANiMAL} -------------[ end ]------------- The output is currently (KTS 1.2): hOrSE hOrSE hOrSE hOrSE Following my suggestion, the output would be: horse HORSE hOrSE hOrSE That is, if the field name is completely in lower/upper case, the output for that field also will be in lower/upper case. If the field name is *not completely* in lower or upper case, the case of the value of that field will not be changed. <snip> Regards, Juergen