Pillar used directly from Pharo

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

Pillar used directly from Pharo

Jan Valášek
Hi there,

I'd like to ask you, whether is here a way to use pillar internally,
directly from Pharo and how to use it properly. I have found some
tutorials how to use it from linux/windows command prompt, however, I'd
prefer to call it in my program in pharo.



Something like this ->
-----------------------
header := pillarHeaderObject new.  //creating pillar objects directly
from my program
header text:'Title of my page'.
aPillarDocument add: header.   //adding them to the whole document
object

and finally

aPillarDocument exportToLatex. //export the document
----------------------



or I can just write the text in the pillar notation to "myTextObject"
and then call something like->
-------
pillarParseAndExportToLatex: myTextObject.
-------

Is here a way to do this?

Thanks for your help :-)
John.

Reply | Threaded
Open this post in threaded view
|

Re: Pillar used directly from Pharo

CyrilFerlicot
Hi ! 
You can use it from Pharo but it's a little complicated if you want to add a configuration file (pillar.conf).
I can't explain now because I'm at a ceremony but when I'll have time I'll add the list of the commandes !

Le samedi 18 avril 2015, Jan Valášek <[hidden email]> a écrit :
Hi there,

I'd like to ask you, whether is here a way to use pillar internally,
directly from Pharo and how to use it properly. I have found some
tutorials how to use it from linux/windows command prompt, however, I'd
prefer to call it in my program in pharo.



Something like this ->
-----------------------
header := pillarHeaderObject new.  //creating pillar objects directly
from my program
header text:'Title of my page'.
aPillarDocument add: header.   //adding them to the whole document
object

and finally

aPillarDocument exportToLatex. //export the document
----------------------



or I can just write the text in the pillar notation to "myTextObject"
and then call something like->
-------
pillarParseAndExportToLatex: myTextObject.
-------

Is here a way to do this?

Thanks for your help :-)
John.



--
Cheers
Cyril Ferlicot

Reply | Threaded
Open this post in threaded view
|

Re: Pillar used directly from Pharo

CyrilFerlicot
Hi again !

Ok so. To use pillar inside Pharo you have this:

PRCocoonConfiguration new
                        templateStream: PRHTMLWriter defaultTemplate;
                        configurations: Dictionary new;
                        inputFiles: {(FileSystem workingDirectory /
'test.pillar')};
                        outputType: PRHTMLWriter;
                        outputFile: 'test.html' asFileReference ;
                        export.

Here is a little exemple. You can remplace PRHTMLWriter by
PRLaTeXWriter, PRTextWriter, PRMarkdownWriter, PRPillarWriter etc...
The outputFile is the name of the file you want to be generate, the
file will be on the folder of the image.
If you want a special template you have to pass it to templateStream.
You can also have others option like:



On 18 April 2015 at 20:06, Cyril Ferlicot <[hidden email]> wrote:

> Hi !
> You can use it from Pharo but it's a little complicated if you want to add a
> configuration file (pillar.conf).
> I can't explain now because I'm at a ceremony but when I'll have time I'll
> add the list of the commandes !
>
> Le samedi 18 avril 2015, Jan Valášek <[hidden email]> a écrit :
>>
>> Hi there,
>>
>> I'd like to ask you, whether is here a way to use pillar internally,
>> directly from Pharo and how to use it properly. I have found some
>> tutorials how to use it from linux/windows command prompt, however, I'd
>> prefer to call it in my program in pharo.
>>
>>
>>
>> Something like this ->
>> -----------------------
>> header := pillarHeaderObject new.  //creating pillar objects directly
>> from my program
>> header text:'Title of my page'.
>> aPillarDocument add: header.   //adding them to the whole document
>> object
>>
>> and finally
>>
>> aPillarDocument exportToLatex. //export the document
>> ----------------------
>>
>>
>>
>> or I can just write the text in the pillar notation to "myTextObject"
>> and then call something like->
>> -------
>> pillarParseAndExportToLatex: myTextObject.
>> -------
>>
>> Is here a way to do this?
>>
>> Thanks for your help :-)
>> John.
>>
>
>
> --
> Cheers
> Cyril Ferlicot
>



--
Cheers
Cyril Ferlicot

Reply | Threaded
Open this post in threaded view
|

Re: Pillar used directly from Pharo

CyrilFerlicot
Hi again !

Ok so. To use pillar inside Pharo you have this:

