Changes between Version 2 and Version 3 of WikiMacros


Ignore:
Timestamp:
Oct 19, 2010, 6:58:29 AM (14 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • WikiMacros

    v2 v3  
    161161{{{
    162162#!python
    163     text = "whatever wiki markup you want, even containing other macros"
    164     # Convert Wiki markup to HTML, new style
    165     out = StringIO()
    166     Formatter(self.env, formatter.context).format(text, out)
    167     return Markup(out.getvalue())
     163from genshi.core import Markup
     164from trac.wiki.macros import WikiMacroBase
     165from trac.wiki import Formatter
     166import StringIO
     167
     168class HelloWorldMacro(WikiMacroBase):
     169        def expand_macro(self, formatter, name, text, args):
     170                text = "whatever '''wiki''' markup you want, even containing other macros"
     171                # Convert Wiki markup to HTML, new style
     172                out = StringIO.StringIO()
     173                Formatter(self.env, formatter.context).format(text, out)
     174                return Markup(out.getvalue())
    168175}}}