Is there any mechanism available to call macros from within templates?
.
I guess you already tried the various incarnations of WikiInclude
macros/plugins and the TracWikiTemplates plugin, and that didn't work?
- Thomas
this would not work by design.
The requirements are:
* no need to modify the wikipages
* ability to switch the extension on/off (Component)
I've implemted this manually for the AutoNav Macro.
If the component "WikiBacklinks" is enabled, the AutoNav result
becomes available on every page:
http://dev.lazaridis.com/base/browser/infra/tracx/tracx/menus.py?rev=162#L110
But this is not a generic solution (e.g. applicable to the TracNav or
other macros), because i use a copy of the macro and insert it's
output over a variable into a custom template.
So my request is essentially, how would one implement such a solution
in a generic way?
class WikiApplyMacroToAllPages(Component):
# which event to claim
# how to access/call a macro
<access-path>.MacroName.<function>(<parameters>)
On Feb 2, 3:38 pm, "Ilias Lazaridis" <i...@lazaridis.com> wrote:
> I would like to provide a wiki template in order to include the
> TracNav Macro (and some others) by default.
>
> Is there any mechanism available to call macros from within templates?
I've implemented this based on a workaround, using
46 <div py:if="chrome.nav['tracnav']">
47 ${wiki_to_html('[[TracNav]]')}
48 </div>
http://dev.lazaridis.com/base/changeset/189
-
But this functionality should be provided somehow from within trac:
http://trac.edgewall.org/ticket/4660
-
as a side-question: How can I ask in the template, if one component is
enabled?
Something like:
<div py:if="tracx.menue.MyComponent.enabled">
.