Re: Kanarie Template System
Juergen Luethje wrote:
> 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}
Very nice. Not just for documenting, but also for other applications:
- Euphoria-code (generates the program to run): {app=exw:}...{:app}
- documentation: {app=doc:}...{:app}
- IDE design: {app=ide:}...{:app}
- ...
Each application can read the file and only extract what it needs.
> >> 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.
I wouldn't take it that far: it would limit the possibilities and add little
value.
--
tommy online: http://users.telenet.be/tommycarlier
Euphoria Message Board: http://uboard.proboards32.com
|
Not Categorized, Please Help
|
|