PRCocoonConfiguration new
                        templateStream: PRHTMLWriter defaultTemplate;
                        configurations: Dictionary new;
                        inputFiles: {(FileSystem workingDirectory /
'test.pillar')};
                        outputType: PRHTMLWriter;
                        outputFile: 'test.html' asFileReference ;
                        export.

Here is a little exemple. You can remplace PRHTMLWriter by
PRLaTeXWriter, PRTextWriter, PRMarkdownWriter, PRPillarWriter etc...
The outputFile is the name of the file you want to be generate, the
file will be on the folder of the image.
If you want a special template you have to pass it to templateStream.
You can also have others option like:
- inputString : aString with the pillar text you want to export like:
                        '!test
                        *myLink>http://test.html*
                        !!Test 2
                        etc...'
- outputStream : if you don't want a file at the end but a stream.
etc...

You can find all these option inside the PRCocoonConfiguration class.

I hope that can help you, if you've others question fell free to ask !

On 19 April 2015 at 17:53, Cyril Ferlicot <[hidden email]> wrote:

> Hi again !
>
> Ok so. To use pillar inside Pharo you have this:
>
> PRCocoonConfiguration new
>                         templateStream: PRHTMLWriter defaultTemplate;
>                         configurations: Dictionary new;
>                         inputFiles: {(FileSystem workingDirectory /
> 'test.pillar')};
>                         outputType: PRHTMLWriter;
>                         outputFile: 'test.html' asFileReference ;
>                         export.
>
> Here is a little exemple. You can remplace PRHTMLWriter by
> PRLaTeXWriter, PRTextWriter, PRMarkdownWriter, PRPillarWriter etc...
> The outputFile is the name of the file you want to be generate, the
> file will be on the folder of the image.
> If you want a special template you have to pass it to templateStream.
> You can also have others option like:
>
>
>
> On 18 April 2015 at 20:06, Cyril Ferlicot <[hidden email]> wrote:
>> Hi !
>> You can use it from Pharo but it's a little complicated if you want to add a
>> configuration file (pillar.conf).
>> I can't explain now because I'm at a ceremony but when I'll have time I'll
>> add the list of the commandes !
>>
>> Le samedi 18 avril 2015, Jan Valášek <[hidden email]> a écrit :
>>>
>>> Hi there,
>>>
>>> I'd like to ask you, whether is here a way to use pillar internally,
>>> directly from Pharo and how to use it properly. I have found some
>>> tutorials how to use it from linux/windows command prompt, however, I'd
>>> prefer to call it in my program in pharo.
>>>
>>>
>>>
>>> Something like this ->
>>> -----------------------
>>> header := pillarHeaderObject new.  //creating pillar objects directly
>>> from my program
>>> header text:'Title of my page'.
>>> aPillarDocument add: header.   //adding them to the whole document
>>> object
>>>
>>> and finally
>>>
>>> aPillarDocument exportToLatex. //export the document
>>> ----------------------
>>>
>>>
>>>
>>> or I can just write the text in the pillar notation to "myTextObject"
>>> and then call something like->
>>> -------
>>> pillarParseAndExportToLatex: myTextObject.
>>> -------
>>>
>>> Is here a way to do this?
>>>
>>> Thanks for your help :-)
>>> John.
>>>
>>
>>
>> --
>> Cheers
>> Cyril Ferlicot
>>
>
>
>
> --
> Cheers
> Cyril Ferlicot



--
Cheers
Cyril Ferlicot

Reply | Threaded
Open this post in threaded view
|

Re: Pillar used directly from Pharo

Jan Valášek
Well, this is exactly what I needed,
Great examples too, HTML and LaTeX format tried and worked fine.


PS: Pharo didn't know PRCocoonConfiguration class at first (bad version
of Pillar I guess), but this version of Pillar loaded into pharo helped.
"------------------------------------------------------"
Gofer new
    smalltalkhubUser: 'Pier' project: 'Pillar';
    configuration;
    load.
(Smalltalk globals at: #ConfigurationOfPillar) load.
"------------------------------------------------------"



thanks a lot for your help! :-)




Dne 2015-04-19 17:57, Cyril Ferlicot napsal:

