Re: Kanarie Template System
- Posted by "Juergen Luethje" <j.lue at gmx.de> Aug 21, 2004
- 536 views
Tommy Carlier wrote: > Juergen Luethje wrote: <snip> >> How about an upper() and a lower() function built into Kanarie? <snip> >> 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. > > I wouldn't take it that far: it would limit the possibilities and add > little value. After having thought more about it, I do agree. Mostly, I would not need such a functionality myself, and it would force the user, to follow a rather unusual convention for creating field names. However, sooner or later I probably *will* need such a functionality. I admit, that my example with the {ANIMAL} field was not very convincing. When I'll have the time, I'll write a citation manager such as "Endnote" in Euphoria. Such a program helps authors of scientific papers tremendously in automatically and correctly formatting a list of cited works. Authors can use the program to maintain a reference database, and by selecting the appropriate Kanarie template, they can choose a bibliographic style according to the journal for which the paper is written. Then it sometimes will be necessary, that the Kanarie template is able to determine, that e.g. the family name of an author will be cited in upper case. But this is possible with Kanarie anyway. In my Euphoria program, I simply can maintain two versions of the family names, one version "as is", and the other version in upper case. The template then determines, which version will be used: -----------[ demo.ex ]----------- include kanarie.e sequence fName, template integer data data = createData() fName = "Smith" setValue(data, "family_name", fName) setValue(data, "FAMILY_NAME", upper(fName)) template = loadTemplate("demo.knr") puts(1, generate(data, template)) closeData(data) -------------[ end ]------------- -----------[ demo.knr ]---------- {family_name} {FAMILY_NAME} -------------[ end ]------------- To make a long story short: I want to thank you for the decision, to make the field names case-sensitive. I see now, that this is more than just following coding habits. Things like those mentioned above would also have been possible with case-insensitive field names, if course. Then the template above would have looked like this: -----------[ demo.knr ]---------- {family_name_as_is} {family_name_upper} -------------[ end ]------------- But case-sensitive field names allow choosing much nicer, and more intuitive names, and, generally speaking, there are much more possibilities for choosing a name, compared to case-insensitive names. Regards, Juergen