On 14/7/14 01:22, Norbert Hartl wrote:
Stef,
{{# â¦} opens a section that can be used to do nested operation. If the value of number is a collection the section is evaluated for every element in the value. #(1 2 3) is a collection of size 3 and '1 2 3' is a collection of size 5 hence the output. of course I was thinking that magically you would split the string :) Silly me.
I'm enhancing your blog with more details (I'm reading the mustache doc and your tests). https://ci.inria.fr/pharo-contribution/job/PharoForTheEnterprise/lastSuccess...
A common use case for templates would be something like
{ 'number' -> { 'value' -> 1. 'value' -> 2. 'value' -> 3 } asDictionary } asDictionary
Then you can use a template of
{{#number}} value is {{value}} {{/number}}
Norbert
Am 13.07.2014 um 23:33 schrieb stepharo <stepharo@free.fr <mailto:stepharo@free.fr>>:
Hi Norbert
I'm improving the doc. I added some text on section and others.. And on list with collection I have the following behavior and I do not understand why on string.
| templateString context | templateString := 'Shown. {{#number}} Shown too! {{/number}}'. context := { 'number' -> #(1 2 3) } asDictionary. (MustacheTemplate on: templateString) value: context 'Shown.
Shown too!
Shown too!
Shown too! '
| templateString context | templateString := 'Shown. {{#number}} Shown too! {{/number}}'. context := { 'number' -> '1 2 3' } asDictionary. (MustacheTemplate on: templateString) value: context 'Shown.
Shown too!
Shown too!
Shown too!
Shown too!
Shown too! '
On 11/7/14 10:53, Norbert Hartl wrote:
Am 11.07.2014 um 10:43 schrieb stepharo <stepharo@free.fr <mailto:stepharo@free.fr>>:
Hi guys
I would like to experiment with template for a small web project I have (my web page) and I would like to try mustache. Is there any tutorial? doc? I know that "jose maria aguerra" wrote a tutorial but I cannot find it anymore.
http://norbert.hartl.name/blog/2013/10/03/mustache-templates-for-smalltalk/
Norbert