Changes between Version 4 and Version 5 of TracLinks
- Timestamp:
- Mar 27, 2008, 7:31:47 AM (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TracLinks
v4 v5 1 1 = Trac Links = 2 As you might have guessed, TracLinks are a very fundamental feature of Trac. 2 [[TracGuideToc]] 3 3 4 They allow hyperlinking between Trac entities (tickets, reports, changesets, Wiki 5 pages, milestones and source files) from anywhere WikiFormatting is used. 4 TracLinks 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. 6 5 7 6 TracLinks are generally of the form '''type:id''' (where ''id'' represents the … … 11 10 Some examples: 12 11 * Tickets: '''!#1''' or '''!ticket:1''' 12 * Ticket comments: '''!comment:ticket:1:2''' 13 13 * 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:[email protected]: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/[email protected]//sandbox/[email protected]''' 17 * Wiki pages: '''!CamelCase''' or '''!wiki:CamelCase''' 17 18 * Milestones: '''!milestone:1.0''' 18 19 * Attachment: '''!attachment:ticket:944:attachment.1073.diff''' 19 20 * Files: '''!source:trunk/COPYING''' 20 * A specific file revision: '''!source:/trunk/COPYING#200''' 21 * A specific file revision: '''!source:/trunk/[email protected]''' 22 * A particular line of a specific file revision: '''!source:/trunk/[email protected]#L25''' 21 23 Display: 22 24 * Tickets: #1 or ticket:1 25 * Ticket comments: comment:ticket:1:2 23 26 * 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:[email protected]: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/[email protected]//sandbox/vc-refactoring/[email protected] 26 30 * Wiki pages: CamelCase or wiki:CamelCase 27 31 * Milestones: milestone:1.0 32 * Attachment: attachment:ticket:944:attachment.1073.diff 28 33 * Files: source:trunk/COPYING 29 * A ttachment: attachment:ticket:944:attachment.1073.diff30 * A specific file revision: source:/trunk/COPYING#20034 * A specific file revision: source:/trunk/[email protected] 35 * A particular line of a specific file revision: source:/trunk/[email protected]#L25 31 36 32 37 '''Note:''' The wiki:CamelCase form is rarely used, but it can be convenient to refer to 33 38 pages whose names do not follow WikiPageNames rules, i.e., single words, 34 non-alphabetic characters, etc. 39 non-alphabetic characters, etc. See WikiPageNames for more about features specific 40 to links to Wiki page names. 35 41 36 42 Trac links using the full (non-shorthand) notation can also be given a custom … … 43 49 Display: [ticket:1 This is a link to ticket number one]. 44 50 45 If the title is beomitted, only the id (the part after the colon) is displayed:51 If the title is omitted, only the id (the part after the colon) is displayed: 46 52 47 53 {{{ … … 51 57 Display: [ticket:1] 52 58 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''): 54 60 55 == attachement: links == 61 {{{ 62 [SandBox the sandbox] 63 }}} 64 65 Display: [SandBox the sandbox] 66 67 TracLinks 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 69 The following sections describe the individual link types in detail, as well as several notes advanced usage of links. 70 71 == attachment: links == 56 72 57 73 The link syntax for attachments is as follows: 58 74 * !attachment:the_file.txt creates a link to the attachment the_file.txt of the current object 59 75 * !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.txt76 * !attachment:ticket:753:the_file.txt creates a link to the attachment the_file.txt of the ticket 753 61 77 62 78 == source: links == 63 79 64 80 The 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/[email protected] 67 or like this to link to the latest revision: source:/some/[email protected] 68 If the revision is specified, one can even link to a specific line number: !source:/some/[email protected]#L10 69 [[comment(TODO: remove the ! when Edgewall Trac is upgraded with the support for the line syntax)]] 81 if the path points to a directory and otherwise open the log view. 82 83 It's also possible to link directly to a specific revision of a file like this: 84 - `source:/some/[email protected]` - link to the file's revision 123 85 - `source:/some/[email protected]` - link explicitly to the latest revision of the file 86 87 If the revision is specified, one can even link to a specific line number: 88 - `source:/some/[email protected]#L10` 89 - `source:/tag/[email protected]#L10` 90 91 Finally, one can also highlight an arbitrary set of lines: 92 - `source:/some/[email protected]:10-20,100,103#L99` - highlight lines 10 to 20, and lines 100 and 103. 93 ''(since 0.11)'' 94 95 == export: links == 96 97 To 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/[email protected]` - get revision 123 of the specified file 101 102 This can be very useful for displaying HTML documentation with correct stylesheets and images, in case that has been checked in the repository. 103 104 If 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 108 See TracSearch#SearchLinks and TracQuery#UsingTracLinks 109 110 == !SubWiki links == 111 To create a SubWiki link to a SubWiki-page just use a '/': 112 {{{ 113 [wiki:WikiPage/SubWikiPage]. 114 }}} 115 116 == InterWiki links == 117 118 Other 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 122 Any 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 127 It is often useful to be able to link to objects on your server that have no built-in 128 Trac linking mechanism, such as static resources, a `/register` page, etc. This 129 can be achieved by simply using either an absolute path from the server root, 130 or a relative link from the URL of the current page: 131 132 {{{ 133 [../newticket newticket] 134 [/ home] 135 }}} 136 137 Display: [../newticket newticket] [/ home] 70 138 71 139 == Quoting space in TracLinks == 72 140 73 The usual syntax for quoting space is: 74 141 Immediately after a TracLinks prefix, targets containing space characters should 142 be enclosed in a pair of quotes or double quotes. 143 Examples: 144 * !wiki:"The whitespace convention" 75 145 * !attachment:'the file.txt' or 76 146 * !attachment:"the file.txt" 147 * !attachment:"ticket:123:the file.txt" 77 148 78 149 == Where to use TracLinks == … … 98 169 99 170 ---- 100 See also: WikiFormatting, TracWiki 171 See also: WikiFormatting, TracWiki, WikiPageNames, InterTrac, InterWiki 101 172