pier

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

pier

firerox
Hi all,

I want to write to my textArea for example ""hi all"".
And then I would like to see hi all in bold

exactly like in WikiSystem.

I used PRDocumentParser parse: '""hi all""',
but this method returns PRDocument.

But I want reneder this string in renederContentOn: method

Please help me!

Best regards Marek Fiala


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: pier

Lukas Renggli-2
> I used PRDocumentParser parse: '""hi all""',
> but this method returns PRDocument.
>
> But I want reneder this string in renederContentOn: method

   document := PRDocumentParser parse: '""hi all""'.

The parser returns a document, this is the root of an AST representing  
your input. It is independent from the actual output, but it can be  
easily transformed into about any other format.

For example plain text:

   PRTextWriter write: document --> 'hi all'

Back to wiki syntax:

   PRWikiWriter write: document --> '""hi all""'

Latex (you need a special plugin here):

   PRLatexWriter write: document --> '\textbf{hi all}'

And, of course, also to HTML (you need Seaside and Pier-Seaside here):

   PRViewRenderer new
     start: document
     in: aComponent
     on: html --> '<strong>hi all</strong>'

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: pier

firerox
Hi, thank you for your answer.

It works!
But I have still one problem.

When I type new line in text area,
PRViewRenderer show me whole text in one line.
But when i try edit again, in text area i see multiple line text.

Where is a problem?

Thank you for any help
best regards
Marek Fiala

>
>> I used PRDocumentParser parse: '""hi all""',
>> but this method returns PRDocument.
>>
>> But I want reneder this string in renederContentOn: method
>
>   document := PRDocumentParser parse: '""hi all""'.
>
>The parser returns a document, this is the root of an AST representing  
>your input. It is independent from the actual output, but it can be  
>easily transformed into about any other format.
>
>For example plain text:
>
>   PRTextWriter write: document --> 'hi all'
>
>Back to wiki syntax:
>
>   PRWikiWriter write: document --> '""hi all""'
>
>Latex (you need a special plugin here):
>
>   PRLatexWriter write: document --> '\textbf{hi all}'
>
>And, of course, also to HTML (you need Seaside and Pier-Seaside here):
>
>   PRViewRenderer new
>     start: document
>     in: aComponent
>     on: html --> '<strong>hi all</strong>'
>
>Cheers,
>Lukas
>
>--
>Lukas Renggli
>http://www.lukas-renggli.ch
>
>
>_______________________________________________
>SmallWiki, Magritte, Pier and Related Tools ...
>https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: pier

Lukas Renggli-2
> It works!
> But I have still one problem.
>
> When I type new line in text area,
> PRViewRenderer show me whole text in one line.

That's a new feature. You need to add an empty line in-between to get  
a new paragraph started. This behavior is similar to the one you have  
in the LaTeX markup language for paragraphs.

For example in my image the following test passes:

        string := 'foo' , String cr , 'bar'.
        document := PRDocumentParser parse: string.
        self assert: (PRWikiWriter write: document) = string

> But when i try edit again, in text area i see multiple line text.

There is something wrong. Do the Pier tests pass? If not try to  
evaluate:

        PRDocumentParser classPool
                removeKey: #LineMatcher;
                removeKey: #LineMatcherDefault;
                removeKey: #TextMatcher

If that doesn't help, could you show some code so that we can try to  
reproduce the problem?

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: pier

firerox
Hi Lukas,

>For example in my image the following test passes:
>
> string := 'foo' , String cr , 'bar'.
> document := PRDocumentParser parse: string.
> self assert: (PRWikiWriter write: document) = string

Yes, it passes me too.

But maybe I think somthing other>

PRViewRenderer new
  start: (PRDocumentParser parse: 'foo' , String cr , 'bar')  in: self
  on: html.

this code show me:
foobar

But I would like to see:
foo
bar

Thank you.

Marek

>> It works!
>> But I have still one problem.
>>
>> When I type new line in text area,
>> PRViewRenderer show me whole text in one line.
>
>That's a new feature. You need to add an empty line in-between to get  
>a new paragraph started. This behavior is similar to the one you have  
>in the LaTeX markup language for paragraphs.
>
>For example in my image the following test passes:
>
> string := 'foo' , String cr , 'bar'.
> document := PRDocumentParser parse: string.
> self assert: (PRWikiWriter write: document) = string
>
>> But when i try edit again, in text area i see multiple line text.
>
>There is something wrong. Do the Pier tests pass? If not try to  
>evaluate:
>
> PRDocumentParser classPool
> removeKey: #LineMatcher;
> removeKey: #LineMatcherDefault;
> removeKey: #TextMatcher
>
>If that doesn't help, could you show some code so that we can try to  
>reproduce the problem?
>
>Lukas
>
>--
>Lukas Renggli
>http://www.lukas-renggli.ch
>
>
>_______________________________________________
>SmallWiki, Magritte, Pier and Related Tools ...
>https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: pier

Lukas Renggli-2
>> But I would like to see:
> foo
> bar

Then you have to press enter twice:

        foo

        bar

Also see the documentation of the syntax in Pier: "Paragraphs: A  
single newline has no effect on the layout. An empty line starts a new  
paragraph."

Lukas

>
>
> Thank you.
>
> Marek
>
>>> It works!
>>> But I have still one problem.
>>>
>>> When I type new line in text area,
>>> PRViewRenderer show me whole text in one line.
>>
>> That's a new feature. You need to add an empty line in-between to get
>> a new paragraph started. This behavior is similar to the one you have
>> in the LaTeX markup language for paragraphs.
>>
>> For example in my image the following test passes:
>>
>> string := 'foo' , String cr , 'bar'.
>> document := PRDocumentParser parse: string.
>> self assert: (PRWikiWriter write: document) = string
>>
>>> But when i try edit again, in text area i see multiple line text.
>>
>> There is something wrong. Do the Pier tests pass? If not try to
>> evaluate:
>>
>> PRDocumentParser classPool
>> removeKey: #LineMatcher;
>> removeKey: #LineMatcherDefault;
>> removeKey: #TextMatcher
>>
>> If that doesn't help, could you show some code so that we can try to
>> reproduce the problem?
>>
>> Lukas
>>
>> --
>> Lukas Renggli
>> http://www.lukas-renggli.ch
>>
>>
>> _______________________________________________
>> SmallWiki, Magritte, Pier and Related Tools ...
>> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>>
>
>
> _______________________________________________
> SmallWiki, Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki

--
Lukas Renggli
http://www.lukas-renggli.ch


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki