Commits

Sergey Maranchuk committed 5588d50

fix [*] tag

Comments (0)

Files changed (1)

bbmarkup/__init__.py

         (r'\[link\](.*?)\[/link\]', r'<a href="\1">\1</a>'),
         (r'\[link=(.*?)\](.*?)\[/link\]', r'<a href="\1">\2</a>'),
         (r'\[email\](.*?)\[/email\]', r'<a href="mailto:\1">\1</a>'),
-        (r'\[email=(.*?)\](.+?)\[/email\]', r'<a href="mailto:\1">\2</a>'),
+        (r'\[email=(.*?)\](.*?)\[/email\]', r'<a href="mailto:\1">\2</a>'),
         (r'\[img\](.*?)\[/img\]', r'<img src="\1">'),
         (r'\[img=(.*?)\](.*?)\[/img\]', r'<img src="\1" alt="\2">'),
-        (r'\[color=([a-zA-Z]*|\#?[0-9a-fA-F]{6})\](.+?)\[/color\]', r'<span style="color:\1">\2</span>'),
-        (r'\[b\](.+?)\[/b\]', r'<strong>\1</strong>'),
-        (r'\[i\](.+?)\[/i\]', r'<em>\1</em>'),
-        (r'\[u\](.+?)\[/u\]', r'<u>\1</u>'),
-        (r'\[s\](.+?)\[/s\]', r'<strike>\1</strike>'),
+        (r'\[color=([a-zA-Z]*|\#?[0-9a-fA-F]{6})\](.*?)\[/color\]', r'<span style="color:\1">\2</span>'),
+        (r'\[b\](.*?)\[/b\]', r'<strong>\1</strong>'),
+        (r'\[i\](.*?)\[/i\]', r'<em>\1</em>'),
+        (r'\[u\](.*?)\[/u\]', r'<u>\1</u>'),
+        (r'\[s\](.*?)\[/s\]', r'<strike>\1</strike>'),
         (r'\[quote\](.*?)\[/quote\]', r'<blockquote>\1</blockquote>'),
         (r'\[quote=(.*?)\](.*?)\[/quote\]', r'<blockquote><em>\1</em> <br /> \2</blockquote>'),
         (r'\[center\](.*?)\[/center\]', r'<div style="text-align: center;">\1</div>'),
         (r'\[small\](.*?)\[/small\]', r'<small>\1</small>'),
         (r'\[list\](.*?)\[/list\]', r'<ul>\1</ul>'),
         (r'\[list\=(\d+)\](.*?)\[/list\]', r'<ol start="\1">\2</ol>'),
-        (r'\[\*\]\s?(.*?)', r'<li>\1</li>'),
+        (r'\[\*\](.*?)<br./>', r'<li>\1</li>'),
         (r'\[br\]', r'<br />') ]
 
 BBCODE_RULES += getattr(settings, 'BBMARKUP_EXTRA_RULES', [])
     return "<pre><code>%s</code></pre>" % value
 
 
-def bbcode(value, linebr=True, code_parser=code_parser):
+def bbcode(value, code_parser=code_parser):
     """
     >>> data = '[code]print "Lorem [b]imsum[b]"[/code]'
     >>> bbcode(data)
     """
 
     value = escape(value)
-    if linebr:
-        value = linebreaksbr(value)
-    value = re.sub(re.compile(r'\[code\](.+?)\[/code\]', re.DOTALL), code_parser, value)
+    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)