Good. I would be pleased if you could show me what you've done so far so I don't waste time on things already solved. Norbert
Am 21.05.2015 um 00:03 schrieb stepharo <stepharo@free.fr>:
We did the same with guillermo but we are bullet profing the code before announcing it.
Stef
Le 20/5/15 21:45, Norbert Hartl a écrit :
I've found some minutes today to play with pillar and mustache. I wanted to know how far I can go when doing some static site generation. The exercise was to simulate a page that has multiple components either in mustache or pillar format. I could do this
| masterTemplate masterPillar masterDocument partialPillar partialTemplate finalPillar |
masterTemplate := '<master> <head>{{{title}}}</head> <masterContent> {{{content}}} </masterContent> </master>'.
masterPillar := '{{title: This is the title of the master!}} !masterheading
This text is contained in the master pillar template
{{{{{>phase2Template}}}}}'.
partialPillar := '!{{{{{{title}}}}}}
Some text in the partial template before the content...
{{{{{{content}}}}}}}
... and after'.
finalPillar := 'I''m a text in pillar format that was inserted in a partial mustache template generated from pillar that was inserted in a mustache master template in pillar format that was inserted in a master mustache template'.
masterDocument := PRDocumentParser parse: masterPillar readStream.
partialTemplate := PRHTMLWriter write: (PRDocumentParser parse: partialPillar readStream).
phase1Result := masterTemplate asMustacheTemplate value: masterDocument properties, { 'content' -> (PRHTMLWriter write: masterDocument) } asDictionary.
phase2Result := phase1Result asMustacheTemplate value: { 'title' -> 'A partial title'. 'content' -> (PRHTMLWriter write: (PRDocumentParser parse: finalPillar readStream)) } asDictionary partials: { 'phase2Template' -> partialTemplate } asDictionary.
and got
<master> <head>This is the title of the master!</head> <masterContent> <h1>masterheading</h1> <p>This text is contained in the master pillar template</p> <p><h1>A partial title</h1> <p>Some text in the partial template before the content...</p> <p><p>I'm a text in pillar format that was inserted in a partial mustache template generated from pillar that was inserted in a mustache master template in pillar format that was inserted in a master mustache template</p>}</p> <p>... and after</p></p> </masterContent> </master>
That is really cool. Actually pillar and mustache are a good match.
FYI,
Norbert