Skip to content

WikiRestructuredTextLinks

trac edited this page Mar 28, 2009 · 2 revisions

TracLinks in reStructuredText

This document illustrates how to use the <tt>..trac:: directive in reStructureThe page is written like

<pre>
#rst 

Examples:
*Tickets: :trac:<tt>#1</tt> or :trac:<tt>ticket:1</tt>
*Ticket comments: :trac:<tt>comment:ticket:1:2</tt>
*Reports: :trac:<tt>{1}</tt> or :trac:<tt>report:1</tt>
*Changesets: :trac:<tt>r1</tt>, :trac:<tt>[1]</tt> or :trac:<tt>changeset:1</tt>
*Revision log: :trac:<tt>r1:3</tt>, :trac:<tt>[1:3]</tt> or :trac:<tt>log:@1:3</tt>, :trac:<tt>log:trunk@1:3</tt>
*Diffs (since version 0.10): :trac:<tt>diff:@20:30</tt>, :trac:<tt>diff:tags/trac-0.9.2/wiki-default//tags/trac-0.9.3/wiki-default</tt> or :trac:<tt>diff:trunk/trac@3538//sandbox/vc-refactoring/trac@3539</tt>
*Wiki pages: :trac:<tt>CamelCase</tt> or :trac:<tt>wiki:CamelCase</tt>
*Milestones: :trac:<tt>milestone:1.0</tt>
*Attachment: :trac:<tt>attachment:ticket:944:attachment.1073.diff</tt>
*Files: :trac:<tt>source:trunk/COPYING</tt>
*A specific file revision: :trac:<tt>source:/trunk/COPYING@200</tt>
*A particular line of a specific file revision: :trac:<tt>source:/trunk/COPYING@200#L25</tt>

Provided you have docutils installed, the above block will render as:


#rst 

Examples:
*Tickets: :trac:<tt>#1</tt> or :trac:<tt>ticket:1</tt>
*Ticket comments: :trac:<tt>comment:ticket:1:2</tt>
*Reports: :trac:<tt>{1}</tt> or :trac:<tt>report:1</tt>
*Changesets: :trac:<tt>r1</tt>, :trac:<tt>[1]</tt> or :trac:<tt>changeset:1</tt>
*Revision log: :trac:<tt>r1:3</tt>, :trac:<tt>[1:3]</tt> or :trac:<tt>log:@1:3</tt>, :trac:<tt>log:trunk@1:3</tt>
*Diffs (since version 0.10): :trac:<tt>diff:@20:30</tt>, :trac:<tt>diff:tags/trac-0.9.2/wiki-default//tags/trac-0.9.3/wiki-default</tt> or :trac:<tt>diff:trunk/trac@3538//sandbox/vc-refactoring/trac@3539</tt>
*Wiki pages: :trac:<tt>CamelCase</tt> or :trac:<tt>wiki:CamelCase</tt>
*Milestones: :trac:<tt>milestone:1.0</tt>
*Attachment: :trac:<tt>attachment:ticket:944:attachment.1073.diff</tt>
*Files: :trac:<tt>source:trunk/COPYING</tt>
*A specific file revision: :trac:<tt>source:/trunk/COPYING@200</tt>
*A particular line of a specific file revision: :trac:<tt>source:/trunk/COPYING@200#L25</tt>


Note also that any of the above could have been written using the alternate syntax for roles:

<pre>
#rst

See _<tt>ticket:123</tt>

 .. trac:: ticket:123 Ticket 123


#rst

See _<tt>ticket:123</tt>

.. trac:: ticket:123 Ticket 123

The above form has the additional benefit of allowing you to specify an explicit label for the link.
See also: WikiRestructuredText, TracLinks
Clone this wiki locally