Template:Source: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
m (better example)
(Added Template:Documentation.)
 
Line 1: Line 1:
<noinclude>
<code>[http://mxr.mozilla.org/mozilla-central/source/{{{1}}} {{{2|{{{1}}}}}}]</code><noinclude>
Link to source code in <tt>mozilla-central</tt> [[Mercurial]] tree in http://mxr.mozilla.org, similar to how [[mdc:Template:Source]] works.
{{documentation}}
''Note,'' there is also the older <tt>[http://mxr.mozilla.org/mozilla/ mozilla]</tt> CVS tree.
<!-- Add categories to the /doc subpage, not here! -->
 
</noinclude>
== Usage ==
First parameter is the path within the mozilla tree;
second optional parameter gives a name to it.
 
<nowiki>{{source|browser/Makefile.in}}</nowiki>
: produces {{source|browser/Makefile.in}}
 
<nowiki>{{source|browser/Makefile.in|the browser's Makefile.in file}}</nowiki>
: produces {{source|browser/Makefile.in|the browser's Makefile.in file}}
</noinclude><code>[http://mxr.mozilla.org/mozilla-central/source/{{{1}}} {{{2|{{{1}}}}}}]</code>

Latest revision as of 15:00, 7 December 2014

{{{1}}}

Documentation icon Template documentation[view] [edit] [history] [purge]

Usage

{{source}} creates a link to source code in the mozilla-central Mercurial tree via Mozilla France's web service Mozilla Cross-Reference (MXR). It works similar to mdc:Template:Source at Mozilla Developer Network.

Note

MXR also contains the older mozilla CVS tree.

Parameters

There are 2 parameters, both unnamed, of which 1 is required and 1 is optional.

Syntax

The template's syntax is

  • {{source|sub-path|custom link text}}

Required parameter

1

Sub-path under /mozilla-central

Path to the resource under mozilla-central, to which you wish to link. The parameter is unnamed, so no parameter name needs to be specified.

Usage
  • {{source|sub-path}}

Optional parameter

2

Custom link text

If you want the link to display something other than the input for parameter 1. The parameter is unnamed, so no parameter name needs to be specified.

Note
  • This parameter must be placed after the 1st parameter.
Usage
  • {{source|1|custom link text}}

Examples

Correct use

Case What you type What you see
Sub-path browser/Makefile.in}} browser/Makefile.in
Custom link text browser/Makefile.in|The browser's Makefile.in file}} The browser's Makefile.in file

See also

  • {{c-c}}: links to a revision in the comm-central tree in Mercurial.
  • {{hg}}: links to a revision in the mozilla-central tree in Mercurial.
  • {{rev}}: links to a revision in a custom repository in Mercurial.
  • {{SVN}}: links to a revision in Mozilla's source code browsing website for SVN.