wiki:TracBasicMacro

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

URLs to TracBasicMacros Bb repos

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 (and cols argument is ignored) Supported values are time, version, comment, and author
  • 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 (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: