Changes between Version 2 and Version 3 of WikiMacros


Ignore:
Timestamp:
2006-12-26T03:44:57Z (18 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • WikiMacros

    v2 v3  
    55
    66== Using Macros ==
    7 Macro calls are enclosed in two ''square brackets''. Like python functions, macros can also have arguments, a comma separated list within parentheses.
     7Macro calls are enclosed in two ''square brackets''. Like Python functions, macros can also have arguments, a comma separated list within parentheses.
    88
    99=== Examples ===
     
    2828
    2929== Macros from around the world ==
    30 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.
    3130
    32 ----
     31The [http://trac-hacks.org/ Trac Hacks] site provides a wide collection of macros and other Trac [TracPlugins plugins] contributed by the Trac community. If you're looking for new macros, or have written one that you'd like to share with the world, please don't hesitate to visit that site.
    3332
    3433== Developing Custom Macros ==
    35 Macros, like Trac itself, are written in the [http://www.python.org/ Python programming language]. They are very simple modules, identified by the filename and should contain a single ''entry point'' function. Trac will display the returned data inserted into the HTML where the macro was called.
     34Macros, like Trac itself, are written in the [http://www.python.org/ Python programming language]. They are very simple modules, identified by the filename and should contain a single `execute()` function. Trac will display the returned data inserted into the HTML representation of the Wiki page where the macro is called.
    3635
    3736It's easiest to learn from an example:
     
    4847#!python
    4948def execute(hdf, txt, env):
    50     return env.get_config('trac', 'repository_dir')
     49    return env.config.get('trac', 'repository_dir')
    5150}}}
    5251
    53 Note that since version 0.9, wiki macros can also be written as TracPlugins. This gives them some capabilities than “classic” macros do not have, such as directly access the HTTP request.
     52Note that since version 0.9, wiki macros can also be written as TracPlugins. This gives them some capabilities that “classic” macros do not have, such as being able to directly access the HTTP request.
    5453
    5554For more information about developing macros, see the [http://projects.edgewall.com/trac/wiki/TracDev development resources] on the main project site.