> Hi again !
>
> Ok so. To use pillar inside Pharo you have this:
>
> PRCocoonConfiguration new
>                         templateStream: PRHTMLWriter defaultTemplate;
>                         configurations: Dictionary new;
>                         inputFiles: {(FileSystem workingDirectory /
> 'test.pillar')};
>                         outputType: PRHTMLWriter;
>                         outputFile: 'test.html' asFileReference ;
>                         export.
>
> Here is a little exemple. You can remplace PRHTMLWriter by
> PRLaTeXWriter, PRTextWriter, PRMarkdownWriter, PRPillarWriter etc...
> The outputFile is the name of the file you want to be generate, the
> file will be on the folder of the image.
> If you want a special template you have to pass it to templateStream.
> You can also have others option like:
> - inputString : aString with the pillar text you want to export like:
>                         '!test
>                         *myLink>http://test.html*
>                         !!Test 2
>                         etc...'
> - outputStream : if you don't want a file at the end but a stream.
> etc...
>
> You can find all these option inside the PRCocoonConfiguration class.
>
> I hope that can help you, if you've others question fell free to ask !
>
> On 19 April 2015 at 17:53, Cyril Ferlicot <[hidden email]> wrote:
>> Hi again !
>>
>> Ok so. To use pillar inside Pharo you have this:
>>
>> PRCocoonConfiguration new
>>                         templateStream: PRHTMLWriter defaultTemplate;
>>                         configurations: Dictionary new;
>>                         inputFiles: {(FileSystem workingDirectory /
>> 'test.pillar')};
>>                         outputType: PRHTMLWriter;
>>                         outputFile: 'test.html' asFileReference ;
>>                         export.
>>
>> Here is a little exemple. You can remplace PRHTMLWriter by
>> PRLaTeXWriter, PRTextWriter, PRMarkdownWriter, PRPillarWriter etc...
>> The outputFile is the name of the file you want to be generate, the
>> file will be on the folder of the image.
>> If you want a special template you have to pass it to templateStream.
>> You can also have others option like:
>>
>>
>>
>> On 18 April 2015 at 20:06, Cyril Ferlicot <[hidden email]> wrote:
>>> Hi !
>>> You can use it from Pharo but it's a little complicated if you want to add a
>>> configuration file (pillar.conf).
>>> I can't explain now because I'm at a ceremony but when I'll have time I'll
>>> add the list of the commandes !
>>>
>>> Le samedi 18 avril 2015, Jan Valášek <[hidden email]> a écrit :
>>>>
>>>> Hi there,
>>>>
>>>> I'd like to ask you, whether is here a way to use pillar internally,
>>>> directly from Pharo and how to use it properly. I have found some
>>>> tutorials how to use it from linux/windows command prompt, however, I'd
>>>> prefer to call it in my program in pharo.
>>>>
>>>>
>>>>
>>>> Something like this ->
>>>> -----------------------
>>>> header := pillarHeaderObject new.  //creating pillar objects directly
>>>> from my program
>>>> header text:'Title of my page'.
>>>> aPillarDocument add: header.   //adding them to the whole document
>>>> object
>>>>
>>>> and finally
>>>>
>>>> aPillarDocument exportToLatex. //export the document
>>>> ----------------------
>>>>
>>>>
>>>>
>>>> or I can just write the text in the pillar notation to "myTextObject"
>>>> and then call something like->
>>>> -------
>>>> pillarParseAndExportToLatex: myTextObject.
>>>> -------
>>>>
>>>> Is here a way to do this?
>>>>
>>>> Thanks for your help :-)
>>>> John.
>>>>
>>>
>>>
>>> --
>>> Cheers
>>> Cyril Ferlicot
>>>
>>
>>
>>
>> --
>> Cheers
>> Cyril Ferlicot


Reply | Threaded
Open this post in threaded view
|

Re: Pillar used directly from Pharo

Damien Cassou-2
In reply to this post by Jan Valášek

Hi Jan,

the following complements Cyril's answers. You can have a look at all
the unit-tests, they do a lot of things like what you want.

Jan Valášek <[hidden email]> writes:
> header := pillarHeaderObject new.  //creating pillar objects directly

header := PRHeader new level: 2; add: (PRText content: 'foo'); yourself.


> aPillarDocument add: header.   //adding them to the whole document


document := PRDocument new.
document add: header.

> aPillarDocument exportToLatex. //export the document


to only export the body of the document:

PRLaTeXWriter write: document


> or I can just write the text in the pillar notation to "myTextObject"
> and then call something like->
> -------
> pillarParseAndExportToLatex: myTextObject.


document := PRDocumentParser parse: '!!foo'.
PRLaTeXWriter write: document.


--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill

