Template:Gitlab source

From relax wiki
Revision as of 12:23, 25 October 2017 by Bugman (talk | contribs) (Creation of the {{gitlab source}} template by copying {{github source}}.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

GitLab website

Template documentation

Goal

This template is for creating links or URLs for the content of the version control repositories of the GitLab open source infrastructure. It is a subtemplate of the master {{repo link}} template designed to be specific for the GitLab repositories.

Usage

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

| view       =
| text       =
| pre        =
| simplepath =
| full       =
}}

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. 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
text Text to display as the link label. Overrides pre. t optional
pre Prefix to a link label. optional
simplepath If set, this strips off the repository name from the URL label, leaving just the contents of the path parameter.
Note The text parameter will override this.
optional
full If set to 1, the full URL will be shown rather than any text label. 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: 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/nmr-relax/code/ci/master/tree/

To use the <code> tags:

{{#tag:code|{{#tag:nowiki|
  {{repo link
  | full = 1
  }}
}}}}

https://sourceforge.net/p/nmr-relax/code/ci/master/tree/

Examples

Base site URL

This is for the GitLab website when no parameters are supplied.

{{gitlab source}}.

GitLab website.

{{gitlab source|full=1}}.

https://gitlab.com.

The source repository

This is a link to https://gitlab.com/nmr-relax/relax/tree/master.

{{gitlab source
| proj   = nmr-relax
| repo   = relax
| branch = master
| text   = The relax source repository
}}.

The relax source repository.

File with line number

This is a link to https://gitlab.com/nmr-relax/relax/blob/master/gui/spin_viewer/tree.py#L68.

{{gitlab source
| proj = nmr-relax
| repo = relax
| path = gui/spin_viewer/tree.py
| line = 68
}}.

gitlab/nmr-relax/relax/master/gui/spin_viewer/tree.py#L68.

File prefixed with $RELAX_SRC

This is a link to https://gitlab.com/nmr-relax/relax/blob/master/pipe_control/diffusion_tensor.py. The expected link text is "$RELAX_SRC/pipe_control/diffusion_tensor.py".

{{gitlab source
| proj = nmr-relax
| repo = relax
| path = pipe_control/diffusion_tensor.py
| pre  = $RELAX_SRC
}}.

$RELAX_SRC/pipe_control/diffusion_tensor.py.

Branch

This is a link to https://gitlab.com/nmr-relax/relax/tree/j_couplings.

{{gitlab source
| proj   = nmr-relax
| repo   = relax
| branch = j_couplings
}}.

gitlab/nmr-relax/relax/j_couplings.

Tag

This is a link to https://gitlab.com/nmr-relax/relax/tree/4.0.3.

{{gitlab source
| proj = nmr-relax
| repo = relax
| tag  = 4.0.3
}}.

gitlab/nmr-relax/relax/4.0.3.

Tag, history view

This is a link to https://gitlab.com/nmr-relax/relax/commits/4.0.3.

{{gitlab source
| proj = nmr-relax
| repo = relax
| tag  = 4.0.3
| view = commits
}}.

gitlab/nmr-relax/relax/4.0.3.

Commit

Note  For a simpler interface for this specific example, see {{relax commit}}.

This is a link to https://gitlab.com/nmr-relax/relax/commit/bb91d693f4102f81735e2a965cc1eed610211753.

{{gitlab source
| proj   = nmr-relax
| repo   = relax
| commit = bb91d693f4102f81735e2a965cc1eed610211753
| view   = commit
}}.

gitlab/nmr-relax/relax/bb91d693f4102f81735e2a965cc1eed610211753.

Commit, history view

This is a link to https://gitlab.com/nmr-relax/relax/commits/6105c8.

{{gitlab source
| proj   = nmr-relax
| repo   = relax
| commit = 6105c8
| view   = commits
}}.

gitlab/nmr-relax/relax/6105c8.

Repository clone

Note  For a simpler interface for this specific example, see {{gitlab clone}} and {{relax clone}}.

This is for git clone git://git.code.sf.net/p/nmr-relax/relax relax.

{{#tag:code|{{#tag:nowiki|{{gitlab source
| cmd      = git clone
| protocol = git
| type     = git
| proj     = nmr-relax
| repo     = relax
| post     = relax
| full     = 1
}}}}}}.

git clone https://gitlab.com/nmr-relax/relax.git relax.

Or as plain text:

{{#tag:nowiki|{{gitlab source
| cmd      = git clone
| protocol = git
| type     = git
| proj     = nmr-relax
| repo     = relax
| post     = relax
| full     = 1
}}}}.

git clone https://gitlab.com/nmr-relax/relax.git relax.

Aliased parameters

This is a link to https://gitlab.com/nmr-relax/relax/blob/j_couplings/generic_fns/align_tensor.py#L68.

{{gitlab source
| p    = nmr-relax
| r    = relax
| b    = j_couplings
| f    = generic_fns/align_tensor.py
| l    = 68
| full = 1
}}.

https://gitlab.com/nmr-relax/relax/blob/j_couplings/generic_fns/align_tensor.py#L68.

Numbered parameters

This is a link to https://gitlab.com/nmr-relax/relax/blob/j_couplings/generic_fns/align_tensor.py#L68.

{{gitlab source | nmr-relax | relax | j_couplings | generic_fns/align_tensor.py | l=68 | full = 1 }}.

https://gitlab.com/nmr-relax/relax/blob/j_couplings/generic_fns/align_tensor.py#L68.

Related templates