Pillar script evaluation generating a screenshot

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

Pillar script evaluation generating a screenshot

Juraj Kubelka
Hi,

Pillar allows to evaluate a script and use its output instead of the script itself, e.g.,

-=-=-=-
[[[eval=true
DateAndTime now printString
]]]
-=-=-=-

How can I test it in a Pharo image? I tried:

-=-=-=-
document := PRPillarParser parse: '[[[eval=true
DateAndTime now printString
]]]' readStream.

PRHTMLWriter write: document.  
-=-=-=-

It returns: <figure><pre><code>DateAndTime now printString</code></pre><figcaption></figcaption></figure>

Then I tried:

-=-=-=-
transformedDocument := (PRScriptEvaluator executeOn: (PRCompilationContext withDocument: document withConfiguration: PRPillarConfiguration new)) input.

PRHTMLWriter write: transformedDocument.
-=-=-=-

And it returns an empty string.
What should I do to be able to obtain an HTML output with the output of `DateAndTime now printString`?


-=-=-=-
documentWithImage := PRPillarParser parse: '[[[eval=true
ByteArray streamContents: [ :writeStream |
        PNGReadWriter putForm: World submorphs atRandom imageForm onStream: writeStream ]
]]]' readStream.
-=-=-=-

What is the best practice if the evaluated result should be a screenshot?

Thanks!
Juraj


Reply | Threaded
Open this post in threaded view
|

Re: Pillar script evaluation generating a screenshot

Stephane Ducasse-3
Hi Juraj

I do not know it on top of my head.
I will check ...


For example you get a stream in which you can work
[[[eval=true
stream
        nextPutAll: '__WfManagedObject comment:__ ' ;
        nextPutAll: WfManagedObject comment; cr;
lf.
]]]

Now I would like to get automatically some png.



On Sat, Feb 3, 2018 at 2:46 PM, Juraj Kubelka <[hidden email]> wrote:

> Hi,
>
> Pillar allows to evaluate a script and use its output instead of the script itself, e.g.,
>
> -=-=-=-
> [[[eval=true
> DateAndTime now printString
> ]]]
> -=-=-=-
>
> How can I test it in a Pharo image? I tried:
>
> -=-=-=-
> document := PRPillarParser parse: '[[[eval=true
> DateAndTime now printString
> ]]]' readStream.
>
> PRHTMLWriter write: document.
> -=-=-=-
>
> It returns: <figure><pre><code>DateAndTime now printString</code></pre><figcaption></figcaption></figure>
>
> Then I tried:
>
> -=-=-=-
> transformedDocument := (PRScriptEvaluator executeOn: (PRCompilationContext withDocument: document withConfiguration: PRPillarConfiguration new)) input.
>
> PRHTMLWriter write: transformedDocument.
> -=-=-=-
>
> And it returns an empty string.
> What should I do to be able to obtain an HTML output with the output of `DateAndTime now printString`?
>
>
> -=-=-=-
> documentWithImage := PRPillarParser parse: '[[[eval=true
> ByteArray streamContents: [ :writeStream |
>         PNGReadWriter putForm: World submorphs atRandom imageForm onStream: writeStream ]
> ]]]' readStream.
> -=-=-=-
>
> What is the best practice if the evaluated result should be a screenshot?
>
> Thanks!
> Juraj
>
>