# -*- coding: utf-8 -*- # # Copyright (C) 2013 Yasumichi Akashoshi # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # from genshi.core import Markup from trac.core import * from trac.web.chrome import ITemplateProvider, add_stylesheet from trac.wiki.macros import WikiMacroBase from trac.wiki import Formatter import StringIO class AdmonitionMacro(WikiMacroBase): """Admonition""" implements(ITemplateProvider) revision = "$Rev$" url = "$URL$" def expand_macro (self, formatter, name, text, args): # Make sure data capsule is in place if not hasattr(formatter, '_admonition'): formatter._admonition = [] # Chrome add_stylesheet(formatter.req, 'admonition/admonition.css') type = 'note' # Get type if 'type' in args: if args['type'].lower() in ['note', 'warning', 'important']: type = args['type'].lower() # Build Markup html = '