Re: Kanarie Template System
- Posted by Tommy Carlier <tommy.carlier at telenet.be> Aug 14, 2004
- 580 views
Juergen Luethje wrote: > In the previous example, my program must "fill out" the fields {text_en}, > {text_nl}, and {text_fr}. I think it would be nice and powerful, if > Kanarie would accept a file name, and then just 'includes' the content > of that file at that place. Then this example could look something like > this: > > <html> > <body> > {language=en:}{include=en.txt} > {:language=nl:}{include=nl.txt} > {:language=fr:}{include=fr.txt}{:language} > </body> > </html The new version (1.1) has an include-element, that you use like this: <html> <body> {language=en:}{$en.txt} {:language=nl:}{$nl.txt} {:language=fr:}{$fr.txt}{:language} </body> </html> > If you like, you could even allow 'en.txt' etc. not only to be plain > text files, but also template files themselves! That's a big step, it would involve recursive parsing & reading, and the Kanarie-parser is not really built for this kind of advanced handling. > Next step ... > Using the naming convention that I used for the files in the previous > example, it would be very cool IMHO, if we also could write something > like this, to achieve the same result: > > <html> > <body> > {include={language}.txt} > </body> > </html > > What do you think? :o) Again, the Kanarie-parser is not that advanced. > I will use Kanarie at least for generating HTML files, and as a > macro-system for Euphoria, for example in order to automatically > generate different code for different platforms (like in one of your > examples). I think also e.g. block comments in Eu code should be easy > to realize using Kanarie, shouldn't it? > > Kanarie is very simple and powerful at the same time, and IMHO its > possibilities are mainly limited by the fantasy of its users. > Thanks very much again, Tommy! I'm glad you like it. I designed KTS to be very simple to use, and not for a single task, but for things I myself haven't even thought about. > PS: I also thought of nested fields, but that probably makes things too > complicated ... I don't really understand what you mean with nested fields. You can nest lists and conditionals, because they are containers. But fields (and includes) are atomic: they have no children. You can download the new version from http://users.telenet.be/tommycarlier/eu I not only added include-elements, but also enhanced the documentation a bit. Juergen also sent me a modified version of the KTS-diagram picture, which I modified myself a bit. -- tommy online: http://users.telenet.be/tommycarlier Euphoria Message Board: http://uboard.proboards32.com