""" Creates a div with a CSS class for block formatting. Can be called like: {{{ #!Block (my-css-class) Some wiki content }}} Or: [[Block(my-css-class)]] Some wiki content [[Block]] Either will produce the same output. """ import re from trac.wiki.formatter import wiki_to_html style_re = re.compile(r'\(([\w\s]+)\)\n(.*)', re.S) def execute(hdf, txt, env): m = style_re.match(txt) if not m: if txt: return '
' % txt return '
' style, txt = m.groups() return '
%s
' % (style, wiki_to_html(txt, env, None))