Pillar script evaluation generating a screenshot
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
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 <juraj.kubelka@icloud.com> 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
participants (2)
-
Juraj Kubelka -
Stephane Ducasse