MCProxy

Changes between Version 1 and Version 2 of WikiMacros


Ignore:
Timestamp:
02/19/15 12:54:28 (10 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • WikiMacros

    v1 v2  
    33[[PageOutline]]
    44
    5 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.
     5Trac 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. Its syntax is `[[macro-name(optional-arguments)]]`.
    66
    7 Another kind of macros are WikiProcessors. They typically deal with alternate markup formats and representation of larger blocks of information (like source code highlighting).
     7The WikiProcessors are another kind of macros. They typically deal with alternate markup formats and transformation of larger "blocks" of information (like source code highlighting). They are used for processing the multiline `{{{#!wiki-processor-name ... }}}` blocks.
    88
    99== Using Macros ==
     
    1414The list of available macros and the full help can be obtained using the !MacroList macro, as seen [#AvailableMacros below].
    1515
    16 A brief list can be obtained via ![[MacroList(*)]] or ![[?]].
     16A brief list can be obtained via `[[MacroList(*)]]` or `[[?]]`.
    1717
    18 Detailed help on a specific macro can be obtained by passing it as an argument to !MacroList, e.g. ![[MacroList(MacroList)]], or, more conveniently, by appending a question mark (?) to the macro's name, like in ![[MacroList?]].
     18Detailed help on a specific macro can be obtained by passing it as an argument to !MacroList, e.g. `[[MacroList(MacroList)]]`, or, more conveniently, by appending a question mark (`?`) to the macro's name, like in `[[MacroList?]]`.
    1919
    2020
     
    7777For more information about developing macros, see the [trac:TracDev development resources] on the main project site.
    7878
    79 
    80 Here are 2 simple examples showing how to create a Macro with Trac 0.11.
    81 
    82 Also, have a look at [trac:source:tags/trac-0.11/sample-plugins/Timestamp.py Timestamp.py] for an example that shows the difference between old style and new style macros and at the [trac:source:tags/trac-0.11/wiki-macros/README macros/README] which provides a little more insight about the transition.
     79Here are 2 simple examples showing how to create a Macro. Also, have a look at [trac:source:tags/trac-1.0.2/sample-plugins/Timestamp.py Timestamp.py] for an example that shows the difference between old style and new style macros and at the [trac:source:tags/trac-0.11/wiki-macros/README macros/README] which provides a little more insight about the transition.
    8380
    8481=== Macro without arguments ===
     
    10299    def expand_macro(self, formatter, name, text):
    103100        t = datetime.now(utc)
    104         return tag.b(format_datetime(t, '%c'))
     101        return tag.strong(format_datetime(t, '%c'))
    105102}}}
    106103
     
    148145For example, when writing:
    149146{{{
    150 {{{#!HelloWorld style="polite"
     147{{{#!HelloWorld style="polite" -silent verbose
    151148<Hello World!>
    152149}}}
     
    160157One should get:
    161158{{{
    162 Hello World, text = <Hello World!> , args = {'style': u'polite'}
     159Hello World, text = <Hello World!> , args = {'style': u'polite', 'silent': False, 'verbose': True}
    163160Hello World, text = <Hello World!> , args = {}
    164161Hello World, text = <Hello World!> , args = None