How to convert Macros?

85 views
Skip to first unread message

mb

unread,
Jan 22, 2007, 7:09:10 AM1/22/07
to Trac Development
Hi,

following a problem I had with rendering diffs between wiki pages, I
upgraded to r4612.

BUT: Now all installed Macros do not work anymore, as they are not
found Error:
Error: Failed to load processor HelloWorld
No macro or processor named 'HelloWorld' found

They are installed in [project_env]/wiki-macros.

They worked until r4450.

I found out, that the macros have now to be redesigned and placed into
the plugin folder.
I tried that with the WikiInclude Macro. But I didn't get it to work,
since there was no easy
way to map the parameters of the execute and render_macro methods.

Has anybody a quick fix or
a pointer to where I can get a "mapping" between the old and the
parameters or
is there a way to make the old macros work?

TIA
Max

Alec Thomas

unread,
Jan 22, 2007, 7:15:24 AM1/22/07
to trac...@googlegroups.com

As you've noticed, macros must now be implemented as plugins.

Check out trac/wiki/macros.py. TitleIndexMacro is a good example.

Your "macro" plugin can use WikiMacroBase as a foundation.

--
Evolution: Taking care of those too stupid to take care of themselves.

mb

unread,
Jan 22, 2007, 8:54:24 AM1/22/07
to Trac Development
Hi,

thanks for the quick reply. I already looked at the source code, but
that didn't help me as much as needed.

The main problem is/was the mapping between the parameters.
It seems that the following mappings work:

execute:txt -> render_macro:args
execute:env -> render_macro:self.env

render_macro(0.10):req -> render_macro(0.11):formatter.req

At least, using these mappings, I got the WikiInclude Macro and the
Graphviz Plugin to work in our environment.

I hope these mappings are correct and they help other users facing this
problem.
Max

Reply all
Reply to author
Forward
0 new messages