trac-ticketlinks / wiki-macros / README

cboos b3980e2 
































cboos 01b2216 
Support for HDF-based macros has been dropped starting with Trac 0.11
as with the switch to the Genshi templating engine, the `hdf` data
prepared for the Clearsilver engine used upto Trac 0.10 has simply
disappeared.

This means that the old-style macros installed in the `wiki-macros` folder,
i.e. the Python source files containing the simple function:

  def execute(hdf, txt, env):
    ...

must be rewritten into new-style macros,
i.e. plugins implementing the IWikiMacroProvider interface.

This is not necessarily a complex task, given that:
 - the plugin can be a "single file plugin" which doesn't need to be
   configured to use setuptools. Creating a single .py source file
   and dropping it at the right place (the `plugins` folder next to 
   the old `wiki-macros` folder) also works;
 - instead of implementing the IWikiMacroProvider directly, 
   inheriting from the WikiMacroBase class also works well and is
   a bit more convenient.

Note that not only is this not more complex, but it's also much more
powerful, as the macro can now access the Wiki `formatter` object,
and through it, all the other objects that are meaningful in the
context of the Wiki text containing the macro call.

You can see how the examples for the old-style macros have been 
converted to the new-style macros (single file plugins), in the
`sample-plugins/HelloWorld.py` and `sample-plugins/Timestamp.py` files.

Note that the TracGuideToc macro has been integrated in the main
source code base (in `trac/wiki/macros.py`).
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.