Template:Gitlab url
Jump to navigation
Jump to search
The following template description is not displayed when the template is inserted in an article.
Goal
This template will return the URL of directory in GitLab, and optionally a file in that directory.
Usage
{{gitlab url|project|path|l=|r=}}
All parameters are optional.
- project
- The name of the project, which is comes between
https://gitlab.com/
and/blob/...
in the URL. If empty, the link will point to https://gitlab.com.
- path
- What follows after
/blob/<branch>/
in the URL. Can be the path to a file or a directory. If empty, the link will point to the root of the project.
- l
- A line number. This could just be a single number, or, when linking to a range of lines, two line numbers separated by a hyphen (-), for example
l=1-5
.
- r
- A commit reference. Usually the SHA-1 commit ID (which can be abbreviated), but it can also be a tag or a branch name. If empty, the link will point to the master branch.
Examples
No parameters given
{{gitlab url}}
Project given
{{gitlab url|tortoisegit/tortoisegit}}
https://gitlab.com/tortoisegit/tortoisegit
Project and path given
{{gitlab url|fg-radi/osm2city|osm2city.py}}
https://gitlab.com/fg-radi/osm2city/blob/master/osm2city.py
Project, path and a commit reference given
{{gitlab url|fg-radi/osm2city|osm2city.py|r=roads}}
https://gitlab.com/fg-radi/osm2city/blob/roads/osm2city.py
{{gitlab url|tortoisegit/tortoisegit|release.txt|r=REL_1.8.16.0_EXTERNAL}}
https://gitlab.com/tortoisegit/tortoisegit/blob/REL_1.8.16.0_EXTERNAL/release.txt
{{gitlab url|mdanil/Tu-144|Tu-144-jsbsim/systems/fuel.xml|r=5bca82f1}}
https://gitlab.com/mdanil/Tu-144/blob/5bca82f1/Tu-144-jsbsim/systems/fuel.xml
{{gitlab url|mdanil/Tu-144|Tu-144-jsbsim/systems/fuel.xml|r=5bca82f107a750036e0d4e3f32c6d3da1d7e7860}}
Line parameter given
{{gitlab url|mdanil/Tu-144|Models/Tu-144.xml|l=2}}
https://gitlab.com/mdanil/Tu-144/blob/master/Models/Tu-144.xml#L2
Mulitple lines given
{{gitlab url|mdanil/Tu-144|Models/Tu-144.xml|l=8-14}}
https://gitlab.com/mdanil/Tu-144/blob/master/Models/Tu-144.xml#L8-14
Usage in a wiki URL
[{{gitlab url|tortoisegit/tortoisegit|README.md}} For more information about TortoiseGit, see the readme]
For more information about TortoiseGit, see the readme
Related templates
Source link templates
- {{fgaddon url}}
- {{fgdata file}}
- {{simgear file}}
- {{flightgear file}}
- {{repo link}} — Should be considered decrepitated, replaced by the above
Commit link templates
- {{fgaddon revision}}
- {{fgdata commit}}
- {{simgear commit}}
- {{flightgear commit}}
Other
- {{github url}}