close Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Changes between Initial Version and Version 1 of TracLinks


Ignore:
Timestamp:
Dec 15, 2007, 12:51:54 AM (17 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TracLinks

    v1 v1  
     1= Trac Links =
     2[[TracGuideToc]]
     3
     4TracLinks are a fundamental feature of Trac, because they allow easy hyperlinking between the various entities in the system—such as tickets, reports, changesets, Wiki pages, milestones, and source files—from anywhere WikiFormatting is used.
     5
     6TracLinks are generally of the form '''type:id''' (where ''id'' represents the
     7number, name or path of the item) though some frequently used kinds of items
     8also have short-hand notations.
     9
     10Some examples:
     11 * Tickets: '''!#1''' or '''!ticket:1'''
     12 * Ticket comments: '''!comment:ticket:1:2'''
     13 * Reports: '''!{1}''' or '''!report:1'''
     14 * Changesets: '''!r1''', '''![1]''', '''!changeset:1''' or (restricted) '''![1/trunk]''', '''!changeset:1/trunk''', '''![2:5/trunk]'''
     15 * Revision log: '''!r1:3''', '''![1:3]''' or '''!log:@1:3''', '''!log:trunk@1:3'''
     16 * Diffs (requires [milestone:0.10 0.10]): '''!diff:@1:3''', '''!diff:tags/trac-0.9.2/wiki-default//tags/trac-0.9.3/wiki-default''' or '''!diff:trunk/trac@3538//sandbox/vc-refactoring@3539'''
     17 * Wiki pages: '''!CamelCase''' or '''!wiki:CamelCase'''
     18 * Milestones: '''!milestone:1.0'''
     19 * Attachment: '''!attachment:ticket:944:attachment.1073.diff'''
     20 * Files: '''!source:trunk/COPYING'''
     21 * A specific file revision: '''!source:/trunk/COPYING@200'''
     22 * A particular line of a specific file revision: '''!source:/trunk/COPYING@200#L25'''
     23Display:
     24 * Tickets: #1 or ticket:1
     25 * Ticket comments: comment:ticket:1:2
     26 * Reports: {1} or report:1
     27 * Changesets: r1, [1], changeset:1, or (restricted) [1/trunk], changeset:1/trunk, [2:5/trunk]
     28 * Revision log: r1:3, [1:3] or log:@1:3, log:trunk@1:3
     29 * Diffs (requires [milestone:0.10 0.10]): diff:@20:30, diff:tags/trac-0.9.2/wiki-default//tags/trac-0.9.3/wiki-default or diff:trunk/trac@3538//sandbox/vc-refactoring/trac@3539
     30 * Wiki pages: CamelCase or wiki:CamelCase
     31 * Milestones: milestone:1.0
     32 * Attachment: attachment:ticket:944:attachment.1073.diff
     33 * Files: source:trunk/COPYING
     34 * A specific file revision: source:/trunk/COPYING@200
     35 * A particular line of a specific file revision: source:/trunk/COPYING@200#L25
     36
     37'''Note:''' The wiki:CamelCase form is rarely used, but it can be convenient to refer to
     38pages whose names do not follow WikiPageNames rules, i.e., single words,
     39non-alphabetic characters, etc. See WikiPageNames for more about features specific
     40to links to Wiki page names.
     41
     42Trac links using the full (non-shorthand) notation can also be given a custom
     43link title like this:
     44
     45{{{
     46[ticket:1 This is a link to ticket number one].
     47}}}
     48
     49Display: [ticket:1 This is a link to ticket number one].
     50
     51If the title is omitted, only the id (the part after the colon) is displayed:
     52
     53{{{
     54[ticket:1]
     55}}}
     56
     57Display: [ticket:1]
     58
     59`wiki` is the default if the namespace part of a full link is omitted (''since version 0.10''):
     60
     61{{{
     62[SandBox the sandbox]
     63}}}
     64
     65Display: [SandBox the sandbox]
     66
     67TracLinks are a very simple idea, but actually allow quite a complex network of information. In practice, it's very intuitive and simple to use, and we've found the "link trail" extremely helpful to better understand what's happening in a project or why a particular change was made.
     68
     69The following sections describe the individual link types in detail, as well as several notes advanced usage of links.
     70
     71== attachment: links ==
     72
     73The link syntax for attachments is as follows:
     74 * !attachment:the_file.txt creates a link to the attachment the_file.txt of the current object
     75 * !attachment:wiki:MyPage:the_file.txt creates a link to the attachment the_file.txt of the !MyPage wiki page
     76 * !attachment:ticket:753:the_file.txt creates a link to the attachment the_file.txt of the ticket 753
     77
     78== source: links ==
     79
     80The default behavior for a source:/some/path link is to open the directory browser
     81if the path points to a directory and otherwise open the log view.
     82
     83It's also possible to link directly to a specific revision of a file like this:
     84 - `source:/some/file@123` - link to the file's revision 123
     85 - `source:/some/file@head` - link explicitly to the latest revision of the file
     86
     87If the revision is specified, one can even link to a specific line number:
     88 - `source:/some/file@123#L10`
     89 - `source:/tag/0.10@head#L10`
     90
     91Finally, one can also highlight an arbitrary set of lines:
     92 - `source:/some/file@123:10-20,100,103#L99` - highlight lines 10 to 20, and lines 100 and 103.
     93''(since 0.11)''
     94
     95== export: links ==
     96
     97To force the download of a file in the repository, as opposed to displaying it in the browser, use the `export` link.  Several forms are available:
     98 * `export:/some/file` - get the HEAD revision of the specified file
     99 * `export:123:/some/file` - get revision 123 of the specified file
     100 * `export:/some/file@123` - get revision 123 of the specified file
     101
     102This can be very useful for displaying HTML documentation with correct stylesheets and images, in case that has been checked in the repository.
     103
     104If the path is to a directory in the repository instead of a specific file, the source browser will be used to display the directory (identical to the result of `source:/some/dir`.
     105
     106== search: and query: links ==
     107
     108See TracSearch#SearchLinks and TracQuery#UsingTracLinks
     109
     110== !SubWiki links ==
     111To create a SubWiki link to a SubWiki-page just use a '/':
     112{{{
     113 [wiki:WikiPage/SubWikiPage].
     114}}}
     115
     116== InterWiki links ==
     117
     118Other prefixes can be defined freely and made to point to resources in other Web applications. The definition of those prefixes as well as the URLs of the corresponding Web applications is defined in a special Wiki page, the InterMapTxt page. Note that while this could be used to create links to other Trac environments, there's a more specialized way to register other Trac environments which offers greater flexibility.
     119
     120== InterTrac links ==
     121
     122Any of the above form of Trac links could be written in one Trac environment and actually refer to resources present in another Trac environment, provided the Trac link is prefixed by the name of that other Trac environment followed by a colon. That other Trac environment must be registered. See InterTrac for details.
     123
     124
     125== Server-relative links ==
     126
     127It is often useful to be able to link to objects on your server that have no built-in
     128Trac linking mechanism, such as static resources, a `/register` page, etc. This
     129can be achieved by simply using either an absolute path from the server root,
     130or a relative link from the URL of the current page:
     131
     132{{{
     133[../newticket newticket]
     134[/ home]
     135}}}
     136
     137Display: [../newticket newticket] [/ home]
     138
     139== Quoting space in TracLinks ==
     140
     141Immediately after a TracLinks prefix, targets containing space characters should
     142be enclosed in a pair of quotes or double quotes.
     143Examples:
     144 * !wiki:"The whitespace convention"
     145 * !attachment:'the file.txt' or
     146 * !attachment:"the file.txt"
     147 * !attachment:"ticket:123:the file.txt"
     148
     149== Where to use TracLinks ==
     150You can use TracLinks in:
     151
     152 * Source code (Subversion) commit messages
     153 * Wiki pages
     154 * Full descriptions for tickets, reports and milestones
     155
     156and any other text fields explicitly marked as supporting WikiFormatting.
     157
     158== Escaping Links ==
     159
     160To prevent parsing of a !TracLink, you can escape it by preceding it with a '!' (exclamation mark).
     161{{{
     162 !NoLinkHere.
     163 ![42] is not a link either.
     164}}}
     165
     166Display:
     167 !NoLinkHere.
     168 ![42] is not a link either.
     169
     170----
     171See also: WikiFormatting, TracWiki, WikiPageNames, InterTrac, InterWiki
     172