| 8 | |
| 9 | As an example |
| 10 | The definition of this plugin is as follows: |
| 11 | |
| 12 | {{{#!python |
| 13 | from tracextracturl import extract_url |
| 14 | # ... |
| 15 | url = extract_url (env, context, wikilink, raw=False) |
| 16 | }}} |
| 17 | |
| 18 | The optional argument `raw` controls whether the returned link should point to a brows-able (False) or download-able (True) target. The value True can be used in image or similar tags. False is the default value. |
| 19 | |
| 20 | As an example you could have this: |
| 21 | |
| 22 | {{{#!python |
| 23 | from tracextracturl import extract_url |
| 24 | |
| 25 | def MyMacro(WikiMacroBase): |
| 26 | def expand_macro (self, formatter, name, content): |
| 27 | # e.g. wikilink = 'wiki:WikiStart' |
| 28 | url = extract_url(self.env, formatter.context, wikilink) |
| 29 | }}} |
33 | | == Example |
34 | | |
35 | | The definition of this plugin is as follows: |
36 | | |
37 | | {{{#!python |
38 | | from tracextracturl import extract_url |
39 | | # ... |
40 | | url = extract_url (env, context, wikilink, raw=False) |
41 | | }}} |
42 | | |
43 | | The optional argument `raw` controls whether the returned link should point to a brows-able (False) or download-able (True) target. The value True can be used in image or similar tags. False is the default value. |
44 | | |
45 | | As an example you could have this: |
46 | | |
47 | | {{{#!python |
48 | | from tracextracturl import extract_url |
49 | | |
50 | | def MyMacro(WikiMacroBase): |
51 | | def expand_macro (self, formatter, name, content): |
52 | | # e.g. wikilink = 'wiki:WikiStart' |
53 | | url = extract_url(self.env, formatter.context, wikilink) |
54 | | }}} |
55 | | |