Changes between Version 1 and Version 2 of WikiMacros
- Timestamp:
- 09/16/05 00:03:53 (20 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
WikiMacros
v1 v2 5 5 6 6 == Using Macros == 7 Macro calls are enclosed in two ''square brackets''. Like python functions, macros can also have arguments, a comma separated list within parenthes is.7 Macro calls are enclosed in two ''square brackets''. Like python functions, macros can also have arguments, a comma separated list within parentheses. 8 8 9 9 === Examples === … … 21 21 [[HelloWorld(Testing)]] 22 22 23 == Available Macros == 23 24 24 == Available Macros == 25 Macros are still a new feature, and the list of available (and distributed) macros is 25 Macros are still a relatively 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 28 28 [[MacroList]] 29 29 30 31 ----32 33 34 30 == Macros from around the world == 35 The [http://projects.edgewall.com/trac/ Trac Project] has a section dedicated to user-contributed macros, [ http://projects.edgewall.com/trac/wiki/MacroBazaar MacroBazaar]. If you're looking for new macros, or have written new ones to share with the world, don't hesitate adding it to the [http://projects.edgewall.com/trac/wiki/MacroBazaar MacroBazaar] wiki page.31 The [http://projects.edgewall.com/trac/ Trac Project] has a section dedicated to user-contributed macros, [wiki:MacroBazaar MacroBazaar]. If you're looking for new macros, or have written new ones to share with the world, don't hesitate adding it to the [wiki:MacroBazaar MacroBazaar] wiki page. 36 32 37 33 http://projects.edgewall.com/trac/wiki/MacroBazaar … … 46 42 It's easiest to learn from an example: 47 43 {{{ 44 #!python 48 45 # MyMacro.py -- The world's simplest macro 49 46 … … 59 56 Example: 60 57 {{{ 58 #!python 61 59 def execute(hdf, args, env): 62 60 # Currently hdf is set only when the macro is called 63 # From a wiki page61 # from a wiki page. 64 62 if hdf: 65 63 hdf.setValue('wiki.macro.greeting', 'Hello World') 66 64 67 # args will be null if the macro is called without parent esis.65 # args will be null if the macro is called without parentheses. 68 66 args = args or 'No arguments' 69 67 return 'Hello World, args = ' + args … … 74 72 Example. 75 73 {{{ 74 #!python 76 75 def execute(hdf, txt, env): 77 return env. config.get('trac', 'repository_dir')76 return env.get_config('trac', 'repository_dir') 78 77 }}} 78 79 Here is information on the different WikiMacroObjects. 80 79 81 ---- 80 See also: WikiProcessors, WikiFormatting, TracGuide 82 See also: WikiProcessors, WikiFormatting, TracGuide, WikiMacroObjects
