Open main menu

Template:Sourceforge source

Revision as of 11:14, 25 October 2017 by Bugman (talk | contribs) (Creation of the {{sourceforge source}} template. This is a merger of {{relax source}} and http://wiki.flightgear.org/index.php?title=Template:Sourceforge_source&oldid=98435.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

nmr-relax/code/master

Template documentation

Goal

This template is for creating links or URLs for the content of the version control repositories of the SourceForge open source infrastructure. It is a subtemplate of the master {{repo link}} template designed to be specific for the SourceForge repositories. Note If you wish to reference one of the relax repositories, instead you should use the repository specific {{* source}} subtemplates listed below.

Usage

{{sourceforge source
| cmd        =
| opt        =
| protocol   =
| login      =
| 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
protocol The URL protocol, for example https, http, ssh, git, svn. This defaults to https. optional
login The optional user login. This should not to be confused with the user parameter. optional
type Choose between the web interface or a direct repository link. This can be one of git, git web, svn, svn 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. As tags are simply branches in SVN repositories, this parameter can also be used for svn tags. This defaults to master 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 3 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 or svn revision number). 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.
  • For SourceForge: Use a single line number.
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:
  • 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.
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: 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/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

Note  For a simpler interface to the official relax repositories, please see all the repository specific templates in {{repo link/doc related}}.

The source repository

This is a link to https://sourceforge.net/p/nmr-relax/code/ci/master/tree/.

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

The relax source repository.

File with line number

This is a link to https://sourceforge.net/p/nmr-relax/code/ci/master/tree/gui/spin_viewer/tree.py#l68.

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

nmr-relax/code/master/gui/spin_viewer/tree.py#l68.

File prefixed with $RELAX_SRC

This is a link to https://sourceforge.net/p/nmr-relax/code/ci/master/tree/pipe_control/diffusion_tensor.py. The expected link text is "$RELAX_SRC/pipe_control/diffusion_tensor.py (branch master)".

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

$RELAX_SRC/pipe_control/diffusion_tensor.py (branch master).

Branch

This is a link to https://sourceforge.net/p/nmr-relax/code/ci/j_couplings/tree/.

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

nmr-relax/code/j_couplings.

Tag

This is a link to https://sourceforge.net/p/nmr-relax/code/ci/4.0.3/tree/.

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

nmr-relax/code/4.0.3.

Tag, history view

This is a link to https://sourceforge.net/p/nmr-relax/code/ci/4.0.3/log/?path=.

{{sourceforge source
| proj = nmr-relax
| repo = code
| tag  = 4.0.3
| view = log
}}.

nmr-relax/code/4.0.3 log view.

Commit

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

This is a link to https://sourceforge.net/p/nmr-relax/code/ci/bb91d693f4102f81735e2a965cc1eed610211753/

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

nmr-relax/code/bb91d693f4102f81735e2a965cc1eed610211753 commit view.

Commit, history view

This is a link to https://sourceforge.net/p/nmr-relax/code/ci/6105c8/log/?path=

{{sourceforge source
| proj   = nmr-relax
| repo   = code
| commit = 6105c8
| view   = log
}}.

nmr-relax/code/6105c8 log view.

Repository clone

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

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

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

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

Or as plain text:

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

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

Aliased parameters

This is a link to https://sourceforge.net/p/nmr-relax/code/ci/j_couplings/tree/generic_fns/align_tensor.py#l68.

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

https://sourceforge.net/p/nmr-relax/code/ci/j_couplings/tree/generic_fns/align_tensor.py#l68.

Numbered parameters

This is a link to https://sourceforge.net/p/nmr-relax/code/ci/j_couplings/tree/generic_fns/align_tensor.py#l68.

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

https://sourceforge.net/p/nmr-relax/code/ci/j_couplings/tree/generic_fns/align_tensor.py#l68.

Related templates