dcsimg
StringTemplate: Standard Templates?
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Andreas_Mueller
Posted On:   Saturday, November 22, 2003 01:46 PM

Hi, I hope this is the proper group for this question. After reading the docs of StringTemplate is seems that everything "strives" to be covered by templates. For example, instead of a HTML $attr$ one would put that in a template "bold.st" and apply it as "$name:bold()$". Same with , and so on. In fact, everything in HTML could be put in templates, referencing each other, e.g. a "table()" would ref a "tableRow()" would ref a "tableData()". Beside the philosophical question if that makes sense and to which grade, my simple pratical question is if you have all these "HTML templates" already (from jGuru.com) and could mak   More>>

Hi,


I hope this is the proper group for this question.


After reading the docs of StringTemplate is seems that everything "strives" to be covered by templates. For example, instead of a HTML $attr$ one would put that in a template "bold.st" and apply it as "$name:bold()$". Same with , and so on. In fact, everything in HTML could be put in templates, referencing each other, e.g. a "table()" would ref a "tableRow()" would ref a "tableData()".


Beside the philosophical question if that makes sense and to which grade, my simple pratical question is if you have all these "HTML templates" already (from jGuru.com) and could make it available?


-- Andreas

   <<Less

Re: StringTemplate: Standard Templates?

Posted By:   Zenaan_Harkness  
Posted On:   Saturday, February 21, 2004 04:46 PM

Well, such templates, if you want them, are one-liners. It is instructional to write them yourself too - so you grok it better. Anyway, here are some examples from me, as a result of my going through the StringTemplates tutorial. I particularly like the mailto.st one-liner, as it is definitely simpler and shorter to use it, than to manually type out a link.


I would like to see a good full table example though - one that separately unrolls table data items for each row. Perhaps I just need to read the docs again?


Finally, at least in the version I downloaded (2.7.2), the facility to add an integer to the loop counter variable (i) does not work (nor does subtraction). To counter that, it starts at 1 rather than zero. But it seems a little limiting. I guess the "controller" code needs to implement such things if such variations are needed...


HTH,

Zen



$ cat b.st
$attr$

$ cat i.st
$attr$

$ cat link.st
$title$

$ cat mailto.st
$email$

$ cat oli.st
$i$. $attr$


$ cat td.st
$attr$

Re: StringTemplate: Standard Templates?

Posted By:   Terence_Parr  
Posted On:   Friday, February 6, 2004 03:29 PM

Hi. Just saw this post. Well, i really only broke out link and such. Bold was done inline.


Terence

About | Sitemap | Contact