Commits

Mike Orr committed 0558986

Make nl2br() and format_paragraphs literal-safe.

Comments (0)

Files changed (2)

 WebHelpers ChangeLog
 
 0.6.2 (tip)
+* nl2br() and format-paragraphs were not literal-safe.
 
 0.6.1 (7/31/2008)
 * Include a faster version of cgi.escape for use by the literal object.

webhelpers/html/converters.py

 """
 import re
 
-from webhelpers.html import HTML, literal
+from webhelpers.html import HTML, literal, lit_sub
 import webhelpers.textile as textile
 import webhelpers.markdown as _markdown
 
     """
     if text is None:
         return literal("")
-    text = _universal_newline_rx.sub("\n", text)
+    text = lit_sub(_universal_newline_rx, "\n", text)
     text = HTML(text).replace("\n", br)
     return text
 
     """
     if text is None:
         return literal("")
-    text = _universal_newline_rx.sub("\n", text)
+    text = lit_sub(_universal_newline_rx, "\n", text)
     paragraphs = _paragraph_rx.split(text)
     for i, para in enumerate(paragraphs):
         if preserve_lines: