Fun with pillar and mustache

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Fun with pillar and mustache

NorbertHartl
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


Reply | Threaded
Open this post in threaded view
|

Re: Fun with pillar and mustache

stepharo
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
>
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Fun with pillar and mustache

NorbertHartl
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 <[hidden email]>:
>
> 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
>>
>>
>>
>>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Fun with pillar and mustache

CyrilFerlicot
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 <[hidden email]> 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 <[hidden email]>:
>>
>> 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

Reply | Threaded
Open this post in threaded view
|

Re: Fun with pillar and mustache

Guillermo Polito
Hi!

Well, we have this secret really not mature project we started with stef a couple of weeks ago.


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.


You can see the source code of this site in here:


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


Guille


El jue., 21 de may. de 2015 a la(s) 1:10 a. m., Cyril Ferlicot <[hidden email]> 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 <[hidden email]> 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 <[hidden email]>:
>>
>> 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

Reply | Threaded
Open this post in threaded view
|

Re: Fun with pillar and mustache

NorbertHartl

Am 21.05.2015 um 10:51 schrieb Guillermo Polito <[hidden email]>:

Hi!

Well, we have this secret really not mature project we started with stef a couple of weeks ago.


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)

Cool. I was thinking about in-image editing of pillar with Rubric (or the best available choice). Then you can generate on save.

  - 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)

I had a look at Cocoon but I'm not sure what purpose it serves. Maybe I need to get to used to it.

  - 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.

YES! That is exactly what I was looking for. Something that can be evaluated dynamically. That opens a wide range of possibilities. 

I originally started this for the new dbxtalk site which is written basically in pillar.


You can see the source code of this site in here:


Nice!

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


Thanks. I think I'll find some time this weekend to see how your project fits into my needs. I'll be happy nagging you about some things ;)

Norbert

Guille


El jue., 21 de may. de 2015 a la(s) 1:10 a. m., Cyril Ferlicot <[hidden email]> 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 <[hidden email]> 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 <[hidden email]>:
>>
>> 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


Reply | Threaded
Open this post in threaded view
|

Re: Fun with pillar and mustache

CyrilFerlicot
Cocoon allow you to manage configuration with a .conf file and a STON syntax.
You can see how Cocoon work with the class PRCocoonConfiguration of Pillar.
I'll try to create a demo of Cocoon when I'll have the time.

But to make simple you can define some parameters on your
configuration and you give them a default value. Then if the user
define a configuration Cocoon will change the default value for the
value of the user. You can also use the value to create something else
with CocoonSTONInterpreter. (For example on Pillar we check the
outputType parameter and we choose or Writer in the
PRCocoonInterpreter).

And after you can use Cocoon parameters in your application.

On 21 May 2015 at 14:01, Norbert Hartl <[hidden email]> wrote:

>
> Am 21.05.2015 um 10:51 schrieb Guillermo Polito <[hidden email]>:
>
> Hi!
>
> Well, we have this secret really not mature project we started with stef a
> couple of weeks ago.
>
> 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)
>
>
> Cool. I was thinking about in-image editing of pillar with Rubric (or the
> best available choice). Then you can generate on save.
>
>   - 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)
>
>
> I had a look at Cocoon but I'm not sure what purpose it serves. Maybe I need
> to get to used to it.
>
>   - 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.
>
> YES! That is exactly what I was looking for. Something that can be evaluated
> dynamically. That opens a wide range of possibilities.
>
> I originally started this for the new dbxtalk site which is written
> basically in pillar.
>
> http://dbxtalk.smallworks.eu/
>
> You can see the source code of this site in here:
>
> https://github.com/guillep/DBXTalk/tree/gh-pages
>
> Nice!
>
> 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
>
> Thanks. I think I'll find some time this weekend to see how your project
> fits into my needs. I'll be happy nagging you about some things ;)
>
> Norbert
>
> Guille
>
>
> El jue., 21 de may. de 2015 a la(s) 1:10 a. m., Cyril Ferlicot
> <[hidden email]> 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 <[hidden email]> 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 <[hidden email]>:
>> >>
>> >> 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
>>
>



--
Cheers
Cyril Ferlicot

Reply | Threaded
Open this post in threaded view
|

Re: Fun with pillar and mustache

NorbertHartl
In reply to this post by Guillermo Polito
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 <[hidden email]>:

Hi!

Well, we have this secret really not mature project we started with stef a couple of weeks ago.


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.


You can see the source code of this site in here:


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


Guille


El jue., 21 de may. de 2015 a la(s) 1:10 a. m., Cyril Ferlicot <[hidden email]> 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 <[hidden email]> 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 <[hidden email]>:
>>
>> 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


Reply | Threaded
Open this post in threaded view
|

Re: Fun with pillar and mustache

stepharo
In reply to this post by NorbertHartl

>>   - 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)
>
> I had a look at Cocoon but I'm not sure what purpose it serves. Maybe
> I need to get to used to it.

This is to decouple the code managing the configuration parameter from
Pier because we have different needs for Ecstatic
>
>>   - 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.
>>
> YES! That is exactly what I was looking for. Something that can be
> evaluated dynamically. That opens a wide range of possibilities.

but for web site you do not want to get somebody to hack your system.
So this is why we are defining pluggings.

>> I originally started this for the new dbxtalk site which is written
>> basically in pillar.
>>
>> http://dbxtalk.smallworks.eu/
>>
>> You can see the source code of this site in here:
>>
>> https://github.com/guillep/DBXTalk/tree/gh-pages
>>
> Nice!
>
>> 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
>>
> Thanks. I think I'll find some time this weekend to see how your
> project fits into my needs. I'll be happy nagging you about some things ;)