Template:Fg aircraft file

From FlightGear wiki
Jump to navigation Jump to search

$FG_AIRCRAFT/Aircraft/


The following template description is not displayed when the template is inserted in an article.

Goal

This template is for creating links prefixed with $FG_AIRCRAFT for files in git or svn version control repositories. It is a subtemplate of the master {{repo link}} template designed to be specific for creating Mediawiki links prefixed with $FG_AIRCRAFT.

Usage

{{fg aircraft file
| site       =
| type       =
| user       =
| proj       =
| repo       =
| branch     =
| tag        =
| commit     =
| path       =
| line       =
| view       =
}}

All parameters are optional.

Parameter Description Abbreviated
parameter
Numbered
parameter
Status
site Points the template to a repository host:
  • For SourceForge use either s, sf or sourceforge.
  • For GitHub use either gh, gith or github.
  • For GitLab use either gl, gitl or gitlab.
  • For the Gitorious archive use either g, go, gito or gitorious.
  • For generic repositories, the site parameter will be interpreted as the domain name.
optional
type Choose between the web interface, a direct repository link, or a zip file download. This can be one of git, git web, svn, svn web, zip. See the {{* zip file}} templates for a simplified interface for the zip files. The default is git web.
Note Zip archive downloads are currently only supported for GitHub and GitLab repositories.
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 optional
proj The name of the project, consisting of a grouping of repositories on the open source infrastructure.This defaults to flightgear. p 1 optional
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.This defaults to fgaddon. r 2 optional
branch The branch name. As tags are simply branches in SVN repositories, this parameter can also be used for svn tags. This defaults to next 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 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. t optional
commit The commit identifier (git hash or svn revision number). This defaults to HEAD. c optional
path The file or directory path. f 3 optional
line The line number(s) of the file to display.
  • For SourceForge and the Gitorious archive: Use a single line number.
  • For GitHub either use:
    • A single line number, for example 2.
    • Two line numbers separated with a hyphen (-), for example 3-10.
l optional
view View to display:
  • For SourceForge use one of tree, log, commit, or rss. If a commit is specified (the commit parameter is set and path is not), the default is commit. Otherwise the default is tree.
  • For GitHub use one of blob, blame, commit, commits or raw. The default is tree.
  • The GitLab interface for type = git web is not yet implemented in the master {{repo link}} template, so the view parameter currently does nothing.
  • For the Gitorious archive use one of summary, shortlog, log, blob, commit, commitdiff, patch, tree, history, or raw. The default is commit if a merge request is supplied, blob if a path is given, commit if a commit is given, shortlog if a branch is given, or summary otherwise.
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 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:

<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

{{fg aircraft file}}

$FG_AIRCRAFT/Aircraft/

File

{{fg aircraft file
| path = Beagle-Pup/pup160-set.xml
}}

$FG_AIRCRAFT/Aircraft/Beagle-Pup/pup160-set.xml

File and a branch

{{fg aircraft file
| path   = p51d/initfile.xml
| branch = branches/release-2016.2
}}

$FG_AIRCRAFT/Aircraft/p51d/initfile.xml

File and a commit

{{fg aircraft file
| path   = paraglider/Models/Effects/wingflexL.eff
| commit = 1820
}}

$FG_AIRCRAFT/Aircraft/paraglider/Models/Effects/wingflexL.eff

File and line number

{{fg aircraft file
| path = Gloster-Gladiator/gladiator-base.xml
| line = 77
}}

$FG_AIRCRAFT/Aircraft/Gloster-Gladiator/gladiator-base.xml#l77

File, line number, and commit

{{fg aircraft file
| path   = Parachutist/Parachutist-set.xml
| commit = 1781
| line   = 27
}}

$FG_AIRCRAFT/Aircraft/Parachutist/Parachutist-set.xml#l27

Aliased parameters

This is for https://sourceforge.net/p/flightgear/fgaddon/HEAD/tree/branches/release-2016.2/Aircraft/A-10/A-10-readme.txt.

{{fg aircraft file
| f = A-10/A-10-readme.txt
| b = branches/release-2016.2
}}.

$FG_AIRCRAFT/Aircraft/A-10/A-10-readme.txt.

Numbered parameters

This is for https://gitlab.com/extra500/extra500/blob/FG/2016.1/extra500-set.xml.

{{fg aircraft file | site = gl | extra500 | extra500 | extra500-set.xml | branch = FG/2016.1 }}.

$FG_AIRCRAFT/Aircraft/extra500/extra500-set.xml.

Related templates