[Seaside] Convert blocks of text to paragraphs
john at pinesoft.co.uk
Tue Apr 17 13:42:31 UTC 2007
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
> Many thanks,
> 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
> Seaside at lists.squeakfoundation.org
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]].
More information about the Seaside