Macros

Macros allow the insertion of system features into normal wiki pages; the only thing that makes those pages special is that they contain macros. If you edit pages like RecentChanges or SystemInfo, you'll see what that means.

Writing your own macro

Create a python file called MacroName.py located in your data/plugins/macro directory. Ensure it has a single method called execute(macro, arguments), which is the entry-point.

macro is an instance of class Macro, and also evaluates to a string of the macroname.

arguments is an arbitrary argument string you can pass in with parameters to your macro.

All Macro instances have a request member through which you can access the form parameters and other information related to user interaction.

execute() should use the formatter to construct valid markup for the current target format. In most cases this is HTML, so writing a macro which returns HTML will work in most cases but fail when formats like XML or text/plain are requested.