#NEWLINE# @ evalcontextfilter #NEWLINE# def linebreaksbr( eval_ctx , value ) : #NEWLINE# #INDENT# value = re . sub ( '\\r\\n|\\r|\\n' , '\n' , value ) #NEWLINE# paras = re . split ( '\n{2,}' , p ) #NEWLINE# paras = [ ( '%s' % p . replace ( '\n' , '<br />' ) ) for p in paras ] #NEWLINE# paras = '\n\n' . join ( paras ) #NEWLINE# return Markup ( paras )