Template:Sg src file
Goal
This template is for creating links prefixed with $SG_SRC for files in the SimGear git version control repository. It is a subtemplate of the master {{repo link}} template designed to be specific for creating SimGear links prefixed with $SG_SRC.
Usage
{{sg src file | branch = | commit = | path = | line = | view = }}
All parameters are optional.
Parameter | Description | Abbreviated parameter |
Numbered parameter |
Status |
---|---|---|---|---|
branch | The branch name. This defaults to next. For SourceForge git repositories, if the character / is present in the branch name, the text /~ must be appended to the branch.
|
b | 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 | |
view | View to display:
|
v | 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 page
For a normal SourceForge project page, the base URL is respectively constructed as:
<protocol>://<DOMAIN>/p/<proj>/<repo>/
For the type parameter value of git, a login is allowed:
<protocol>://[<login>@]<DOMAIN>/p/<proj>/<repo>/
SourceForge <URL> for 'type=git'
For this parameter value, the complete <URL>
value will be:
<protocol>://[<login>@]git.code.sf.net/p/<proj>/<repo>/
SourceForge <URL> for 'type=git web'
For this parameter value, the <URL>
value will be:
<protocol>://sourceforge.net/p/<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/p/<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:
<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:
<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>
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
{{sg src file}}.
File
{{sg src file | path = simgear/ephemeris/ephemeris.cxx }}.
$SG_SRC/simgear/ephemeris/ephemeris.cxx.
File and a tag
{{sg src file | path = simgear/ephemeris/ephemeris.cxx | branch = version/2016.1.1/~ }}.
$SG_SRC/simgear/ephemeris/ephemeris.cxx (branch version/2016.1.1/~).
File and a commit
{{sg src file | path = simgear/sky/skydome.cxx | commit = 86892d }}.
$SG_SRC/simgear/sky/skydome.cxx (commit 86892d).
{{sg src file | path = simgear/sky/skydome.cxx | commit = 86892d87e9d8f7054aeb43e66bda0d75fe41258f }}.
$SG_SRC/simgear/sky/skydome.cxx (commit 86892d87e9d8f7054aeb43e66bda0d75fe41258f).
Commit
{{sg src file | commit = 7f4f77 | view = commit }}.
$SG_SRC (commit 7f4f77) commit view.
File and line number
{{sg src file | path = simgear/nasal/nasal.h | line = 46 }}.
$SG_SRC/simgear/nasal/nasal.h#l46.
File, line number, and commit
{{sg src file | path = simgear/nasal/nasal.h | commit = 1786692406214447db12b9d5af5364582af23d3b | line = 67 }}.
$SG_SRC/simgear/nasal/nasal.h#l67 (commit 1786692406214447db12b9d5af5364582af23d3b).
Aliased parameters
This is for https://sourceforge.net/p/flightgear/simgear/ci/version/2016.1.1/~/tree/simgear/ephemeris/ephemeris.cxx.
{{sg src file | f = simgear/ephemeris/ephemeris.cxx | b = version/2016.1.1/~ }}.
$SG_SRC/simgear/ephemeris/ephemeris.cxx (branch version/2016.1.1/~).
Numbered parameters
This is for https://sourceforge.net/p/flightgear/simgear/ci/version/2016.1.1/~/tree/simgear/ephemeris/ephemeris.cxx.
{{sg src file | simgear/ephemeris/ephemeris.cxx | b = version/2016.1.1/~ }}.
$SG_SRC/simgear/ephemeris/ephemeris.cxx (branch version/2016.1.1/~).
Related templates
|