[Pharo-users] Fun with pillar and mustache

Norbert Hartl norbert at hartl.name
Thu May 21 16:07:48 EDT 2015


Guille,

thanks for revealing the secret project :) I can see what it is doing. I'll experiment a little more with my own stuff and then I can see what might match. At the moment ecstatic and cocoon appear to be rather file centric. My approach is doing everything in the image first and export it then to somewhere. So I need to learn what I need and then I'll need cocoon and such as exports to be able to do commandline generation. I'm sure we can exchange some ideas and code. The rest is open.

thanks again,

Norbert

> Am 21.05.2015 um 10:51 schrieb Guillermo Polito <guillermopolito at gmail.com>:
> 
> Hi!
> 
> Well, we have this secret really not mature project we started with stef a couple of weeks ago.
> 
> https://github.com/guillep/Ecstatic <https://github.com/guillep/Ecstatic>
> 
> For now it has some simple features:
>   - you open an image and it will start serving your site + regenerating it every couple of seconds (nice to debug and forget about running pillar commands)
>   - we made some themes based on the one I made for dbxtalk, the one from stef's personal website and esug website.
>   - we tried to push site configuration to the pillar.conf (title, menu/navigation information, author/contact info)
>   - another thing we wanted to push was the writing of plugins for the moment taking benefit from the [[[eval=true]]]. We were thinking however on making a special annotation for it. We have two really simple stupid "plugins", one that shows a list of news/blog feed, one that generates a list of publications based on a bib file using citezen.
> 
> I originally started this for the new dbxtalk site which is written basically in pillar.
> 
> http://dbxtalk.smallworks.eu/ <http://dbxtalk.smallworks.eu/>
> 
> You can see the source code of this site in here:
> 
> https://github.com/guillep/DBXTalk/tree/gh-pages <https://github.com/guillep/DBXTalk/tree/gh-pages>
> 
> Of course, there you will notice a lot of *workarounds* to make it work. I've made a list of those workarounds and sent them to Cyril to see if we can have better support for them in pillar.
> 
> I'd be pleased if you contribute and push it :). We have this trello board to add ideas and manage our backlog
> 
> https://trello.com/b/2t7qTWpp/ecstatic <https://trello.com/b/2t7qTWpp/ecstatic>
> 
> Guille
> 
> 
> El jue., 21 de may. de 2015 a la(s) 1:10 a. m., Cyril Ferlicot <cyril.ferlicot at gmail.com <mailto:cyril.ferlicot at gmail.com>> escribió:
> Guille asked me to add some feature for that, I added it to the TODO
> list of Pillar but I don't have the time to do it now.
> 
> On 21 May 2015 at 00:40, Norbert Hartl <norbert at hartl.name <mailto:norbert at hartl.name>> wrote:
> > 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 at free.fr <mailto:stepharo at 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
> >>>
> >>>
> >>>
> >>>
> >>
> >>
> >
> >
> 
> 
> 
> --
> Cheers
> Cyril Ferlicot
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/attachments/20150521/3f3c3fc5/attachment.html>


More information about the Pharo-users mailing list