Reply | Threaded
Open this post in threaded view
|

Re: Pillar used directly from Pharo

Jan Valášek
Dne 2015-04-20 14:12, Damien Cassou napsal:
Hi Damien,

Finally, I have used both ways in my work. So thank you for the
clarification. Pillar is a very useful tool :-)

Jan

> Hi Jan,
>
> the following complements Cyril's answers. You can have a look at all
> the unit-tests, they do a lot of things like what you want.
>
> Jan Valášek <[hidden email]> writes:
>> header := pillarHeaderObject new.  //creating pillar objects directly
>
> header := PRHeader new level: 2; add: (PRText content: 'foo'); yourself.
>
>
>> aPillarDocument add: header.   //adding them to the whole document
>
>
> document := PRDocument new.
> document add: header.
>
>> aPillarDocument exportToLatex. //export the document
>
>
> to only export the body of the document:
>
> PRLaTeXWriter write: document
>
>
>> or I can just write the text in the pillar notation to "myTextObject"
>> and then call something like->
>> -------
>> pillarParseAndExportToLatex: myTextObject.
>
>
> document := PRDocumentParser parse: '!!foo'.
> PRLaTeXWriter write: document.


Reply | Threaded
Open this post in threaded view
|

Re: Pillar used directly from Pharo

CyrilFerlicot
To help the person who'll need to use Pillar from Pharo I added some
documentation about it on the Pillar's documentation:
https://ci.inria.fr/pharo-contribution/view/Books/job/EnterprisePharoBook/lastBuild/artifact/PillarChap/Pillar.html


On 17 May 2015 at 13:03, Jan Valášek <[hidden email]> wrote:

> Dne 2015-04-20 14:12, Damien Cassou napsal:
> Hi Damien,
>
> Finally, I have used both ways in my work. So thank you for the
> clarification. Pillar is a very useful tool :-)
>
> Jan
>
>> Hi Jan,
>>
>> the following complements Cyril's answers. You can have a look at all
>> the unit-tests, they do a lot of things like what you want.
>>
>> Jan Valášek <[hidden email]> writes:
>>> header := pillarHeaderObject new.  //creating pillar objects directly
>>
>> header := PRHeader new level: 2; add: (PRText content: 'foo'); yourself.
>>
>>
>>> aPillarDocument add: header.   //adding them to the whole document
>>
>>
>> document := PRDocument new.
>> document add: header.
>>
>>> aPillarDocument exportToLatex. //export the document
>>
>>
>> to only export the body of the document:
>>
>> PRLaTeXWriter write: document
>>
>>
>>> or I can just write the text in the pillar notation to "myTextObject"
>>> and then call something like->
>>> -------
>>> pillarParseAndExportToLatex: myTextObject.
>>
>>
>> document := PRDocumentParser parse: '!!foo'.
>> PRLaTeXWriter write: document.
>
>



--
Cheers
Cyril Ferlicot

Reply | Threaded
Open this post in threaded view
|

Re: Pillar used directly from Pharo

Damien Cassou-2
In reply to this post by Jan Valášek
Cyril is now doing all the work on Pillar

On May 17, 2015 1:03:19 PM GMT+02:00, "Jan Valášek" <[hidden email]> wrote:

>Dne 2015-04-20 14:12, Damien Cassou napsal:
>Hi Damien,
>
>Finally, I have used both ways in my work. So thank you for the
>clarification. Pillar is a very useful tool :-)
>
>Jan
>
>> Hi Jan,
>>
>> the following complements Cyril's answers. You can have a look at all
>> the unit-tests, they do a lot of things like what you want.
>>
>> Jan Valášek <[hidden email]> writes:
>>> header := pillarHeaderObject new.  //creating pillar objects
>directly
>>
>> header := PRHeader new level: 2; add: (PRText content: 'foo');
>yourself.
>>
>>
>>> aPillarDocument add: header.   //adding them to the whole document
>>
>>
>> document := PRDocument new.
>> document add: header.
>>
>>> aPillarDocument exportToLatex. //export the document
>>
>>
>> to only export the body of the document:
>>
>> PRLaTeXWriter write: document
>>
>>
>>> or I can just write the text in the pillar notation to
>"myTextObject"
>>> and then call something like->
>>> -------
>>> pillarParseAndExportToLatex: myTextObject.
>>
>>
>> document := PRDocumentParser parse: '!!foo'.
>> PRLaTeXWriter write: document.

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill