Am 03.10.2013 um 22:42 schrieb Esteban A. Maringolo <emaringolo@gmail.com>:
> Excellent!
>
> Mustache is broadly used in the JS world (both web and node). I wonder
> what do you use it for.
>
At the moment mostly for generating SOAP requests :) But I often have template-like stuff for what I'm hacking something stupid together. I thought it should come to an end.
> I'd love an extension to the syntax to deal with JSON like structures
> (it is scalars, arrays and dictionaries). :)
>
What have those to do with the syntax? Can you elaborate on that?
Norbert
>
>
>
>
> Esteban A. Maringolo
>
>
> 2013/10/3 Norbert Hartl <norbert@hartl.name>:
>> I like to announce my smalltalk port of mustache templates.
>>
>> Mustache is a popular templating engine that is supported in many
>> programming languages. I know at least that is quite common to be used in
>> javascript but see at the languages it supported yourself [1].
>>
>> A basic usage is something like (just paste it to workspace after loading
>> Mustache):
>>
>> ---
>> templateString := 'Hello {{name}},
>> this is {{templatingEngine}} for {{recipient}}.
>> {{# cheerUp }}
>> Have fun!
>> {{/ �cheerUp }}'.
>>
>> context := {
>> 'name' -> 'pharo community'.
>> 'templatingEngine' -> 'mustache'.
>> 'recipient' -> 'you'.
>> 'cheerUp' -> true } asDictionary.
>> templateString asMustacheTemplate value: context
>> ---
>>
>> Context objects can be Dictionaries or regular objects. It is also easy to
>> feed via json e.g. using NeoJSON
>>
>> templateString asMustacheTemplate value: (NeoJSONReader fromString: �)
>>
>> I wrote a blog article about it and the usage in smaltlalk on my blog [2].
>> The code I have just released on smalltalkhub [3]. Documentation about the
>> syntax to use is available under [4]. To load it do
>>
>> Gofer it
>> smalltalkhubUser: 'NorbertHartl' project: 'Mustache';
>> configurationOf: 'Mustache';
>> loadStable.
>>
>> The code is not very old so there might be bugs (this is supposed to be the
>> standard disclaimer). If you find something not working as expected just
>> drop me a note. The engine produces at the moment more whitespaces than you
>> can see in the examples. I need to figure out the rule first and will
>> release a new version. Nevertheless I consider it useful by now. But you
>> decide and hopefully give me feedback.
>>
>> Norbert
>>
>> [1] http://mustache.github.io/
>> [2]
>> http://norbert.hartl.name/blog/2013/10/03/mustache-templates-for-smalltalk/
>> [3] http://smalltalkhub.com/#!/~NorbertHartl/Mustache
>> [4] http://mustache.github.io/mustache.5.html
>