Convert blocks of text to paragraphs

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

Convert blocks of text to paragraphs

John Thornborrow
Hi folks,

I'm only asking this here because I imagine I am not the first to
stumble upon this scenario; I have a blog and I need to convert actual
paragraphs of text, to html paragraphs (<p>)

Is there a method I have overlooked in the framework that does this, or
will I (i.e. my objects) be responsible for formatting this way?

If the latter, and if anyone else has needed to complete this, what is
the best way? I will need to run the text through WARenderCanvas>>#text:
as well, so should I just perform the conversions of the special chars
myself?

Many thanks,
John.

www.pinesoft.co.uk


Pinesoft Computers are registered in England, Registered number: 2914825. Registered office: 266-268 High Street, Waltham Cross, Herts, EN8 7EA



This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Convert blocks of text to paragraphs

John Thornborrow
John Thornborrow wrote:

> Hi folks,
>
> I'm only asking this here because I imagine I am not the first to
> stumble upon this scenario; I have a blog and I need to convert actual
> paragraphs of text, to html paragraphs (<p>)
>
> Is there a method I have overlooked in the framework that does this, or
> will I (i.e. my objects) be responsible for formatting this way?
>
> If the latter, and if anyone else has needed to complete this, what is
> the best way? I will need to run the text through WARenderCanvas>>#text:
> as well, so should I just perform the conversions of the special chars
> myself?
>
> Many thanks,
> John.
>
> www.pinesoft.co.uk
>
>
> Pinesoft Computers are registered in England, Registered number: 2914825. Registered office: 266-268 High Street, Waltham Cross, Herts, EN8 7EA
>
>
>
> This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com
>
> _______________________________________________
> Seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
>  
>
>  
Resolved..

renderParagraphs: aString withRenderer: html
    | string cr lf |
    cr _ (Character value: 10) asString.
    lf _ (Character value: 13) asString.
   
    string _ aString copyReplaceAll: lf with: '' asTokens: false.
    (string subStrings: cr,cr) do: [:x |
        html paragraph with: [
            html text: x]].
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Convert blocks of text to paragraphs

Lukas Renggli
In reply to this post by John Thornborrow
> Is there a method I have overlooked in the framework that does this, or
> will I (i.e. my objects) be responsible for formatting this way?

#withLineBreaks: aString
#withLineBreaksAndUrls: aString

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Convert blocks of text to paragraphs

John Thornborrow
Lukas Renggli wrote:
>> Is there a method I have overlooked in the framework that does this, or
>> will I (i.e. my objects) be responsible for formatting this way?
>
> #withLineBreaks: aString
> #withLineBreaksAndUrls: aString
>
> Cheers,
> Lukas
>
Ah, thanks. I was looking for a #text method, which is where I went wrong.

John.


Pinesoft Computers are registered in England, Registered number: 2914825. Registered office: 266-268 High Street, Waltham Cross, Herts, EN8 7EA



This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside