Changes between Version 1 and Version 2 of WikiMacros
- Timestamp:
- Aug 2, 2005, 12:07:43 PM (19 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
WikiMacros
v1 v2 1 1 = Wiki Macros = 2 Trac macros are plugins to extend the Trac engine with custom 'functions' written in Python. They allow insertion of custom dynamic HTML data in any modulesupporting WikiFormatting.2 Trac macros are plugins to extend the Trac engine with custom 'functions' written in Python. A macro inserts dynamic HTML data in any context supporting WikiFormatting. 3 3 4 4 Another kind of macros are WikiProcessors. They typically deal with alternate markup formats and representation of larger blocks of information (like source code highlighting). See also: WikiProcessors. … … 23 23 24 24 == Available Macros == 25 As of 0.6, macros are still a new feature in Trac, and the list of available (and distributed) macros is25 Macros are still a new feature, and the list of available (and distributed) macros is 26 26 admittedly not very impressive. In future Trac releases, we hope to build a library of useful macros, and will of course happily include contributed macros (see below). 27 27 … … 49 49 # MyMacro.py -- The world's simplest macro 50 50 51 def execute(hdf, args ):51 def execute(hdf, args, env): 52 52 return "Hello World called with args: %s" % args 53 53 }}} … … 59 59 60 60 Example: 61 62 61 {{{ 63 def execute(hdf, args ):62 def execute(hdf, args, env): 64 63 # Currently hdf is set only when the macro is called 65 64 # From a wiki page … … 72 71 }}} 73 72 73 You can also use the environment (env) object to access configuration data. 74 74 75 75 Example. 76 {{{ 77 def execute(hdf, txt, env): 78 return env.get_config('trac', 'repository_dir') 79 }}} 76 80 ---- 77 81 See also: WikiProcessors, WikiFormatting, TracGuide