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 via email to