views:

69

answers:

1

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.

A: 

Try this:

<py:for each="line in message.split('\n')">${line}<br /></py:for>
piquadrat
TankYou piquadrat. it worked!I wish sincerely to express our gratitude for your wisdom.
Schaft