| 1 | = Plug-in to extract URL from TracWiki links in Plug-ins and Macros = |
| 2 | |
| 3 | == Description == |
| 4 | |
| 5 | This plug-in provides the function `extract_url` which can be used in Trac plug-ins and macros to extract th URL of any TracWiki link for e.g. generation of links in produced HTML code. |
| 6 | |
| 7 | = Usage = |
| 8 | {{{ |
| 9 | #!python |
| 10 | from tracextracturl import extract_url |
| 11 | # ... |
| 12 | url = extract_url (env, context, wikilink, raw=False) |
| 13 | }}} |
| 14 | The argument `raw` controls if the returned link should point to a brows-able (False) or download-able (True) target. The second one can be used in image or similar tags. |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | == Bugs/Feature Requests == |
| 21 | |
| 22 | Existing bugs and feature requests for ExtractUrlPlugin are |
| 23 | [report:9?COMPONENT=ExtractUrlPlugin here]. |
| 24 | |
| 25 | If you have any issues, create a |
| 26 | [http://trac-hacks.org/newticket?component=ExtractUrlPlugin&owner=martin_s new ticket]. |
| 27 | |
| 28 | == Download == |
| 29 | |
| 30 | Download the zipped source from [download:extracturlplugin here]. |
| 31 | |
| 32 | == Source == |
| 33 | |
| 34 | You can check out ExtractUrlPlugin from [http://trac-hacks.org/svn/extracturlplugin here] using Subversion, or [source:extracturlplugin browse the source] with Trac. |
| 35 | |
| 36 | == Example == |
| 37 | |
| 38 | {{{ |
| 39 | #!python |
| 40 | from tracextracturl import extract_url |
| 41 | |
| 42 | def MyMacro(WikiMacroBase): |
| 43 | def expand_macro (self, formatter, name, content): |
| 44 | # e.g. wikilink = 'wiki:WikiStart' |
| 45 | url = extract_url(self.env, formatter.context, wikilink) |
| 46 | }}} |
| 47 | |
| 48 | |
| 49 | == Recent Changes == |
| 50 | |
| 51 | [[ChangeLog(extracturlplugin, 3)]] |
| 52 | |
| 53 | == Author/Contributors == |
| 54 | |
| 55 | '''Author:''' [wiki:martin_s] [[BR]] |
| 56 | '''Contributors:''' |