| 1 | = TracLinks in reStructuredText = |
| 2 | [[TracGuideToc]] |
| 3 | |
| 4 | This document illustrates how to use the `:trac:` role in [http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html reStructuredText]. The page is written like: |
| 5 | |
| 6 | {{{ |
| 7 | {{{#!rst |
| 8 | Examples: |
| 9 | |
| 10 | * Tickets: :trac:`#1` or :trac:`ticket:1` |
| 11 | * Ticket comments: :trac:`comment:ticket:1:2` |
| 12 | * Reports: :trac:`{1}` or :trac:`report:1` |
| 13 | * Changesets: :trac:`r1`, :trac:`[1]` or :trac:`changeset:1` |
| 14 | * Revision log: :trac:`r1:3`, :trac:`[1:3]` or :trac:`log:@1:3`, :trac:`log:trunk@1:3` |
| 15 | * Diffs: :trac:`diff:@20:30`, :trac:`diff:tags/trac-0.9.2/wiki-default//tags/trac-0.9.3/wiki-default` or :trac:`diff:trunk/trac@3538//sandbox/vc-refactoring/trac@3539` |
| 16 | * Wiki pages: :trac:`CamelCase` or :trac:`wiki:CamelCase` |
| 17 | * Milestones: :trac:`milestone:1.0` |
| 18 | * Attachment: :trac:`attachment:ticket:944:attachment.1073.diff` |
| 19 | * Files: :trac:`source:trunk/COPYING` |
| 20 | * A specific file revision: :trac:`source:/trunk/COPYING@200` |
| 21 | * A particular line of a specific file revision: :trac:`source:/trunk/COPYING@200#L25` |
| 22 | |
| 23 | An explicit label can be specified, separated from the link by a space: |
| 24 | |
| 25 | * See :trac:`#1 ticket 1` and the :trac:`source:trunk/COPYING license`. |
| 26 | }}} |
| 27 | }}} |
| 28 | |
| 29 | Provided you have [http://docutils.sourceforge.net/ docutils] installed, the above block will render as: |
| 30 | ---- |
| 31 | {{{#!rst |
| 32 | Examples: |
| 33 | |
| 34 | * Tickets: :trac:`#1` or :trac:`ticket:1` |
| 35 | * Ticket comments: :trac:`comment:ticket:1:2` |
| 36 | * Reports: :trac:`{1}` or :trac:`report:1` |
| 37 | * Changesets: :trac:`r1`, :trac:`[1]` or :trac:`changeset:1` |
| 38 | * Revision log: :trac:`r1:3`, :trac:`[1:3]` or :trac:`log:@1:3`, :trac:`log:trunk@1:3` |
| 39 | * Diffs: :trac:`diff:@20:30`, :trac:`diff:tags/trac-0.9.2/wiki-default//tags/trac-0.9.3/wiki-default` or :trac:`diff:trunk/trac@3538//sandbox/vc-refactoring/trac@3539` |
| 40 | * Wiki pages: :trac:`CamelCase` or :trac:`wiki:CamelCase` |
| 41 | * Milestones: :trac:`milestone:1.0` |
| 42 | * Attachment: :trac:`attachment:ticket:944:attachment.1073.diff` |
| 43 | * Files: :trac:`source:trunk/COPYING` |
| 44 | * A specific file revision: :trac:`source:/trunk/COPYING@200` |
| 45 | * A particular line of a specific file revision: :trac:`source:/trunk/COPYING@200#L25` |
| 46 | |
| 47 | An explicit label can be specified, separated from the link by a space: |
| 48 | |
| 49 | * See :trac:`#1 ticket 1` and the :trac:`source:trunk/COPYING license`. |
| 50 | }}} |
| 51 | ---- |
| 52 | |
| 53 | Note that the above could have been written using substitution references and the `trac::` directive: |
| 54 | {{{ |
| 55 | {{{#!rst |
| 56 | See |ticket123|. |
| 57 | |
| 58 | .. |ticket123| trac:: ticket:123 this ticket |
| 59 | }}} |
| 60 | }}} |
| 61 | |
| 62 | This renders as: |
| 63 | ---- |
| 64 | |
| 65 | {{{#!rst |
| 66 | See |ticket123|. |
| 67 | |
| 68 | .. |ticket123| trac:: ticket:123 this ticket |
| 69 | }}} |
| 70 | |
| 71 | ---- |
| 72 | See also: WikiRestructuredText, TracLinks |