hiyas. I using Genshi+Pylons.
please teach me, how use \n to <br/>tag in Genshi?
I hope to obtain the same result as "nl2br" in php to change line.
Or, does not the solution exist?
i'm assign template to some text.
(genshi template)
<p>${c.message}</p>
Im tried. case 1:
(python code)
c.message = """
foo
bar
"""
NG. display result is "foo bar"
case 2:
(python code)
c.message = """
foo<br />
bar
"""
NG. display result is "foo<br />bar".
displayed escaped stirings!
It was a same deal as <br/> as for <br />.
Postscript.
I want to avoid using the pre tag.
thanks.
When it is not easy to read because it is not good, I'm sorry by English.
Try this:
<py:for each="line in message.split('\n')">${line}<br /></py:for>
来源:https://stackoverflow.com/questions/2123162/what-is-the-method-of-doing-nl2br-in-genshi