Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Difference between revisions of "Template:Trac"

(change trunk into stable version. {{Trac|filename|trunk}} to link to trunk.)
 
(19 intermediate revisions by 6 users not shown)
Line 1: Line 1:
<tt>[http://core.trac.wordpress.org/browser/{{{2|tags/{{CurrentVersion}}}}}/{{{1}}} {{{1}}}]</tt>
+
<includeonly><code>[https://core.trac.wordpress.org/browser/{{{2|tags/{{CurrentVersion}}}}}/src/{{{1}}}#L{{{3|0}}} {{{1}}}]</code></includeonly><noinclude>
  +
  +
<div class="template-description" style="padding: 0 1.5em; border: 1px solid #eeeeee; background-color: #f9f9f9">
  +
  +
  +
== Description ==
  +
Link to the source code on https://core.trac.wordpress.org/browser/.
  +
  +
  +
=== Usage ===
  +
<pre>{{Trac| $file_path | $branch_tag_trunk }}</pre>
  +
  +
  +
=== Parameters ===
  +
{{Parameter|1 - $file_path|string|Path to file.}}
  +
  +
{{Parameter|2 - $branch_tag_trunk|string|Path to [[Using Subversion#Repository, Branches, Trunk, and Tags|'branch version', 'tag version' or 'trunk']].|optional|tags/<nowiki>{{CurrentVersion}}</nowiki> }}
  +
  +
{{Parameter|3 - $line|string|Line in source file where tag is declared. '''Required $branch_tag_trunk parameter''' <tt>tags/version</tt>|optional}}
  +
  +
=== Usage ===
  +
<strong>Link to the latest stable version:</strong>
  +
<pre>{{Trac|wp-includes/version.php}}</pre>
  +
''Output:'' {{Trac|wp-includes/version.php}}
  +
  +
<strong>Link to trunk:</strong>
  +
<pre>{{Trac|wp-includes/version.php|trunk}}</pre>
  +
''Output:'' {{Trac|wp-includes/version.php|trunk}}
  +
  +
<strong>Link to branch 2.9:</strong>
  +
<pre>{{Trac|wp-includes/version.php|branches/2.9}}</pre>
  +
''Output:'' {{Trac|wp-includes/version.php|branches/2.9}}
  +
  +
<strong>Link to tag 3.0.1:</strong>
  +
<pre>{{Trac|wp-includes/version.php|tags/3.0.1}}</pre>
  +
''Output:'' {{Trac|wp-includes/version.php|tags/3.0.1}}
  +
  +
<strong>Link to tag 3.0.1 line 3:</strong>
  +
<pre>{{Trac|wp-includes/version.php|tags/3.0.1|3}}</pre>
  +
''Output:'' {{Trac|wp-includes/version.php|tags/3.0.1|3}}
  +
  +
<strong>Link to tag 3.0.1 with link text '3.0.1':</strong>
  +
<pre>{{Trac|3.0.1|tags}}</pre>
  +
''Output:'' {{Trac|3.0.1|tags}}
  +
  +
  +
=== Issues ===
  +
Trac tags/branches older than 3.7 do not have the wikipedia source code in the base 'src' folder. A conditional should be placed on the second parameter to check if the tag/branch is 3.6.1 or lower and not include the hard-coded 'src/' path of the URL.
  +
  +
</div>
  +
  +
{{Languages|
  +
{{en|Template:Trac}}
  +
{{ja|Template:Source}}
  +
}}</noinclude>

Latest revision as of 17:33, 19 May 2015



Description

Link to the source code on https://core.trac.wordpress.org/browser/.


Usage

{{Trac| $file_path | $branch_tag_trunk }}


Parameters

1 - $file_path
(string) (required) Path to file.
Default: None
2 - $branch_tag_trunk
(string) (optional) Path to 'branch version', 'tag version' or 'trunk'.
Default: tags/{{CurrentVersion}}
3 - $line
(string) (optional) Line in source file where tag is declared. Required $branch_tag_trunk parameter tags/version
Default: None

Usage

Link to the latest stable version:

{{Trac|wp-includes/version.php}}

Output: wp-includes/version.php

Link to trunk:

{{Trac|wp-includes/version.php|trunk}}

Output: wp-includes/version.php

Link to branch 2.9:

{{Trac|wp-includes/version.php|branches/2.9}}

Output: wp-includes/version.php

Link to tag 3.0.1:

{{Trac|wp-includes/version.php|tags/3.0.1}}

Output: wp-includes/version.php

Link to tag 3.0.1 line 3:

{{Trac|wp-includes/version.php|tags/3.0.1|3}}

Output: wp-includes/version.php

Link to tag 3.0.1 with link text '3.0.1':

{{Trac|3.0.1|tags}}

Output: 3.0.1


Issues

Trac tags/branches older than 3.7 do not have the wikipedia source code in the base 'src' folder. A conditional should be placed on the second parameter to check if the tag/branch is 3.6.1 or lower and not include the hard-coded 'src/' path of the URL.