Christian Boos wrote: > Hello, > > Gary Oberbrunner wrote: >> I'd like to write a new-style (v0.11, expand_macro) plug-in to return all the >> open and closed tickets for a given milestone: >> [[MilestoneInfo(Foo_2.1, Foo_2.0)]] >> (the second arg is the version to use when submitting a new ticket, see >> below) >> >> I'd like it to do exactly what this wiki markup does: >> >> ========================= >> Foo 2.1: >> >> '''Open tickets:''' >> [[TicketQuery(milestone=Foo_2.1&status!=closed)]] >> >> '''Closed tickets:''' >> [[TicketQuery(milestone=Foo_2.1&status=closed)]] >> >> You can submit a >> [http://www/trac/newticket?milestone=Foo_2.1&component=Foo&version=Foo_2.0 >> new >> ticket] here. >> ========================= >> >> Can I just have my macro expand the above wiki text after appropriate string >> substitution, or do I need to do the ticket queries myself using sql, and >> build up the resulting HTML? (I hope not) >> >> In other words, what should expand_macro return? Wiki markup, or HTML? > > HTML, or rather a Markup string. This is what wiki_to_html () returns, > so you could just build the wiki markup text above, call wiki_to_html() > on it and return that.
Just for the archives: I found a way to do this without using the deprecated wiki_to_html method: # Convert Wiki markup to HTML, new style out = StringIO() Formatter(formatter.context).format(text, out) return Markup(out.getvalue()) Perhaps the Formatter object could have a new wiki_to_html() method that would just do the above code? Seems like a common need, and it was easy the old way. -- Gary --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Trac Users" group. To post to this group, send email to trac-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/trac-users?hl=en -~----------~----~----~----~------~----~------~--~---