Commits

David Cramer committed 84a82ad

Added the ability to do [quote=Cite]

  • Participants
  • Parent commits 727fc62

Comments (0)

Files changed (1)

bbcode/bbtags/text_formatting.py

     
     Usage:
     
-    [code lang=bbdocs linenos=0][quote]Text[/quote][/code]
+    [code lang=bbdocs linenos=0][quote]Text[/quote]
+[quote="Foo"]Text[/quote][/code]
     """
-    open_pattern = re.compile(patterns.no_argument % 'quote')
+    open_pattern = re.compile(r'(\[quote\]|\[quote[\s=]"?(?P<cite>[^\]]+)"?\])')
     close_pattern = re.compile(patterns.closing % 'quote')
     
     def parse(self):
+        gd = self.match.groupdict()
+        if gd['cite']:
+            return '<div class="quote"><cite>%s</cite>%s</div>' % (gd['cite'], self.parse_inner())
         return '<div class="quote">%s</div>' % self.parse_inner()