Template:Fgmeta url
https://gitlab.com/flightgear/fgmeta
Goal
This template is for creating direct URLs for the FGMeta git version control repository. This is equivalent to the {{fgmeta source}} template with the full parameter set to 1. It is a subtemplate of the master {{repo link}} template designed to be specific for the FGMeta repository.
Usage
{{fgmeta url
| cmd =
| opt =
| protocol =
| login =
| type =
| branch =
| tag =
| commit =
| path =
| line =
| post =
| view =
}}
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 | ||
| protocol | The URL protocol, for example https, http, ssh, git. This defaults to https. | optional | ||
| login | The optional user login. | 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. 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.
|
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 |
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://gitlab.com
To use the <code> tags:
{{#tag:code|{{#tag:nowiki|
{{repo link
| full = 1
}}
}}}}
https://gitlab.com
Examples
No parameters
{{fgmeta url}}
https://gitlab.com/flightgear/fgmeta
File
{{fgmeta url
| path = CMakeLists.txt
}}
https://gitlab.com/flightgear/fgmeta/blob/next/CMakeLists.txt
File and a branch
{{fgmeta url
| path = CMakeLists.txt
| branch = release/2016.1/~
}}
https://gitlab.com/flightgear/fgmeta/blob/release/2016.1/~/CMakeLists.txt
File and a tag
{{fgmeta url
| path = CMakeLists.txt
| tag = version/2016.1.1/~
}}
https://gitlab.com/flightgear/fgmeta/blob/version/2016.1.1/~/CMakeLists.txt
File and a commit
{{fgmeta url
| path = CMakeLists.txt
| commit = 355a88
}}
https://gitlab.com/flightgear/fgmeta/blob/355a88/CMakeLists.txt
{{fgmeta url
| path = CMakeLists.txt
| commit = 355a88d0cdcbffae29a1f18c5667c3c0dcadd95c
}}
https://gitlab.com/flightgear/fgmeta/blob/355a88d0cdcbffae29a1f18c5667c3c0dcadd95c/CMakeLists.txt
File and line number
{{fgmeta url
| path = download_and_compile.sh
| line = 98
}}
https://gitlab.com/flightgear/fgmeta/blob/next/download_and_compile.sh#L98
{{fgmeta url
| path = download_and_compile.sh
| commit = 4bf8367d3c1a7dc81759816c9db614e6b2e39b11
| line = 20
}}
Aliased parameters
This is for https://sourceforge.net/p/flightgear/fgmeta/ci/version/2016.1.1/~/tree/CMakeLists.txt.
{{fgmeta url
| f = CMakeLists.txt
| b = version/2016.1.1/~
}}.
https://gitlab.com/flightgear/fgmeta/blob/version/2016.1.1/~/CMakeLists.txt.
Numbered parameters
This is for https://sourceforge.net/p/flightgear/fgmeta/ci/version/2016.1.1/~/tree/CMakeLists.txt.
{{fgmeta url | CMakeLists.txt | b = version/2016.1.1/~ }}.
https://gitlab.com/flightgear/fgmeta/blob/version/2016.1.1/~/CMakeLists.txt.
Related templates
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||