Anand wrote:
>
> On 14-Oct-07, at 9:22 AM, Ken wrote:
>
>> hi, Andand
>> in Django template, it can be wrote like this:
>> {{ entry.content|breakelines }}
>
> That is not sufficient. If you have more spaces like python
> indentation, they will disappear when displayed as html.
>
> I used this function to solve that problem. Probably you need to use
> that with breaklines.
>
> def spacesafe(text):
> text = web.websafe(text)
> text = text.replace(' ', ' ');
> return text
>
> spacesafe(text).replace('\r\n', '<br/>')
Just out of curiositywouldn't replace(' ', ' ') fit better
there? or is "^ " (a line starting with a space, followed by a
) in HTML rendered as two spaces by browsers?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web.py" 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/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---