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:

  • [[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.

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.

  • [[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.

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

Bugs/Feature Requests

Existing bugs and feature requests for TracBasicMacro are here.

If you have any issues, create a new ticket.

Download

Download the zipped source from here.

The macro is also available on PyPI.

Source

You can check out TracBasicMacro from here using Subversion, or browse the source with Trac.

Installation

General instructions on installing Trac plugins can be found on the TracPlugins page.

When installed enable it by inserting the following lines in your trac.ini file:

[components]
tracbmacros.* = enabled

Configuration

Administrators 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.

Author/Contributors

Author: Olemis Lang
Maintainer: Olemis Lang
Contributors:

Last modified 2 years ago Last modified on Feb 20, 2022, 8:57:46 AM