On Tuesday, August 8, 2017 at 11:14:25 AM UTC-7, Peter Suter wrote:
>
> A slightly simpler version:
>
> from trac.wiki.macros import WikiMacroBase
> from trac.wiki.formatter import format_to_html
>
>
> class MyLinkMacro(WikiMacroBase):
>         def expand_macro(self, formatter, name, text, args):
>                 the_link = 
> '[myschema://myserver:1234/this/that/page?param1=value1&param2=value2&param3='
>  
> + text + '&param4=value4 ' + text + ']'
>
>                 return format_to_html(self.env, formatter.context, 
> the_link)
>

Seems like it would be a good idea to change the example code to use 
format_to_html, as in your example:
https://trac.edgewall.org/wiki/WikiMacros#Macrowitharguments

, unless the example is intended to be illustrative of something. 

Using format_to_html is effectively the same after two levels of 
indirection:
https://trac.edgewall.org/browser/tags/trac-1.2.2/trac/wiki/formatter.py?marks=1606#L1601
https://trac.edgewall.org/browser/tags/trac-1.2.2/trac/wiki/formatter.py?marks=1559-1562#L1541

What do you think?

- Ryan
 

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to trac-users+unsubscr...@googlegroups.com.
To post to this group, send email to trac-users@googlegroups.com.
Visit this group at https://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to