Changes between Version 1 and Version 2 of TracLinks


Ignore:
Timestamp:
01/24/08 16:33:02 (12 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TracLinks

    v1 v2  
    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 
    7 TracLinks are generally of the form '''item:id''' (where ''id'' represents the 
     6TracLinks are generally of the form '''type:id''' (where ''id'' represents the 
    87number, name or path of the item) though some frequently used kinds of items 
    9 also have short-hand, alternative, notations. 
     8also have short-hand notations. 
    109 
    1110Some examples: 
    12  
    1311 * Tickets: '''!#1''' or '''!ticket:1''' 
     12 * Ticket comments: '''!comment:ticket:1:2'''  
    1413 * Reports: '''!{1}''' or '''!report:1''' 
    15  * Changesets: '''![1]''' or '''!changeset:1''' 
    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''' 
     19 * Attachment: '''!attachment:ticket:944:attachment.1073.diff''' 
    1820 * Files: '''!source:trunk/COPYING''' 
    19  
     21 * A specific file revision: '''!source:/trunk/COPYING@200''' 
     22 * A particular line of a specific file revision: '''!source:/trunk/COPYING@200#L25''' 
    2023Display: 
    2124 * Tickets: #1 or ticket:1 
     25 * Ticket comments: comment:ticket:1:2  
    2226 * Reports: {1} or report:1 
    23  * Changesets: [1] or changeset: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 
    2430 * Wiki pages: CamelCase or wiki:CamelCase 
    2531 * Milestones: milestone:1.0 
     32 * Attachment: attachment:ticket:944:attachment.1073.diff 
    2633 * 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 
    2736 
    2837'''Note:''' The wiki:CamelCase form is rarely used, but it can be convenient to refer to 
    2938pages whose names do not follow WikiPageNames rules, i.e., single words, 
    30 non-alphabetic characters, etc. 
     39non-alphabetic characters, etc. See WikiPageNames for more about features specific 
     40to links to Wiki page names. 
    3141 
    3242Trac links using the full (non-shorthand) notation can also be given a custom 
     
    3747}}} 
    3848 
    39 Display: 
     49Display: [ticket:1 This is a link to ticket number one]. 
    4050 
    41 [ticket:1 This is a link to ticket number one]. 
     51If the title is omitted, only the id (the part after the colon) is displayed: 
    4252 
    43 It might seem a simple enough concept at a glance, but actually allows quite a complex network of information. 
     53{{{ 
     54[ticket:1] 
     55}}} 
    4456 
    45 In practice though, it's very intuitive and simple to use, and we've found the "link trail" extremely helpful to better understand what's 
    46 happening in a project or why a particular change was made. 
     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 
    4777 
    4878== source: links == 
    49 The default behavior for a source:/some/path link is to open the directory browser if the path points 
    50 to a directory and otherwise open the log view. It's also possible to link directly to a specific 
    51 revision of a file like this: source:/some/file#123 or like this to link to the latest revision: 
    52 source:/some/file#latest. 
     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"  
    53148 
    54149== Where to use TracLinks == 
     
    61156and any other text fields explicitly marked as supporting WikiFormatting. 
    62157 
    63 == Escaping TracLinks == 
     158== Escaping Links == 
     159 
    64160To prevent parsing of a !TracLink, you can escape it by preceding it with a '!' (exclamation mark). 
    65  
    66161{{{ 
    67162 !NoLinkHere. 
     
    74169 
    75170---- 
    76 See also: WikiFormatting, TracWiki 
     171See also: WikiFormatting, TracWiki, WikiPageNames, InterTrac, InterWiki 
    77172