Template:Sourceforge source
Goal
This template is for creating links or URLs for the content of the version control repositories of the SourceForge open source infrastructure. It is a subtemplate of the master {{repo link}} template designed to be specific for the SourceForge repositories. Note If you wish to reference one of the official FlightGear repositories, instead you should use the repository specific {{* source}} subtemplates listed below.
Usage
{{sourceforge source | cmd = | opt = | protocol = | login = | type = | user = | proj = | repo = | branch = | tag = | commit = | path = | line = | post = | view = | text = | pre = | simplepath = | full = }}
Either the user or proj parameter, as well as the repo parameter, must be supplied. All other parameters are optional.
Parameter | Description | Abbreviated parameter |
Numbered parameter |
Status |
---|---|---|---|---|
cmd | An optional command line tool name + options to prepend to the URL. For example git clone. | optional | ||
opt | Any additional options to show after cmd, but before the URL.
|
optional | ||
protocol | The URL protocol, for example https, http, ssh, git, svn. This defaults to https. | optional | ||
login | The optional user login. This should not to be confused with the user parameter. | optional | ||
type | Choose between the web interface or a direct repository link. This can be one of git, git web, svn, svn web. The default is git web. | optional | ||
user | The name of the user page for the open source infrastructure. This is notably different to the login parameter. This will have precedence over the proj parameter. The user page is treated in the same way as a project name. | u | 1 | mandatory |
proj | The name of the project, consisting of a grouping of repositories on the open source infrastructure. | p | 1 | mandatory |
repo | The name of the repository. A project registered on one of the open source infrastructures generally allows for multiple repositories under that project name. | r | 2 | mandatory |
branch | The branch name. As tags are simply branches in SVN repositories, this parameter can also be used for svn tags. This defaults to master or trunk for git and svn respectively. For SourceForge git repositories, if the character / is present in the branch name, the text /~ must be appended to the branch.
|
b | 3 | optional |
tag | The repository tag name. For SourceForge git repositories, if the character / is present in the tag name, the text /~ must be appended to the tag.
|
optional | ||
commit | The commit identifier (git hash or svn revision number). This defaults to HEAD. | c | 5 | optional |
path | The file or directory path. | f | 4 | optional |
line | The line number(s) of the file to display.
|
l | optional | |
post | Text to append. This is forms a set with the parameter cmd and opt. For example it can represent any command line options that come after the URL. | optional | ||
view | View to display:
|
v | optional | |
text | Text to display as the link label. Overrides pre. | t | optional | |
pre | Prefix to a link label. | optional | ||
simplepath | If set, this strips off the repository name from the URL label, leaving just the contents of the path parameter.
|
optional | ||
full | If set to 1, the full URL will be shown rather than any text label. | optional |
Design
In this section, the following notation will be used:
- Angular brackets + lower case text
<xyz>
- Template parameters.
- Angular brackets + upper case text
<XYZ>
- Template constructed text.
- Square brackets
[xyz]
- Optional text, only added if the parameter is set.
- Or symbol
|
- The value on the left, if present, otherwise the value on the right of the symbol.
Overview
The general design is:
<cmd> <opt> [<URL> <TEXT>] <post>
Here the square brackets do not denote optional text, but will instead produce a Mediawiki link. This can be modified by setting full = 1 to produce:
<cmd> <opt> <URL> <post>
Site: SourceForge
Project vs. developer page
For a normal SourceForge project and a SourceForge developer page, the base URL is respectively constructed as:
<protocol>://<DOMAIN>/p/<proj>/<repo>/ <protocol>://<DOMAIN>/u/<user>/<repo>/
This will be abstracted as:
<protocol>://<DOMAIN>/<u|p>/<user|proj>/<repo>/
For the type parameter value of git or svn, a login is allowed:
<protocol>://[<login>@]<DOMAIN>/<u|p>/<user|proj>/<repo>/
SourceForge <URL> for 'type=git'
For this parameter value, the complete <URL>
value will be:
<protocol>://[<login>@]git.code.sf.net/<u|p>/<user|proj>/<repo>/
SourceForge <URL> for 'type=git web'
For this parameter value, the <URL>
value will be:
<protocol>://sourceforge.net/<u|p>/<user|proj>/<repo>/ci/<commit|branch>/<VIEW>/<path>[#l<line>]
The <VIEW>
value for different values of view is:
- tree
tree/
.- log
log/?path=
.- commit
- nothing.
If the parameter setting view=rss is used, a different <URL>
value is produced:
<protocol>://sourceforge.net/<u|p>/<user|proj>/<repo>/feed/
SourceForge <URL> for 'type=svn'
For this parameter value, the <URL>
value will instead be:
<protocol>://[<login>@]svn.code.sf.net/<u|p>/<user|proj>/<repo>/<branch>[/<path>][@<commit>]
SourceForge <URL> for 'type=svn web'
For this parameter value, the <URL>
value will be:
<protocol>://sourceforge.net/<u|p>/<user|proj>/<repo>/<commit|HEAD>/<VIEW>/<branch>[/<path>][#l<line>]
The <VIEW>
value for different values of view is:
- tree
tree/
.- log
log/?path=
.
If the parameter setting view=commit is used, a truncated <URL> value is produced:
<protocol>://sourceforge.net/<u|p>/<user|proj>/<repo>/<commit|HEAD>/
If the parameter setting view=rss is used, a different <URL> value is produced:
<protocol>://sourceforge.net/<u|p>/<user|proj>/<repo>/feed/
SourceForge URL <TEXT> for 'type=git' and 'type=git web'
The link text <TEXT>
, if the full parameter is not set, will be:
<user|proj>/<repo>/<commit|branch>[/<path>][#l<line>] <DESC>
If the simplepath parameter is set, this changes to:
[/<path>][#l<line>] <DESC>
If the pre parameter is supplied, this changes to:
<pre>[/<path>][#l<line>] <DESC>
The RSS feed is a special case in that <TEXT>
will be one of:
<user|proj>/<repo> <DESC>
<pre> <DESC>
The description <DESC>
is dependent on the view parameter:
- tree
- Nothing.
- log
log view
.- commit
commit view
.- rss
RSS feed
.
The text parameter trumps all, and <TEXT>
is simply:
<text>
SourceForge URL <TEXT> for 'type=svn' and 'type=svn web'
The link text <TEXT>
, if the full parameter is not set, will be:
<user|proj>/<repo>/<branch>[/<path>][#l<line>][@r<commit>] <DESC>
If the simplepath parameter is set, this changes to:
[/<path>][#l<line>][@r<commit>] <DESC>
If the pre parameter is supplied, this changes to:
<pre>[/<path>][#l<line>][@r<commit>] <DESC>
The RSS feed is a special case in that <TEXT>
will be one of:
<user|proj>/<repo> <DESC>
<pre> <DESC>
The description <DESC>
is dependent on the view parameter:
- tree
- Nothing.
- log
log view
.- commit
commit view
.- rss
RSS feed
.
The text parameter trumps all, and <TEXT>
is simply:
Plain text
To create a URL or link as plain text and avoid external links, simply use the {{#tag:tagname|content}}
magic word construct:
{{#tag:nowiki| {{repo link | full = 1 }} }}
https://sourceforge.net/p/flightgear/flightgear/ci/next/tree/
To use the <code> tags:
{{#tag:code|{{#tag:nowiki| {{repo link | full = 1 }} }}}}
https://sourceforge.net/p/flightgear/flightgear/ci/next/tree/
Examples
Note For a simpler interface to the official FlightGear repositories, please see all the repository specific templates in {{repo link/doc related}}. |
The source repository
This is a link to https://sourceforge.net/p/flightgear/flightgear/ci/next/tree/.
{{sourceforge source | proj = flightgear | repo = flightgear | branch = next | text = The flightgear source repository }}.
The flightgear source repository.
Git clone
Note For a simpler interface for this specific example, see {{sourceforge clone}} and {{flightgear clone}}. |
This is for git clone git://git.code.sf.net/p/flightgear/flightgear flightgear-flightgear
.
{{#tag:code|{{#tag:nowiki|{{sourceforge source | cmd = git clone | protocol = git | repo = flightgear | type = git | post = flightgear-flightgear | full = 1 }}}}}}.
git clone git://git.code.sf.net/p/flightgear/flightgear/ flightgear-flightgear
.
File with line number
This is a link to https://sourceforge.net/p/flightgear/flightgear/ci/next/tree/src/Main/fg_init.cxx#l1.
{{sourceforge source | repo = flightgear | path = src/Main/fg_init.cxx | branch = next | line = 1 }}.
flightgear/flightgear/next/src/Main/fg_init.cxx#l1.
File prefixed with $FLIGHTGEAR_SRC
This is a link to https://sourceforge.net/p/flightgear/flightgear/ci/next/tree/src/Main/fg_init.cxx. The expected link text is "$FLIGHTGEAR_SRC/src/Main/fg_init.cxx".
{{sourceforge source | repo = flightgear | path = src/Main/fg_init.cxx | branch = next | pre = $FLIGHTGEAR_SRC }}.
$FLIGHTGEAR_SRC/src/Main/fg_init.cxx (branch next).
Branch
This is a link to https://sourceforge.net/p/flightgear/flightgear/ci/sportmodel/tree/.
{{sourceforge source | repo = flightgear | branch = sportmodel }}.
flightgear/flightgear/sportmodel.
Tag
This is a link to https://sourceforge.net/p/flightgear/flightgear/ci/version/2016.1.1/~/tree/.
{{sourceforge source | repo = flightgear | tag = version/2016.1.1/~ }}.
flightgear/flightgear/version/2016.1.1/~.
Tag, history view
This is a link to https://sourceforge.net/p/flightgear/flightgear/ci/version/2016.1.1/~/log/?path=.
{{sourceforge source | repo = flightgear | tag = version/2016.1.1/~ | view = log }}.
flightgear/flightgear/version/2016.1.1/~ log view.
Commit
Note For a simpler interface for this specific example, see {{flightgear commit}}. |
This is a link to https://sourceforge.net/p/flightgear/flightgear/ci/f88d6418297e250138fda48f5a7d3e51bb3c543d/
{{sourceforge source | repo = flightgear | commit = f88d6418297e250138fda48f5a7d3e51bb3c543d | view = commit }}.
flightgear/flightgear/f88d6418297e250138fda48f5a7d3e51bb3c543d commit view.
Commit, history view
This is a link to https://sourceforge.net/p/flightgear/flightgear/ci/f88d6418297e250138fda48f5a7d3e51bb3c543d/log/?path=
{{sourceforge source | repo = flightgear | commit = f88d6418297e250138fda48f5a7d3e51bb3c543d | view = log }}.
flightgear/flightgear/f88d6418297e250138fda48f5a7d3e51bb3c543d log view.
Repository clone
Note For a simpler interface for this specific example, see {{sourceforge clone}} and {{flightgear clone}}. |
This is for the command git clone git://git.code.sf.net/p/flightgear/flightgear/ flightgear-flightgear
{{#tag:code|{{#tag:nowiki|{{sourceforge source | cmd = git clone | protocol = git | type = git | repo = flightgear | post = flightgear-flightgear | full = 1 }}}}}}.
git clone git://git.code.sf.net/p/flightgear/flightgear/ flightgear-flightgear
.
Or as plain text:
{{#tag:nowiki|{{sourceforge source | cmd = git clone | protocol = git | type = git | repo = flightgear | post = flightgear-flightgear | full = 1 }}}}.
git clone git://git.code.sf.net/p/flightgear/flightgear/ flightgear-flightgear.
Aliased parameters
This is a link to https://sourceforge.net/p/flightgear/flightgear/ci/version/2016.1.1/~/tree/src/Main/fg_init.cxx#l165.
{{sourceforge source | p = flightgear | r = flightgear | b = version/2016.1.1/~ | f = src/Main/fg_init.cxx | l = 165 | full = 1 }}.
https://sourceforge.net/p/flightgear/flightgear/ci/version/2016.1.1/~/tree/src/Main/fg_init.cxx#l165.
Numbered parameters
This is a link to https://sourceforge.net/p/flightgear/flightgear/ci/version/2016.1.1/~/tree/src/Main/fg_init.cxx#l165.
{{sourceforge source | flightgear | flightgear | version/2016.1.1/~ | src/Main/fg_init.cxx | l = 165 | full = 1 }}.
https://sourceforge.net/p/flightgear/flightgear/ci/version/2016.1.1/~/tree/src/Main/fg_init.cxx#l165.
Related templates
|