wiki:TracBasicMacro

Version 5 (modified by Olemis Lang, 14 years ago) (diff)

Hah !!!

Simple but useful Trac macros

Description

Expand Trac capabilities by embedding simple snippets in wiki pages using simple macros.

ConfigOptionMacro

Insert configuration options in Wiki pages

WikiHistoryMacro

Embed information about wiki changelog in wiki pages. If invoked without keyword arguments then 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.

Download

Download the zipped source from here.

Source

You can check out TracBasicMacro from its Bitbucket repository using Mercurial (currently it's not possible to browse the source with Trac :-/.

Example

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

[components]
tracbmacros.* = enabled

All the macros will be ready to use in your Trac environment. For up-to-date documentation consult TracMacros page in your local 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 something like Missing ? ;o)
  • [[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)]] Display a list of metanav options. Output looks like this
  • login
  • search
  • help
  • [[ConfigOption(trac, permission_store, type=extension)]] display the component responsible of storing user permissions.
  • [[ConfigOption(trac, permission_policies, type=extension_list)]] display active permission policies.
  • [[ConfigOption(trac, permission_policies, type=extension_list, include_missing=true)]] display all permission policies, active first.

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 * in order to make reference respectively to a particular option, all options in a section , or any option. For instance, the configuration shown below

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

Recent Changes

17932 by rjollos on 2020-12-10 22:05:06
Remove unnecessary files and convert line endings
17930 by rjollos on 2020-12-10 19:55:18
Add source to repository
8268 by olemis on 2010-07-15 19:19:09
New hack TracBasicMacro, created by olemis
(more)

Author/Contributors

Author: Olemis Lang
Maintainer: Olemis Lang
Contributors: