| 1 | = TracLinks in reStructuredText = |
| 2 | |
| 3 | This document illustrates how to use the ``..trac::`` directive in reStructureThe page is written like |
| 4 | |
| 5 | {{{ |
| 6 | {{{ |
| 7 | #!rst |
| 8 | |
| 9 | Examples: |
| 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 (since version 0.10): :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 | }}} |
| 24 | }}} |
| 25 | |
| 26 | Provided you have docutils installed, the above block will render as: |
| 27 | ---- |
| 28 | {{{ |
| 29 | #!rst |
| 30 | |
| 31 | Examples: |
| 32 | * Tickets: :trac:`#1` or :trac:`ticket:1` |
| 33 | * Ticket comments: :trac:`comment:ticket:1:2` |
| 34 | * Reports: :trac:`{1}` or :trac:`report:1` |
| 35 | * Changesets: :trac:`r1`, :trac:`[1]` or :trac:`changeset:1` |
| 36 | * Revision log: :trac:`r1:3`, :trac:`[1:3]` or :trac:`log:@1:3`, :trac:`log:trunk@1:3` |
| 37 | * Diffs (since version 0.10): :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` |
| 38 | * Wiki pages: :trac:`CamelCase` or :trac:`wiki:CamelCase` |
| 39 | * Milestones: :trac:`milestone:1.0` |
| 40 | * Attachment: :trac:`attachment:ticket:944:attachment.1073.diff` |
| 41 | * Files: :trac:`source:trunk/COPYING` |
| 42 | * A specific file revision: :trac:`source:/trunk/COPYING@200` |
| 43 | * A particular line of a specific file revision: :trac:`source:/trunk/COPYING@200#L25` |
| 44 | |
| 45 | }}} |
| 46 | ---- |
| 47 | |
| 48 | Note also that any of the above could have been written using the alternate syntax for roles: |
| 49 | {{{ |
| 50 | {{{ |
| 51 | #!rst |
| 52 | |
| 53 | See _`ticket:123` |
| 54 | |
| 55 | .. trac:: ticket:123 Ticket 123 |
| 56 | }}} |
| 57 | }}} |
| 58 | ---- |
| 59 | |
| 60 | {{{ |
| 61 | #!rst |
| 62 | |
| 63 | See _`ticket:123` |
| 64 | |
| 65 | .. trac:: ticket:123 Ticket 123 |
| 66 | }}} |
| 67 | ---- |
| 68 | The above form has the additional benefit of allowing you to specify an explicit label for the link. |
| 69 | |
| 70 | ---- |
| 71 | See also: WikiRestructuredText, TracLinks |