Changes between Version 4 and Version 5 of TracLinks


Ignore:
Timestamp:
Mar 27, 2008, 7:31:47 AM (12 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TracLinks

    v4 v5  
    11= Trac Links =
    2 As you might have guessed, TracLinks are a very fundamental feature of Trac.
     2[[TracGuideToc]]
    33
    4 They allow hyperlinking between Trac entities (tickets, reports, changesets, Wiki
    5 pages, milestones and source files) from anywhere WikiFormatting is used.
     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.
    65
    76TracLinks are generally of the form '''type:id''' (where ''id'' represents the
     
    1110Some examples:
    1211 * Tickets: '''!#1''' or '''!ticket:1'''
     12 * Ticket comments: '''!comment:ticket:1:2'''
    1313 * Reports: '''!{1}''' or '''!report:1'''
    14  * Changesets: '''!r1''', '''![1]''' or '''!changeset:1'''
    15  * Revision log: '''!r1:3''', '''![1:3]''' or '''!log:#1:3'''
    16  * Wiki pages: '''CamelCase''' or '''!wiki:CamelCase'''
     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'''
    1718 * Milestones: '''!milestone:1.0'''
    1819 * Attachment: '''!attachment:ticket:944:attachment.1073.diff'''
    1920 * Files: '''!source:trunk/COPYING'''
    20  * A specific file revision: '''!source:/trunk/COPYING#200'''
     21 * A specific file revision: '''!source:/trunk/COPYING@200'''
     22 * A particular line of a specific file revision: '''!source:/trunk/COPYING@200#L25'''
    2123Display:
    2224 * Tickets: #1 or ticket:1
     25 * Ticket comments: comment:ticket:1:2
    2326 * Reports: {1} or report:1
    24  * Changesets: r1, [1] or changeset:1
    25  * Differences: r1:3, [1:3] or log:#1:3
     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
    2630 * Wiki pages: CamelCase or wiki:CamelCase
    2731 * Milestones: milestone:1.0
     32 * Attachment: attachment:ticket:944:attachment.1073.diff
    2833 * Files: source:trunk/COPYING
    29  * Attachment: attachment:ticket:944:attachment.1073.diff
    30  * A specific file revision: source:/trunk/COPYING#200
     34 * A specific file revision: source:/trunk/COPYING@200
     35 * A particular line of a specific file revision: source:/trunk/COPYING@200#L25
    3136
    3237'''Note:''' The wiki:CamelCase form is rarely used, but it can be convenient to refer to
    3338pages whose names do not follow WikiPageNames rules, i.e., single words,
    34 non-alphabetic characters, etc.
     39non-alphabetic characters, etc. See WikiPageNames for more about features specific
     40to links to Wiki page names.
    3541
    3642Trac links using the full (non-shorthand) notation can also be given a custom
     
    4349Display: [ticket:1 This is a link to ticket number one].
    4450
    45 If the title is be omitted, only the id (the part after the colon) is displayed:
     51If the title is omitted, only the id (the part after the colon) is displayed:
    4652
    4753{{{
     
    5157Display: [ticket:1]
    5258
    53 It might seem a simple enough concept at a glance, but actually allows 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.
     59`wiki` is the default if the namespace part of a full link is omitted (''since version 0.10''):
    5460
    55 == attachement: links ==
     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 ==
    5672
    5773The link syntax for attachments is as follows:
    5874 * !attachment:the_file.txt creates a link to the attachment the_file.txt of the current object
    5975 * !attachment:wiki:MyPage:the_file.txt creates a link to the attachment the_file.txt of the !MyPage wiki page
    60  * !attachment:ticket:753:the_file.txt creates a link to the attachment the_file.txt of the ticket 753 !attachment:wiki:MyPage:the_file.txt
     76 * !attachment:ticket:753:the_file.txt creates a link to the attachment the_file.txt of the ticket 753
    6177
    6278== source: links ==
    6379
    6480The default behavior for a source:/some/path link is to open the directory browser
    65 if the path points to a directory and otherwise open the log view.
    66 It's also possible to link directly to a specific revision of a file like this: source:/some/file@123
    67 or like this to link to the latest revision: source:/some/file@latest.
    68 If the revision is specified, one can even link to a specific line number: !source:/some/file@123#L10
    69 [[comment(TODO: remove the ! when Edgewall Trac is upgraded with the support for the line syntax)]]
     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]
    70138
    71139== Quoting space in TracLinks ==
    72140
    73 The usual syntax for quoting space is:
    74 
     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"
    75145 * !attachment:'the file.txt' or
    76146 * !attachment:"the file.txt"
     147 * !attachment:"ticket:123:the file.txt"
    77148
    78149== Where to use TracLinks ==
     
    98169
    99170----
    100 See also: WikiFormatting, TracWiki
     171See also: WikiFormatting, TracWiki, WikiPageNames, InterTrac, InterWiki
    101172