WikiRestructuredTextLinks

From Begrid Wiki
Revision as of 09:14, 9 June 2021 by Maintenance script (talk | contribs) (Created page with " == TracLinks in reStructuredText == This document illustrates how to use the <tt>:trac:</tt> role in reStructuredText. The page is written like: <pre> <pre> #rst Examples:...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

TracLinks in reStructuredText

This document illustrates how to use the :trac: role in reStructuredText. The 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>

An explicit label can be specified, separated from the link by a space:

*See :trac:<tt>#1 ticket 1</tt> and the :trac:<tt>source:trunk/COPYING license</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>

An explicit label can be specified, separated from the link by a space:

*See :trac:<tt>#1 ticket 1</tt> and the :trac:<tt>source:trunk/COPYING license</tt>.

Note also that any of the above could have been written using substitution references and the trac:: directive:

<pre>
#rst
See |ticket123|.

 .. |ticket123| trac:: ticket:123 this ticket

This renders as:


#rst
See |ticket123|.

 .. |ticket123| trac:: ticket:123 this ticket

See also: WikiRestructuredText, TracLinks


Template:TracNotice