puzzled about mako filters

35 views
Skip to first unread message

king wang

unread,
Sep 13, 2012, 10:47:44 AM9/13/12
to mako-d...@googlegroups.com
I want convert \n to <br/> by self-defined filter:
<%
def brescape(text):
    return text.replace("\n", "<br/>")
%>

but I was puzzled with the following statement:
${"abc\ndef" | h, brescap}

what i expect:
when the h filter applied, the output should be abc\ndef.  
and the output should be abc<br/>def when the second filter brescape applied.

unexpected output:
abc&lt;br/&gt;def


Is there some who can tell me what happened?
Reply all
Reply to author
Forward
0 new messages