Template:Fgdata-old source
Goal
This template is for creating links or URLs for the archived fgdata-old git version control repository. It is a subtemplate of the master {{repo link}} template designed to be specific for the archived Gitorious repository.
Usage
{{fgdata-old source | cmd = | opt = | type = | branch = | tag = | commit = | path = | line = | post = | view = | text = | pre = | simplepath = | full = }}
All 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 | ||
type | Choose between the web interface or a direct repository link. This can be one of git, git web. The default is git web. | optional | ||
branch | The branch name. This defaults to next. | b | optional | |
tag | The repository tag name. | optional | ||
commit | The commit identifier (git hash). This defaults to HEAD. | c | optional | |
path | The file or directory path. | f | 1 | 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: Gitorious
The Gitorious URLs are predominantly query rather than path based. And only the https://
protocol is supported. The base URL constructed by this template is:
<protocol>://gitorious.org/<proj>/<repo>
Gitorious <URL> for 'type=git'
For this parameter value, the complete <URL>
value will be:
<protocol>://gitorious.org/<proj>/<repo>.git
Gitorious <URL> for 'type=git web'
As the current archival system is based on queries — the text after the ?
character — absolutely any random path after the gitorious.org/
domain name can be used. But, for aesthetics, the project and repository name will be appended by this template. The <URL>
will be:
<protocol>://gitorious.org/<proj>/<repo>?<QUERY>[#l<line>]
The <QUERY>
string consists of parts for the project and repository (p=
), the type of view (a=
), the path (f=
), and the commit, branch or tag (h=
or hb=
, depending on the view).
The <URL>
fragment for the project and repository is constructed as:
<protocol>://gitorious.org/<proj>/<repo>?p=<proj>:<repo>.git
The <URL>
fragment for the view is constructed as:
<protocol>://gitorious.org/<proj>/<repo>?a=<VIEW>
Where <VIEW>
is the value of the view parameter, if supplied, with the value of raw translated to blob_plain
. If not supplied, the value of blob
is used if path is given, commit
if commit is given, or summary
otherwise.
The <URL>
fragment for the path is constructed as:
<protocol>://gitorious.org/<proj>/<repo>?f=<path>
If the view parameter is set to one of blob, raw, or tree, the <URL>
fragment for the commit, branch or tag is constructed as:
<protocol>://gitorious.org/<proj>/<repo>[?hb=refs/merge-requests/<mr>|<commit>|refs/heads/<branch>]
Otherwise it will be:
<protocol>://gitorious.org/<proj>/<repo>[?h=refs/merge-requests/<mr>|<commit>|refs/heads/<branch>]
In summary, the full web URL will be:
<protocol>://gitorious.org/<proj>/<repo>?p=<proj>:<repo>.git;a=<VIEW>[;f=<path>][;<h|hb>=refs/merge-requests/<mr>|<commit>|refs/heads/<branch>][#l<line>]
Gitorious URL <TEXT>
The link text <TEXT>
, if the full parameter is not set, will be:
<proj>/<repo>/<commit|branch|HEAD>[/<path>][#l<line>]
If the simplepath parameter is set, this changes to:
[/<path>][#l<line>]
If the pre parameter is supplied, this changes to:
<pre>[/<path>][#l<line>]
The text parameter trumps all, and <TEXT>
is simply:
<text>
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
No parameters
{{fgdata-old source}}
The repository
{{fgdata-old source | text = The fgdata version controlled repository }}
The fgdata version controlled repository
File
{{fgdata-old source | path = Aircraft-uiuc/Cessna172/aircraft.dat }}
gitorious/fg/fgdata/HEAD/Aircraft-uiuc/Cessna172/aircraft.dat
File and a branch
{{fgdata-old source | path = Aircraft-uiuc/Cessna172/aircraft.dat | branch = release/3.2.0 }}
gitorious/fg/fgdata/release/3.2.0/Aircraft-uiuc/Cessna172/aircraft.dat
File and a tag
{{fgdata-old source | path = Aircraft-uiuc/Cessna172/aircraft.dat | tag = version/3.2.0 }}
gitorious/fg/fgdata/version/3.2.0/Aircraft-uiuc/Cessna172/aircraft.dat
File and a commit
{{fgdata-old source | path = Translations/fr/options.xml | commit = 3d155f }}
gitorious/fg/fgdata/3d155f/Translations/fr/options.xml
{{fgdata-old source | path = Translations/fr/options.xml | commit = 3d155fb6813c578d1f3c52eb23c98d145b2111ef }}
gitorious/fg/fgdata/3d155fb6813c578d1f3c52eb23c98d145b2111ef/Translations/fr/options.xml
Commit
{{fgdata-old source | commit = 9f6576 | view = commit }}
File and line number
{{fgdata-old source | path = AI/nimitz_demo.xml | line = 4 }}
gitorious/fg/fgdata/HEAD/AI/nimitz_demo.xml#l4
File, line number, and commit
{{fgdata-old source | path = AI/nimitz_demo.xml | commit = c3fbdf452745effa5a879efe1a958084b60d22e2 | line = 18 }}
gitorious/fg/fgdata/c3fbdf452745effa5a879efe1a958084b60d22e2/AI/nimitz_demo.xml#l18
Custom label given
{{fgdata-old source | path = Effects/model-combined.eff | text = The fgdata-old model-combined effect }}
The fgdata-old model-combined effect
Prefix of $FG_ROOT
{{fgdata-old source | path = Effects/model-combined.eff | pre = $FG_ROOT }}
$FG_ROOT/Effects/model-combined.eff
Full path
{{fgdata-old source | path = AI/nimitz_demo.xml | commit = 7b53516a9619f598721d7ee34d6a446367e9d9cd | line = 85 | full = 1 }}
Command
{{#tag:syntaxhighlight| {{fgdata-old source | cmd = git pull | protocol = git | type = git | post = master | full = 1 }} | lang = "sh" }}
git pull https://gitorious.org/fg/fgdata.git master
Aliased parameters
{{fgdata-old source | f = Aircraft-uiuc/Cessna172/aircraft.dat | b = release/3.2.0 | full = 1 }}
Numbered parameters
{{fgdata-old source | Aircraft-uiuc/Cessna172/aircraft.dat | b = release/3.2.0 | full = 1 }}.
Related templates
|