Template:Gitlab url: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
(New template, as per FGW:VP#GitLab and GitHub templates)
 
(Converted this template to be a subtemplate of {{repo link}}, by replacing the original contents with Template:Gitlab_url/sandbox (see the discussion page).)
Line 1: Line 1:
https://gitlab.com/{{{1|}}}<!--
{{repo link
-->{{#if: {{{2|}}} <!-- Is a path defined? -->
| site                                              = gl
| <!-- Yes, go to the path --><!--
| cmd{{#if:{{{cmd|}}}||NULL}}                      = {{{cmd}}}
  -->/blob/{{{r|master}}}/{{{2}}}<!--
| opt{{#if:{{{opt|}}}||NULL}}                      = {{{opt}}}
  -->{{#if: {{{l|}}} <!-- Is a line number defined -->
| protocol                                          = https
  | <!-- Yes, go to the line number --><!--
| type                                              = {{{type|git web}}}
    -->&#35;L{{{l}}}
| user{{#if:{{{user|{{{u|}}}}}}||NULL}}            = {{{user|{{{u}}}}}}
  }}
| proj{{#if:{{{proj|{{{p|{{{1|}}}}}}}}}||NULL}}    = {{{proj|{{{p|{{{1}}}}}}}}}
| repo{{#if:{{{repo|{{{r|{{{2|}}}}}}}}}||NULL}}    = {{{repo|{{{r|{{{2}}}}}}}}}
| branch{{#if:{{{branch|{{{b|{{{3|}}}}}}}}}||NULL}} = {{{branch|{{{b|{{{3}}}}}}}}}
| tag{{#if:{{{tag|{{{t|}}}}}}||NULL}}              = {{{tag|{{{t}}}}}}
| path{{#if:{{{path|{{{f|{{{4|}}}}}}}}}||NULL}}    = {{{path|{{{f|{{{4}}}}}}}}}
| commit{{#if:{{{commit|{{{c|{{{5|}}}}}}}}}||NULL}} = {{{commit|{{{c|{{{5}}}}}}}}}
| line{{#if:{{{line|{{{l|}}}}}}||NULL}}            = {{{line|{{{l}}}}}}
| view{{#if:{{{view|{{{v|}}}}}}||NULL}}            = {{{view|{{{v}}}}}}
| post{{#if:{{{post|}}}||NULL}}                     = {{{post}}}
| full                                              = 1
}}<noinclude>
}}<noinclude>
{{Informative template|1=
__NOTOC__
== Goal ==
This template will return the URL of directory in [https://gitlab.com GitLab], and optionally a file in that directory.


== Usage ==
{{repo link/doc infrastructure url
  {{obr}}'''gitlab url'''{{!}}''project''{{!}}''path''{{!}}''l=''{{!}}''r=''{{cbr}}
| label    = GitLab
| site      = gitlab
| user      = 1
| gl        = 1
| git      = 1
| examples  =
=== No parameters ===
  {{obr}}gitlab url/sandbox{{cbr}}
{{gitlab url/sandbox}}


All parameters are optional.
=== Project ===
{{obr}}gitlab url/sandbox{{!}}tortoisegit{{!}}tortoisegit{{cbr}}
{{gitlab url/sandbox|tortoisegit|tortoisegit}}


; project:  The name of the project, which is comes between <code><nowiki>https://gitlab.com/</nowiki></code> and <code>/blob/...</code> in the URL.    If empty, the link will point to https://gitlab.com.
==== User repository ====
This is for https://gitlab.com/emilianh/Lockheed-L10-Electra.


; path: What follows after <code>/blob/<branch>/</code> 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.
  {{obr}}gitlab url/sandbox
{{!}} user  = emilianh
  {{!}} repo  = Lockheed-L10-Electra
  {{cbr}}


; lA 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 <code>l{{=}}1-5</code>.
{{gitlab url/sandbox
| user  = emilianh
| repo  = Lockheed-L10-Electra
}}
 
==== File ====
This is for https://gitlab.com/fg-radi/osm2city/blob/master/osm2city.py.
 
  {{obr}}gitlab url/sandbox
  {{!}} proj = fg-radi
{{!}} repo = osm2city
{{!}} path = osm2city.py
{{cbr}}.
 
{{gitlab url/sandbox
| proj = fg-radi
| repo = osm2city
| path = osm2city.py
}}.


; 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.
==== File and a branch ====
This is for https://gitlab.com/tortoisegit/tortoisegit/blob/REL_1.8.16.0_EXTERNAL/release.txt.


== Examples ==
{{obr}}gitlab url/sandbox
=== No parameters given ===
{{!}} proj  = tortoisegit
  {{obr}}gitlab url{{cbr}}
{{!}} repo  = tortoisegit
{{gitlab url}}
  {{!}} branch = REL_1.8.16.0_EXTERNAL
{{!}} path  = release.txt
{{cbr}}.


=== Project given ===
{{gitlab url/sandbox
{{obr}}gitlab url{{!}}tortoisegit/tortoisegit{{cbr}}
| proj  = tortoisegit
{{gitlab url|tortoisegit/tortoisegit}}
| repo  = tortoisegit
| branch = REL_1.8.16.0_EXTERNAL
| path  = release.txt
}}.


=== Project and path given ===
==== File and a commit ====
{{obr}}gitlab url{{!}}fg-radi/osm2city{{!}}osm2city.py{{cbr}}
This is for https://gitlab.com/extra500/extra500/blob/20ac59/extra500-set.xml.
{{gitlab url|fg-radi/osm2city|osm2city.py}}


=== Project, path and a commit reference given ===
  {{obr}}gitlab url/sandbox
  {{obr}}gitlab url{{!}}fg-radi/osm2city{{!}}osm2city.py{{!}}r=roads{{cbr}}
{{!}} proj  = extra500
{{gitlab url|fg-radi/osm2city|osm2city.py|r=roads}}
{{!}} repo  = extra500
{{!}} commit = 20ac59ad
{{!}} path  = extra500-set.xml
{{cbr}}.


{{obr}}gitlab url{{!}}tortoisegit/tortoisegit{{!}}release.txt{{!}}r=REL_1.8.16.0_EXTERNAL{{cbr}}
{{gitlab url/sandbox
{{gitlab url|tortoisegit/tortoisegit|release.txt|r=REL_1.8.16.0_EXTERNAL}}
| proj  = extra500
| repo  = extra500
| commit = 20ac59ad
| path  = extra500-set.xml
}}.


{{obr}}gitlab url{{!}}mdanil/Tu-144{{!}}Tu-144-jsbsim/systems/fuel.xml{{!}}r=5bca82f1{{cbr}}
==== File with line number ====
{{gitlab url|mdanil/Tu-144|Tu-144-jsbsim/systems/fuel.xml|r=5bca82f1}}
This is for https://gitlab.com/mdanil/Tu-144/blob/master/Models/Tu-144.xml#L8-14.


  {{obr}}gitlab url{{!}}mdanil/Tu-144{{!}}Tu-144-jsbsim/systems/fuel.xml{{!}}r=5bca82f107a750036e0d4e3f32c6d3da1d7e7860{{cbr}}
  {{obr}}gitlab url/sandbox
{{gitlab url|mdanil/Tu-144|Tu-144-jsbsim/systems/fuel.xml|r=5bca82f107a750036e0d4e3f32c6d3da1d7e7860}}
{{!}} user  = mdanil
{{!}} repo  = Tu-144
{{!}} view  = blob
{{!}} branch = master
{{!}} path  = Models/Tu-144.xml
{{!}} line  = 8-14
{{cbr}}.


=== Line parameter given ===
{{gitlab url/sandbox
{{obr}}gitlab url{{!}}mdanil/Tu-144{{!}}Models/Tu-144.xml{{!}}l=2{{cbr}}
| user  = mdanil
{{gitlab url|mdanil/Tu-144|Models/Tu-144.xml|l=2}}
| repo  = Tu-144
| view  = blob
| branch = master
| path  = Models/Tu-144.xml
| line  = 8-14
}}.


==== Mulitple lines given ====
==== The FlightGear Multiplayer server software ====
{{obr}}gitlab url{{!}}mdanil/Tu-144{{!}}Models/Tu-144.xml{{!}}l=8-14{{cbr}}
This is for https://gitlab.com/fgms/fgms-0-x.git.
{{gitlab url|mdanil/Tu-144|Models/Tu-144.xml|l=8-14}}


=== Usage in a wiki URL ===
  {{obr}}gitlab url/sandbox
  <nowiki>[{{gitlab url|tortoisegit/tortoisegit|README.md}} For more information about TortoiseGit, see the readme]</nowiki>
  {{!}} proj = fgms
[{{gitlab url|tortoisegit/tortoisegit|README.md}} For more information about TortoiseGit, see the readme]
  {{!}} repo = fgms-0-x
  {{!}} type = git
{{cbr}}.


== Related templates ==
{{gitlab url/sandbox
=== Source link templates ===
  | proj  = fgms
* {{tl|fgaddon url}}
  | repo  = fgms-0-x
* {{tl|fgdata file}}
  | type  = git
* {{tl|simgear file}}
}}.
* {{tl|flightgear file}}
* {{tl|repo link}} — ''Should be considered decrepitated, replaced by the above''


=== Commit link templates ===
==== Git clone ====
* {{tl|fgaddon revision}}
{{note|For a simpler interface, see {{tl|gitlab clone}}.}}
* {{tl|fgdata commit}}
This should produce <code><nowiki>git clone https://gitlab.com/extra500/extra500.git</nowiki></code>.
* {{tl|simgear commit}}
* {{tl|flightgear commit}}


=== Other ===
{{obr}}#tag:syntaxhighlight{{!}}
* {{tl|github url}}
{{obr}}gitlab url/sandbox
{{!}} cmd    = git clone
{{!}} proj  = extra500
{{!}} repo  = extra500
{{!}} branch = FG/2016.1
{{!}} type  = git
{{cbr}}
{{!}} lang = "sh"
{{cbr}}


{{#tag:syntaxhighlight|
{{gitlab url/sandbox
| cmd    = git clone
| proj  = extra500
| repo  = extra500
| branch = FG/2016.1
| type = git
}}
| lang = "sh"
}}
}}


[[Category:Repository link templates]]
==== Raw view ====
</noinclude>
This is for https://gitlab.com/extra500/extra500/raw/20ac59/extra500-set.xml.
 
{{obr}}gitlab url/sandbox
{{!}} proj  = extra500
{{!}} repo  = extra500
{{!}} view  = raw
{{!}} commit = 20ac59
{{!}} path  = extra500-set.xml
{{cbr}}.
 
{{gitlab url/sandbox
| proj  = extra500
| repo  = extra500
| view  = raw
| commit = 20ac59
| path  = extra500-set.xml
}}.
 
==== Commit ====
This is for https://gitlab.com/extra500/extra500/commit/20ac59ad.
 
{{obr}}gitlab url/sandbox
{{!}} proj  = extra500
{{!}} repo  = extra500
{{!}} view  = commit
{{!}} commit = 20ac59ad
{{cbr}}.
 
{{gitlab url/sandbox
| proj  = extra500
| repo  = extra500
| view  = commit
| commit = 20ac59ad
}}.
 
==== Tree view at a given commit ====
This is for https://gitlab.com/extra500/extra500/tree/20ac59ad.
 
{{obr}}gitlab url/sandbox
{{!}} proj  = extra500
{{!}} repo  = extra500
{{!}} view  = tree
{{!}} commit = 20ac59ad
{{cbr}}.
 
{{gitlab url/sandbox
| proj  = extra500
| repo  = extra500
| view  = tree
| commit = 20ac59ad
}}.
 
==== Main views ====
===== History view =====
This is for https://gitlab.com/mailman/mailman/commits/master.
 
{{obr}}gitlab url/sandbox
{{!}} user  = mailman
{{!}} repo  = mailman
{{!}} view  = commits
{{cbr}}.
 
{{gitlab url/sandbox
| user  = mailman
| repo  = mailman
| view  = commits
}}.
 
===== History view from a commit =====
This is for https://gitlab.com/mailman/mailman/commits/1236a9cf.
 
{{obr}}gitlab url/sandbox
{{!}} user  = mailman
{{!}} repo  = mailman
{{!}} view  = commits
{{!}} commit = 1236a9cf
{{cbr}}.
 
{{gitlab url/sandbox
| user  = mailman
| repo  = mailman
| view  = commits
| commit = 1236a9cf
}}.
 
==== Zip archive download ====
{{note|For a simpler interface, see {{tl|gitlab zip file}}.}}
This is for https://gitlab.com/extra500/extra500/repository/archive.zip?ref=FG/2016.1.
 
{{obr}}gitlab url/sandbox
{{!}} proj  = extra500
{{!}} repo  = extra500
{{!}} branch = FG/2016.1
{{!}} type  = zip
{{cbr}}
 
{{gitlab url/sandbox
| proj  = extra500
| repo  = extra500
| branch = FG/2016.1
| type  = zip
}}
=== Aliased parameters ===
This is for https://gitlab.com/extra500/extra500/repository/archive.zip?ref=FG/2016.1.
 
{{obr}}gitlab url/sandbox
{{!}} p    = extra500
{{!}} r    = extra500
{{!}} b    = FG/2016.1
{{!}} type = zip
{{cbr}}.
 
{{gitlab url/sandbox
| p    = extra500
| r    = extra500
| b    = FG/2016.1
| type = zip
}}.
 
=== Numbered parameters ===
This is for https://gitlab.com/extra500/extra500/repository/archive.zip?ref=FG/2016.1.
 
{{obr}}gitlab url/sandbox {{!}} extra500 {{!}} extra500 {{!}} FG/2016.1 {{!}} type = zip {{cbr}}.
 
{{gitlab url/sandbox | extra500 | extra500 | FG/2016.1 | type = zip }}.
 
}}</noinclude>

Revision as of 09:44, 24 May 2016

https://gitlab.com


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

Goal

This template is for creating direct URLs for the content of the version control repositories of the GitLab open source infrastructure. This is equivalent to the {{gitlab 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 GitLab repositories.

Usage

{{gitlab url
| cmd        =
| opt        =
| type       =
| user       =
| proj       =
| repo       =
| branch     =
| tag        =
| commit     =
| path       =
| line       =
| post       =
| view       =
}}

Either the user or proj parameter, as well as the repo parameter, must be supplied. All other 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.
Note The separation of cmd and opt is for future non-CLI handling of a standardised set of cmd parameter values
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
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 1 mandatory
proj The name of the project, consisting of a grouping of repositories on the open source infrastructure. p 1 mandatory
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. r 2 mandatory
branch The branch name. This defaults to next. b 3 optional
tag The repository tag name. t optional
commit The commit identifier (git hash). This defaults to HEAD. c 5 optional
path The file or directory path. f 4 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:
  • The GitLab interface for type = git web is not yet implemented in the master {{repo link}} template, so the view parameter currently does nothing.
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> <post>

Site: GitLab

The base URL for GitLab repositories is:

<protocol>://gitlab.com/<proj>[/<repo>]

GitLab <URL> for 'type=git'

For this parameter value, the complete <URL> value will be:

<protocol>://gitlab.com/<proj>[/<repo>].git

GitLab <URL> for 'type=git web'

This is not implemented yet. Please add new examples to allow this template to be extended.

GitLab <URL> for 'type=zip'

For this parameter value, the base zip file URL will be:

<protocol>://gitlab.com/<proj>/<repo>/repository/archive.zip

If a branch, tag, or commit is specified, this will be added as a query:

<protocol>://gitlab.com/<proj>/<repo>/repository/archive.zip[?ref=<commit|tag|branch>]

GitLab URL <TEXT>

This is not implemented yet. Please add new examples to allow this template to be extended.

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

{{gitlab url/sandbox}}

Template:Gitlab url/sandbox

Project

{{gitlab url/sandbox|tortoisegit|tortoisegit}}

Template:Gitlab url/sandbox

User repository

This is for https://gitlab.com/emilianh/Lockheed-L10-Electra.

{{gitlab url/sandbox
| user   = emilianh
| repo   = Lockheed-L10-Electra
}}

Template:Gitlab url/sandbox

File

This is for https://gitlab.com/fg-radi/osm2city/blob/master/osm2city.py.

{{gitlab url/sandbox
| proj = fg-radi
| repo = osm2city
| path = osm2city.py
}}.

Template:Gitlab url/sandbox.

File and a branch

This is for https://gitlab.com/tortoisegit/tortoisegit/blob/REL_1.8.16.0_EXTERNAL/release.txt.

{{gitlab url/sandbox
| proj   = tortoisegit
| repo   = tortoisegit
| branch = REL_1.8.16.0_EXTERNAL
| path   = release.txt
}}.

Template:Gitlab url/sandbox.

File and a commit

This is for https://gitlab.com/extra500/extra500/blob/20ac59/extra500-set.xml.

{{gitlab url/sandbox
| proj   = extra500
| repo   = extra500
| commit = 20ac59ad
| path   = extra500-set.xml
}}.

Template:Gitlab url/sandbox.

File with line number

This is for https://gitlab.com/mdanil/Tu-144/blob/master/Models/Tu-144.xml#L8-14.

{{gitlab url/sandbox
| user   = mdanil
| repo   = Tu-144
| view   = blob
| branch = master
| path   = Models/Tu-144.xml
| line   = 8-14
}}.

Template:Gitlab url/sandbox.

The FlightGear Multiplayer server software

This is for https://gitlab.com/fgms/fgms-0-x.git.

{{gitlab url/sandbox
  | proj = fgms
  | repo = fgms-0-x
  | type = git
}}.

Template:Gitlab url/sandbox.

Git clone

Note  For a simpler interface, see {{gitlab clone}}.

This should produce git clone https://gitlab.com/extra500/extra500.git.

{{#tag:syntaxhighlight|
{{gitlab url/sandbox
| cmd    = git clone
| proj   = extra500
| repo   = extra500
| branch = FG/2016.1
| type   = git
}}
| lang = "sh"
}}
[[:Template:Gitlab url/sandbox]]

Raw view

This is for https://gitlab.com/extra500/extra500/raw/20ac59/extra500-set.xml.

{{gitlab url/sandbox
| proj   = extra500
| repo   = extra500
| view   = raw
| commit = 20ac59
| path   = extra500-set.xml
}}.

Template:Gitlab url/sandbox.

Commit

This is for https://gitlab.com/extra500/extra500/commit/20ac59ad.

{{gitlab url/sandbox
| proj   = extra500
| repo   = extra500
| view   = commit
| commit = 20ac59ad
}}.

Template:Gitlab url/sandbox.

Tree view at a given commit

This is for https://gitlab.com/extra500/extra500/tree/20ac59ad.

{{gitlab url/sandbox
| proj   = extra500
| repo   = extra500
| view   = tree
| commit = 20ac59ad
}}.

Template:Gitlab url/sandbox.

Main views

History view

This is for https://gitlab.com/mailman/mailman/commits/master.

{{gitlab url/sandbox
| user   = mailman
| repo   = mailman
| view   = commits
}}.

Template:Gitlab url/sandbox.

History view from a commit

This is for https://gitlab.com/mailman/mailman/commits/1236a9cf.

{{gitlab url/sandbox
| user   = mailman
| repo   = mailman
| view   = commits
| commit = 1236a9cf
}}.

Template:Gitlab url/sandbox.

Zip archive download

Note  For a simpler interface, see {{gitlab zip file}}.

This is for https://gitlab.com/extra500/extra500/repository/archive.zip?ref=FG/2016.1.

{{gitlab url/sandbox
| proj   = extra500
| repo   = extra500
| branch = FG/2016.1
| type   = zip
}}

Template:Gitlab url/sandbox

Aliased parameters

This is for https://gitlab.com/extra500/extra500/repository/archive.zip?ref=FG/2016.1.

{{gitlab url/sandbox
| p    = extra500
| r    = extra500
| b    = FG/2016.1
| type = zip
}}.

Template:Gitlab url/sandbox.

Numbered parameters

This is for https://gitlab.com/extra500/extra500/repository/archive.zip?ref=FG/2016.1.

{{gitlab url/sandbox | extra500 | extra500 | FG/2016.1 | type = zip }}.

Template:Gitlab url/sandbox.

Related templates