views:

12

answers:

0

I have String which contains some HTML and I'd like to escape it. After that I need to convert all /n into new lines with:

@environmentfilter
def filter_newLine(env, value):
    result = value.replace('\n', '<br/>')
    if env.autoescape:
        result = Markup(result)
    return result

I use the the filter {{status|e|filter_newLine}} after the escaping, but the newlines are also escaped.

raw Input:
<something/n another one<
output:
something <br/> another one --- (that new Line have to be new line in the browser)