wiki:TracBasicMacro

Some useful Trac macros

Description

This collection of macros extends Trac's capabilities. It works by embedding these snippets in Trac wiki pages:

ConfigOptionMacro

Insert configuration options in Wiki pages.

WikiHistoryMacro

Embed information about wiki changelog in wiki pages. If invoked without keyword arguments then the full changelog is shown inside a table with columns Date, Version, Description, Author. Please read below for further details.

Bugs/Feature Requests

Existing bugs and feature requests for TracBasicMacro are here.

If you have any issues, create a new ticket.

If you want to submit patches, please read the patch submission guidelines.

Download

Download the zipped source from PyPI.

Source

You can check out TracBasicMacro from its Bitbucket repository using Mercurial.

Example

Install the plugin and enable TracBasicMacros plugin by inserting the following lines in your trac.ini file:

[components]
tracbmacros.* = enabled

All the macros will be ready to use in your Trac environment:

  • [[ConfigOption(project, name)]] displays project name.
  • [[ConfigOption(trac, auto_reload, type=bool)]] displays a check-box indicating whether the option is set or not.
  • [[ConfigOption(trac, auto_reload)]] idem. the macro is able to lookup metadata describing the option (if it's registered in the global Option's registry).
  • [[ConfigOption(olemis, simelo, type=text)]] displays the specified text.
  • [[ConfigOption(timeline, default_daysback, type=int)]] displays default number of days displayed in the Timeline, in days. Integers are displayed like this 30.
  • [[ConfigOption(trac, metanav, type=list)]] displays a list of metanav options and looks like this:
    • login
    • search
    • help
  • [[ConfigOption(trac, permission_store, type=extension)]] displays the component responsible of storing user permissions.
  • [[ConfigOption(trac, permission_policies, type=extension_list)]] displays active permission policies.
  • [[ConfigOption(trac, permission_policies, type=extension_list, include_missing=true)]] displays all permission policies, active first.

For the latest documentation consult TracMacros page in your local environment.

Important: Administrator must specify permissions (i.e. permission names) needed to view a particular configuration option by adding entries under config-perm section in trac.ini. Option names will be of the form section.option, section.* or * to make reference respectively to a particular option, all options in a section, or any option. For instance, the following configuration:

[config-perm]
* = TRAC_ADMIN
project.* = WIKI_VIEW
project.name = *

will allow users with TRAC_ADMIN privilege to see any option, whereas all those able to read wiki pages may see any option under project section. Finally, any user will be able to see the project name.

  • [[WikiHistory]] lists versions of current wiki page (or WikiStart if wiki text inserted elsewhere e.g. in a ticket's comment).
  • [[WikiHistory(,4)]] lists versions of current wiki page (or WikiStart if wiki text is inserted elsewhere e.g. in a ticket's comment) up to version 4.
  • [[WikiHistory(TracGuide,cols=time:version:author)]] lists versions of TracGuide wiki page but hides user comments.
  • [[WikiHistory(,cols=time:comment)]] lists versions of current wiki page (or WikiStart if wiki text inserted elsewhere e.g. in a ticket's comment). Only shows modification time and user comment.
  • [[WikiHistory(TracGuide,19,cols=time:comment)]] lists versions of TracGuide wiki page up to version 19. Only shows modification time and user comment.
    • [[WikiHistory(,attr=time)]] displays last modification time of current wiki page (or WikiStart if wiki text inserted elsewhere e.g. in a ticket's comment)
    • [[WikiHistory(TracPermissions,2,attr=time)]] displays modification time of version 2 of TracPermissions wiki page.

Author/Contributors

Author: Olemis Lang
Maintainer: Olemis Lang
Contributors:

Last modified 9 months ago Last modified on Jan 16, 2016, 7:20:54 AM