| 1 |
Support for HDF-based macros has been dropped starting with Trac 0.11 |
|---|
| 2 |
as with the switch to the Genshi templating engine, the `hdf` data |
|---|
| 3 |
prepared for the Clearsilver engine used upto Trac 0.10 has simply |
|---|
| 4 |
disappeared. |
|---|
| 5 |
|
|---|
| 6 |
This means that the old-style macros installed in the `wiki-macros` folder, |
|---|
| 7 |
i.e. the Python source files containing the simple function: |
|---|
| 8 |
|
|---|
| 9 |
def execute(hdf, txt, env): |
|---|
| 10 |
... |
|---|
| 11 |
|
|---|
| 12 |
must be rewritten into new-style macros, |
|---|
| 13 |
i.e. plugins implementing the IWikiMacroProvider interface. |
|---|
| 14 |
|
|---|
| 15 |
This is not necessarily a complex task, given that: |
|---|
| 16 |
- the plugin can be a "single file plugin" which doesn't need to be |
|---|
| 17 |
configured to use setuptools. Creating a single .py source file |
|---|
| 18 |
and dropping it at the right place (the `plugins` folder next to |
|---|
| 19 |
the old `wiki-macros` folder) also works; |
|---|
| 20 |
- instead of implementing the IWikiMacroProvider directly, |
|---|
| 21 |
inheriting from the WikiMacroBase class also works well and is |
|---|
| 22 |
a bit more convenient. |
|---|
| 23 |
|
|---|
| 24 |
Note that not only is this not more complex, but it's also much more |
|---|
| 25 |
powerful, as the macro can now access the Wiki `formatter` object, |
|---|
| 26 |
and through it, all the other objects that are meaningful in the |
|---|
| 27 |
context of the Wiki text containing the macro call. |
|---|
| 28 |
|
|---|
| 29 |
You can see how the examples for the old-style macros have been |
|---|
| 30 |
converted to the new-style macros (single file plugins), in the |
|---|
| 31 |
`sample-plugins/HelloWorld.py` and `sample-plugins/Timestamp.py` files. |
|---|
| 32 |
|
|---|
| 33 |
Note that the TracGuideToc macro has been integrated in the main |
|---|
| 34 |
source code base (in `trac/wiki/macros.py`). |
|---|