Sergey Maranchuk avatar Sergey Maranchuk committed 552ca71

corrected last commit

Comments (0)

Files changed (1)

bbmarkup/__init__.py

     value = matchobj.group(1)
     value = value.replace('[', '[')
     value = value.replace(']', ']')
-    value = value.replace('<br/>', '')
+    value = value.replace('<br />', '\n')
     return "<pre><code>%s</code></pre>" % value
 
 
     >>> bbmarkup.bbcode('[list=2] [*] a\n [*]b\n [*] c\n[/list]')
     u'<ol start="2"> <li>a</li> <li>b</li> <li>c</li></ol>'
     >>> bbmarkup.bbcode("[code]print 123\nprint '<br/>'[/code]")
-    u'<pre><code>print 123<br />print &#39;&lt;br/&gt;&#39;</code></pre>'
+    u'<pre><code>print 123\nprint &#39;&lt;br/&gt;&#39;</code></pre>'
     """
 
     value = escape(value)
+    if linebr:
+        value = linebreaksbr(value)
     value = re.sub(re.compile(r'\[code\](.+?)\[/code\]', re.DOTALL), code_parser, value)
     for bbset in BBCODE_RULES_COMPILED:
         value = bbset[0].sub(bbset[1], value)
-    if linebr:
-        value = linebreaksbr(value)
 
     return mark_safe(value)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.