WikiMacros - jbruechert/freetz.org GitHub Wiki

Trac Macros

Trac macros are plugins to extend the Trac engine with custom 'functions' written in Python. A macro inserts dynamic HTML data in any context supporting WikiFormatting. Its syntax is [[macro-name(optional-arguments)]].

The WikiProcessors are another kind of macros. They typically deal with alternate markup formats and transformation of larger "blocks" of information (like source code highlighting). They are used for processing the multiline {{{#!wiki-processor-name ... }}} blocks.

Using Macros

Macro calls are enclosed in two square brackets. Like Python functions, macros can also have arguments, a comma separated list within parentheses.

Getting Detailed Help

The list of available macros and the full help can be obtained using the MacroList macro, as seen below.

A brief list can be obtained via [[MacroList(*)]] or [[?]].

Detailed help on a specific macro can be obtained by passing it as an argument to MacroList, e.g. [[MacroList(MacroList)]], or, more conveniently, by appending a question mark (?) to the macro's name, like in [[MacroList?]].

Example

A list of 3 most recently changed wiki pages starting with 'Trac':

+-----------------------------------+-----------------------------------+ | Wiki Markup | Display | +===================================+===================================+ | {.wiki} | <div> | | [[RecentChanges(Trac,3)]] | | | | ### 03.11.2012 | | | | | | - TracIni | | | ([diff](/wiki/TracIni?action= | | | diff&version=6)) | | | - [TracSyntaxColoring](/wiki/Tr | | | acSyntaxColoring) | | | ([diff](/wiki/TracSyntaxColor | | | ing?action=diff&version=6)) | | | - TracAdmin | | | ([diff](/wiki/TracAdmin?actio | | | n=diff&version=6)) | | | | | |

| +-----------------------------------+-----------------------------------+ | {.wiki} | <div class="trac-macrolist"> | | [[RecentChanges?(Trac,3)]] | | | | ### [[RecentChanges]] | | | | | | List all pages that have recently | | | been modified, ordered by the | | | time they were last modified. | | | | | | This macro accepts two ordered | | | arguments and a named argument. | | | The named argument can be placed | | | in any position within the | | | argument list. | | | | | | The first parameter is a prefix | | | string: if provided, only pages | | | with names that start with the | | | prefix are included in the | | | resulting list. If this parameter | | | is omitted, all pages are | | | included in the list. | | | | | | The second parameter is the | | | maximum number of pages to | | | include in the list. | | | | | | The group parameter determines | | | how the list is presented: | | | | | | group=date | | | : The pages are presented in | | | bulleted lists that are | | | grouped by date (default). | | | | | | group=none | | | : The pages are presented in a | | | single bulleted list. | | | | | | | +-----------------------------------+-----------------------------------+
⚠️ **GitHub.com Fallback** ⚠️