Version 3 (modified by 14 years ago) (diff) | ,
---|
Contents
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
Usage is as follows.
[[ConfigOption(section, name, type=option_type, sep=char)]]
- section : the section in trac.ini (mandatory)
- name : option name (mandatory)
- type : if this keyword argument is present then
the value will be rendered using an
appropriate format according to the option
type. Supported values are
text
(default),bool
,int
,list
,path
,extension
. - sep : list separator (otional, ignored if
type
! =list
)
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.
Usage is as follows (all fields are optional).
[[WikiHistory(pagename, version, attr=attr_name, cols=columns)]]
- pagename : the name of target Wiki page. If missing or empty
and a wiki page is being rendered then it defaults to
the current wiki page. If the page being rendered
doesn't belong in the Wiki then
WikiStart
is used instead. - version : consider changes prior to (and including) this version
- attr : if this keyword argument is present then only the value
of the version attribute identified by
attr_name
is rendered in textual form (andcols
argument is ignored) Supported values aretime
,version
,comment
, andauthor
- cols : colon separated list of identifiers used to select
specific columns (order matters). Identifiers are
the same supported for
attr
parameter.
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
[[ConfigOption(project, name)]]
displays 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.
Recent Changes
Author/Contributors
Author: Olemis Lang
Maintainer: Olemis Lang
Contributors: