2008/4/23, Cecil Westerhof <[EMAIL PROTECTED]>:
> With TG you are standard protected against HTML-insertion. As long as you
> > do not use XML. Very nice indeed. But I like to preserve the newlines.
> > The text:
> > #####
> > line one
> > line two
> > line three
> > #####
> > Should be displayed like:
> > #####
> > line one
> > line two
> > line three
> > #####
> > and not like
> > #####
> > line one line two line three
> > #####
> > Is this possible?
>
>
>
> I'll try to get things clearer.
> In my controllers.py I have:
> blogEntries = model.BlogEntry.select(orderBy =
> model.BlogEntry.q.date).reversed()
> In the kid-file I have:
> <p>${blogEntry.entryText}</p>
> I can change this in:
> <p>${blogEntry.entryText.replace('\n', '###\n')}</p>
> Then before every newline there are put three hashes.
> I would like to use:
> <p>${blogEntry.entryText.replace('\n', '<br/>\n')}</p>
> But instead of the changed text I get:
> ${blogEntry.entryText.replace('\n', '<br>\n')}
> between the <p> and </p>
> So is there a way to get <br/> before every \n?
I found a solution.
I replaced:
<p>${blogEntry.entryText}</p>
with:
<p>
<div class="beEntryText" py:for="line in
blogEntry.entryText.split('\n')">
${line}
</div>
</p>
Maybe not very meat, but it does what I want.
--
Cecil Westerhof
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---