| 1 | [[PageOutline(2-5,Contents,pullout)]] |
| 2 | |
| 3 | = Help Macros and Plugins with trac.ini lookup and defaulting = |
| 4 | |
| 5 | == Description == |
| 6 | |
| 7 | ''By itself, this modules does not provide any functionality.''' |
| 8 | |
| 9 | This module provides a helper class which can be used by other plugins, |
| 10 | especially macros, in retrieving optional arguments from trac.ini. |
| 11 | |
| 12 | A macro using this module, can be called with a '''config=xxx''' option, |
| 13 | to retrieve a set of options which in trac.ini all start with prefix '''xxx.''' |
| 14 | |
| 15 | Inheritance is supported, by writing an option '''xxx.inherit = yyy''' in trac.ini - all macro options not yet determined, are then searched with the |
| 16 | other prefix, '''yyy.''' |
| 17 | |
| 18 | Multiple inheritance is supported, by writing '''config=prefixA|prefixB''' in the macro invocation, or writing an '''xxx.inherit = prefixC|prefixD''' option in trac.ini |
| 19 | |
| 20 | The macro module which uses this functionality, specifies a list of expected options, as well as their defaults. These defaults will then be used when the respective option is specified nowhere. |
| 21 | |
| 22 | == Example == |
| 23 | |
| 24 | Right now, as this is brand new, no plugin / macro uses the functionality. |
| 25 | |
| 26 | There is an '''examlemacro.py''' file included in the distribution, which when enabled through the admin plugings interface, provides a macro named '''!TracMacroConfigExample''', which displays a table detailling various interesting things about concrete option lookups. This allows you to play with macro arguments and in a corresponding '''[macroconfig-example]''' section in trac.ini, |
| 27 | to play with inheritance setups. |
| 28 | |
| 29 | This is how exemplary calls to that macro would be written in a wiki page: |
| 30 | {{{ |
| 31 | [[TracMacroConfigExample(config=class-c, extra=more stuff)]] |
| 32 | }}} |
| 33 | |
| 34 | Use this together with a trac.ini section like this: |
| 35 | {{{ |
| 36 | #!ini |
| 37 | [macroconfig-example] |
| 38 | class-a.bool = True |
| 39 | class-a.text = A Text |
| 40 | class-b.bool = False |
| 41 | class-b.int = 73 |
| 42 | class-c.config = class-a|class-b |
| 43 | class-c.list = knees|toes |
| 44 | }}} |
| 45 | |
| 46 | == Bugs/Feature Requests == |
| 47 | |
| 48 | Existing bugs and feature requests for TracMacroConfigPlugin are [report:9?COMPONENT=TracMacroConfigPlugin here]. |
| 49 | |
| 50 | If you have any issues, create a [http://trac-hacks.org/newticket?component=TracMacroConfigPlugin&owner=bof new ticket]. |
| 51 | |
| 52 | == Download == |
| 53 | |
| 54 | Download the zipped source from [download:tracmacroconfigplugin here]. |
| 55 | |
| 56 | == Source == |
| 57 | |
| 58 | You can check out TracMacroConfigPlugin from [http://trac-hacks.org/svn/tracmacroconfigplugin here] using Subversion, or [source:tracmacroconfigplugin browse the source] with Trac. |
| 59 | |
| 60 | == Recent Changes == |
| 61 | |
| 62 | [[ChangeLog(tracmacroconfigplugin, 3)]] |
| 63 | |
| 64 | == Author/Contributors == |
| 65 | |
| 66 | '''Author:''' [wiki:bof] [[BR]] |
| 67 | '''Maintainer:''' [wiki:bof] [[BR]] |
| 68 | '''Sponsor:''' [http://www.yalwa.de/ Yalwa Branchenbuch] [[BR]] |
| 69 | '''Contributors:''' |