close
Warning:
BrowserModule failed with ConfigurationError: Look in the Trac log for more information.
- Timestamp:
-
Jul 9, 2015, 8:37:31 AM (9 years ago)
- Author:
-
trac
- Comment:
-
--
Legend:
- Unmodified
- Added
- Removed
- Modified
-
v3
|
v4
|
|
3 | 3 | [[PageOutline]] |
4 | 4 | |
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. |
| 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. Its syntax is `[[macro-name(optional-arguments)]]`. |
6 | 6 | |
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). |
| 7 | The 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. |
8 | 8 | |
9 | 9 | == Using Macros == |
… |
… |
|
14 | 14 | The list of available macros and the full help can be obtained using the !MacroList macro, as seen [#AvailableMacros below]. |
15 | 15 | |
16 | | A brief list can be obtained via ![[MacroList(*)]] or ![[?]]. |
| 16 | A brief list can be obtained via `[[MacroList(*)]]` or `[[?]]`. |
17 | 17 | |
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?]]. |
| 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?]]`. |
19 | 19 | |
20 | 20 | |
… |
… |
|
53 | 53 | <h3><code>[[Image]]</code></h3>Embed an image in wiki-formatted text. |
54 | 54 | |
55 | | The first argument is the file … |
| 55 | The first argument is the file … |
56 | 56 | <h3><code>[[InterTrac]]</code></h3>Provide a list of known <a class="wiki" href="/wiki/InterTrac">InterTrac</a> prefixes. |
57 | 57 | <h3><code>[[InterWiki]]</code></h3>Provide a description list for the known <a class="wiki" href="/wiki/InterWiki">InterWiki</a> prefixes. |
58 | 58 | <h3><code>[[KnownMimeTypes]]</code></h3>List all known mime-types which can be used as <a class="wiki" href="/wiki/WikiProcessors">WikiProcessors</a>. |
59 | | Can be …</div> |
| 59 | Can be …</div> |
60 | 60 | }}} |
61 | 61 | etc. |
… |
… |
|
102 | 102 | def expand_macro(self, formatter, name, text): |
103 | 103 | t = datetime.now(utc) |
104 | | return tag.b(format_datetime(t, '%c')) |
| 104 | return tag.strong(format_datetime(t, '%c')) |
105 | 105 | }}} |
106 | 106 | |
… |
… |
|
148 | 148 | For example, when writing: |
149 | 149 | {{{ |
150 | | {{{#!HelloWorld style="polite" |
| 150 | {{{#!HelloWorld style="polite" -silent verbose |
151 | 151 | <Hello World!> |
152 | 152 | }}} |
… |
… |
|
160 | 160 | One should get: |
161 | 161 | {{{ |
162 | | Hello World, text = <Hello World!> , args = {'style': u'polite'} |
| 162 | Hello World, text = <Hello World!> , args = {'style': u'polite', 'silent': False, 'verbose': True} |
163 | 163 | Hello World, text = <Hello World!> , args = {} |
164 | 164 | Hello World, text = <Hello World!> , args = None |