hi Anand
i used it in my app, it works,thank you

def make_html(c):
    return web.websafe(c).replace(' ', '&nbsp;').replace('\r\n', '<br />')

On 10/14/07, Anand <[EMAIL PROTECTED]> 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('  ', ' &nbsp;');
>      return text
>
> spacesafe(text).replace('\r\n', '<br/>')
>
>
>
>
> >
>


-- 
每个人都有一片属于自己的森林, 迷失的人迷失了, 相逢的还会再相逢...
Gtalk: iexper(at)gmail.com

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to