Version 9 (modified by 9 years ago) (diff) | ,
---|
Contents
Some 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.
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. Ccurrently 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:
[[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 globalOption
's registry).[[ConfigOption(olemis, simelo, type=text)]]
displays the specified text.[[ConfigOption(timeline, default_daysback, type=int)]]
displays default number of days displayed in theTimeline
, in days. Integers are displayed like this30
.[[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.
For up-to-date 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 (orWikiStart
if wiki text inserted elsewhere e.g. in a ticket's comment).[[WikiHistory(,4)]]
lists versions of current wiki page (orWikiStart
if wiki text inserted elsewhere e.g. in a ticket's comment) up to version 4.[[WikiHistory(TracGuide,cols=time:version:author)]]
lists versions ofTracGuide
wiki page but hides user comments.[[WikiHistory(,cols=time:comment)]]
lists versions of current wiki page (orWikiStart
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 ofTracGuide
wiki page up to version 19. Only shows modification time and user comment.[[WikiHistory(,attr=time)]]
displays last modification time of current wiki page (orWikiStart
if wiki text inserted elsewhere e.g. in a ticket's comment)[[WikiHistory(TracPermissions,2,attr=time)]]
displays modification time of version 2 ofTracPermissions
wiki page.
Author/Contributors
Author: Olemis Lang
Maintainer: Olemis Lang
Contributors: