| 1 | [[PageOutline(2-5,Contents,pullout)]] |
| 2 | |
| 3 | = Simple but useful Trac macros = |
| 4 | |
| 5 | == Description == |
| 6 | |
| 7 | Expand Trac capabilities by embedding simple snippets in wiki pages using simple macros. |
| 8 | |
| 9 | ==== !ConfigOptionMacro ==== |
| 10 | |
| 11 | Insert configuration options in Wiki pages |
| 12 | |
| 13 | Usage is as follows. |
| 14 | |
| 15 | `[[ConfigOption(section, name, type=option_type, sep=char)]]` |
| 16 | |
| 17 | - ''section'' : the section in trac.ini (mandatory) |
| 18 | - ''name'' : option name (mandatory) |
| 19 | - ''type'' : if this keyword argument is present then |
| 20 | the value will be rendered using an |
| 21 | appropriate format according to the option |
| 22 | type. Supported values are `text` (default), |
| 23 | `bool`, `int`, `list`, `path`, `extension`. |
| 24 | - ''sep'' : list separator (otional, ignored if |
| 25 | `type`! = `list`) |
| 26 | |
| 27 | ==== !WikiHistoryMacro ==== |
| 28 | |
| 29 | Embed information about wiki changelog in wiki pages. |
| 30 | If invoked without keyword arguments then full |
| 31 | changelog is shown inside a table with columns |
| 32 | `Date`, `Version`, `Description, `Author`. Please |
| 33 | read below for further details. |
| 34 | |
| 35 | Usage is as follows (all fields are optional). |
| 36 | |
| 37 | `[[WikiHistory(pagename, version, attr=attr_name, cols=columns)]]` |
| 38 | |
| 39 | - ''pagename'' : the name of target Wiki page. If missing or empty |
| 40 | and a wiki page is being rendered then it defaults to |
| 41 | the current wiki page. If the page being rendered |
| 42 | doesn't belong in the Wiki then `WikiStart` is used instead. |
| 43 | - ''version'' : consider changes prior to (and including) this version |
| 44 | - ''attr'' : if this keyword argument is present then only the value |
| 45 | of the version attribute identified by `attr_name` is |
| 46 | rendered in textual form (and `cols` argument is ignored) |
| 47 | Supported values are `time`, `version`, |
| 48 | `comment`, and `author` |
| 49 | - ''cols'' : colon separated list of identifiers used to select |
| 50 | specific columns (order matters). Identifiers are |
| 51 | the same supported for `attr` parameter. |
| 52 | |
| 53 | |
| 54 | == Bugs/Feature Requests == |
| 55 | |
| 56 | Existing bugs and feature requests for TracBasicMacro are |
| 57 | [report:9?COMPONENT=TracBasicMacro here]. |
| 58 | |
| 59 | If you have any issues, create a |
| 60 | [http://trac-hacks.org/newticket?component=TracBasicMacro&owner=olemis new ticket]. |
| 61 | |
| 62 | == Download == |
| 63 | |
| 64 | Download the zipped source from [download:tracbasicmacro here]. |
| 65 | |
| 66 | == Source == |
| 67 | |
| 68 | You can check out TracBasicMacro from [http://trac-hacks.org/svn/tracbasicmacro here] using Subversion, or [source:tracbasicmacro browse the source] with Trac. |
| 69 | |
| 70 | == Example == |
| 71 | |
| 72 | - `[[ConfigOption(project, name)]]` displays project name. |
| 73 | - `[[WikiHistory]]` lists versions of current wiki page (or |
| 74 | `WikiStart` if wiki text inserted elsewhere e.g. in a ticket's comment) |
| 75 | - `[[WikiHistory(,4)]]` lists versions of current wiki page (or |
| 76 | `WikiStart` if wiki text inserted elsewhere e.g. in a ticket's comment) |
| 77 | up to version 4 |
| 78 | - `[[WikiHistory(TracGuide,cols=time:version:author)]]` lists versions |
| 79 | of `TracGuide` wiki page but hides user comments. |
| 80 | - `[[WikiHistory(,cols=time:comment)]]` lists versions of current |
| 81 | wiki page (or `WikiStart` if wiki text inserted elsewhere e.g. in a |
| 82 | ticket's comment). Only shows modification time and user comment. |
| 83 | - `[[WikiHistory(TracGuide,19,cols=time:comment)]]` lists versions of |
| 84 | `TracGuide` wiki page up to version 19. Only shows modification time |
| 85 | and user comment. |
| 86 | - `[[WikiHistory(,attr=time)]]` displays last modification time of current |
| 87 | wiki page (or `WikiStart` if wiki text inserted elsewhere e.g. in a |
| 88 | ticket's comment) |
| 89 | - `[[WikiHistory(TracPermissions,2,attr=time)]]` displays modification time of |
| 90 | version 2 of `TracPermissions` wiki page. |
| 91 | |
| 92 | |
| 93 | == Recent Changes == |
| 94 | |
| 95 | [[ChangeLog(tracbasicmacro, 3)]] |
| 96 | |
| 97 | == Author/Contributors == |
| 98 | |
| 99 | '''Author:''' [wiki:olemis] [[BR]] |
| 100 | '''Maintainer:''' [wiki:olemis] [[BR]] |
| 101 | '''Contributors:''' |