wiki:TracBasicMacro

Version 2 (modified by olemis, 4 years ago) (diff)

Say my name , say my name , now that it's written in the wiki page . Say my name , say my name ...

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 here using Subversion, or 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

[8268] by olemis on 2010-07-15 21:19:09
New hack TracBasicMacro, created by olemis

Author/Contributors

Author: Olemis Lang
Maintainer: Olemis Lang
Contributors: