All pastes #24401 Raw Edit

Python

public python v1 · immutable
#24401 ·published 2005-10-01 22:00 UTC
rendered paste body
"""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 refrom trac.wiki.formatter import wiki_to_htmlstyle_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 '<div class="%s">' % txt        return '</div>'    style, txt = m.groups()    return '<div class="%s">%s</div>' % (style, wiki_to_html(txt, env, None))