mustache questions

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

mustache questions

Stephane Ducasse-3
Hi Norbert

Pillar uses Mustache: it generate a json file and take the template and ask mustache to do the inlining. 
Now I just hate the idea that we have objects that we should save in file to produce other files...

Do you know if we could use mustache directly: i.e., get the text from object, get the template and inject it directly without saving to json files, loading from json files....

Stef

Reply | Threaded
Open this post in threaded view
|

Re: mustache questions

NorbertHartl

> Am 25.05.2017 um 17:00 schrieb Stephane Ducasse <[hidden email]>:
>
> Hi Norbert
>
> Pillar uses Mustache: it generate a json file and take the template and ask mustache to do the inlining.
> Now I just hate the idea that we have objects that we should save in file to produce other files...
>
> Do you know if we could use mustache directly: i.e., get the text from object, get the template and inject it directly without saving to json files, loading from json files....
>
Sure, that is the normal behavior.

'Hello {{ name }} !' asMustacheTemplate value: { 'name' -> 'Stef' } asDictionary

if the template is in a file

'hello.templ' asFileReference asMustacheTemplate value: { 'name' -> 'Stef' } asDictionary .

I talked to Damien back then but I never understood why that configuration file was so important. For that they needed to add a CLI option for mustache. But I cannot recall exactly what were the reasons.

Does that answer your question?

Norbert
Reply | Threaded
Open this post in threaded view
|

Re: mustache questions

Offray Vladimir Luna Cárdenas-2
In reply to this post by Stephane Ducasse-3

Hi,

He, he, what a happy coincidence. I'm reading right now the Mustache chapter Enterprise Pharo book, which BTW is a joyful reading and a very well written book. I'm creating now some Grafoscopio interactive companion notebooks for the Pharo Books I'm reading, with some code snippets and annotations to share between learners. Here is an screenshot of the Enterprise Pharo notebook:

and here the actual notebook:

http://mutabit.com/repos.fossil/grafoscopio/doc/tip/Docs/En/Books/EnterprisePharo/companion-notebook.ston

I know that is possible to inject objects and its values directly inside Mustache without passing through any external JSON file. We have used it in that way in our Data Week hackathon+workshop to prototype our Twitter Data selfies exercise. So this JSON import and export option must be a Pillar requirement.

What I'm testing for PDF output configuration is to have an interactive node, that is a dictionary where all the Pandoc exporting and notebook metadata options are declared. When the export is run, Grafoscopio traverses the tree looking for this particular node and applies the options to the output. Here is an screenshot of how it loooks:

Future versions of the Grafoscopio manual [1] will be produced like this. Creating the current one, the user goes out to the shell prompt to put such options, but when they will be embedded in the notebook, the document will know more about itself, including command prompt options and metadata and authors will be able to produce customized outputs without leaving the image.

Cheers,

Offray


On 25/05/17 10:00, Stephane Ducasse wrote:
Hi Norbert

Pillar uses Mustache: it generate a json file and take the template and ask mustache to do the inlining. 
Now I just hate the idea that we have objects that we should save in file to produce other files...

Do you know if we could use mustache directly: i.e., get the text from object, get the template and inject it directly without saving to json files, loading from json files....

Stef


Reply | Threaded
Open this post in threaded view
|

Re: mustache questions

philippeback
In reply to this post by Stephane Ducasse-3
Ah, yes, that change really smells bad compared to previous Pillar where it was all in one step.

Let's do opinionated books/booklets/presentations/articles. At least we'll have something working.

Let's pick one or two output formats and then let's use Pandoc http://pandoc.org/ for the rest.

Phil

On Thu, May 25, 2017 at 5:00 PM, Stephane Ducasse <[hidden email]> wrote:
Hi Norbert

Pillar uses Mustache: it generate a json file and take the template and ask mustache to do the inlining. 
Now I just hate the idea that we have objects that we should save in file to produce other files...

Do you know if we could use mustache directly: i.e., get the text from object, get the template and inject it directly without saving to json files, loading from json files....

Stef


Reply | Threaded
Open this post in threaded view
|

Re: mustache questions

Stephane Ducasse-3
The formats are not the problems. 
This is just that some smart students were not really carefully supervised. 

So I will work on it slowly because I want to be able to use pillar for real in the future.

On Thu, May 25, 2017 at 6:50 PM, [hidden email] <[hidden email]> wrote:
Ah, yes, that change really smells bad compared to previous Pillar where it was all in one step.

Let's do opinionated books/booklets/presentations/articles. At least we'll have something working.

Let's pick one or two output formats and then let's use Pandoc http://pandoc.org/ for the rest.

Phil

On Thu, May 25, 2017 at 5:00 PM, Stephane Ducasse <[hidden email]> wrote:
Hi Norbert

Pillar uses Mustache: it generate a json file and take the template and ask mustache to do the inlining. 
Now I just hate the idea that we have objects that we should save in file to produce other files...

Do you know if we could use mustache directly: i.e., get the text from object, get the template and inject it directly without saving to json files, loading from json files....

Stef