Difference between revisions of "Template:Website source"
(Creation of the {{website sourcel}} template by copying {{relax source}}.) |
(Added the links the examples should create and improved the formatting.) |
||
Line 26: | Line 26: | ||
| examples = | | examples = | ||
=== No parameters === | === No parameters === | ||
− | {{obr}}website source{{cbr}} | + | This is a link to https://sourceforge.net/p/nmr-relax/website/ci/master/tree/. |
− | {{website source}} | + | |
+ | {{obr}}website source{{cbr}}. | ||
+ | |||
+ | {{website source}}. | ||
=== The repository === | === The repository === | ||
+ | This is a link to https://sourceforge.net/p/nmr-relax/website/ci/master/tree/. | ||
+ | |||
{{obr}}website source | {{obr}}website source | ||
{{!}} text = The website source repository | {{!}} text = The website source repository | ||
− | {{cbr}} | + | {{cbr}}. |
{{website source | {{website source | ||
| text = The website source repository | | text = The website source repository | ||
− | }} | + | }}. |
=== File === | === File === | ||
+ | This is a link to https://sourceforge.net/p/nmr-relax/website/ci/master/tree/features.html. | ||
+ | |||
{{obr}}website source | {{obr}}website source | ||
{{!}} path = features.html | {{!}} path = features.html | ||
− | {{cbr}} | + | {{cbr}}. |
{{website source | {{website source | ||
| path = features.html | | path = features.html | ||
− | }} | + | }}. |
=== File and a branch === | === File and a branch === | ||
+ | This is a link to https://sourceforge.net/p/nmr-relax/website/ci/sf/tree/features.shtml. | ||
+ | |||
{{obr}}website source | {{obr}}website source | ||
{{!}} path = features.shtml | {{!}} path = features.shtml | ||
{{!}} branch = sf | {{!}} branch = sf | ||
− | {{cbr}} | + | {{cbr}}. |
{{website source | {{website source | ||
| path = features.shtml | | path = features.shtml | ||
| branch = sf | | branch = sf | ||
− | }} | + | }}. |
=== File and a commit === | === File and a commit === | ||
+ | This is a link to https://sourceforge.net/p/nmr-relax/website/ci/831561/tree/relax.css. | ||
+ | |||
{{obr}}website source | {{obr}}website source | ||
{{!}} path = relax.css | {{!}} path = relax.css | ||
{{!}} commit = 831561 | {{!}} commit = 831561 | ||
− | {{cbr}} | + | {{cbr}}. |
{{website source | {{website source | ||
| path = relax.css | | path = relax.css | ||
| commit = 831561 | | commit = 831561 | ||
− | }} | + | }}. |
{{obr}}website source | {{obr}}website source | ||
{{!}} path = relax.css | {{!}} path = relax.css | ||
{{!}} commit = 831561502ee086738d05419029563749d25e6593 | {{!}} commit = 831561502ee086738d05419029563749d25e6593 | ||
− | {{cbr}} | + | {{cbr}}. |
{{website source | {{website source | ||
| path = relax.css | | path = relax.css | ||
| commit = 831561502ee086738d05419029563749d25e6593 | | commit = 831561502ee086738d05419029563749d25e6593 | ||
− | }} | + | }}. |
=== Commit === | === Commit === | ||
+ | {{note|For a simpler interface for this specific example, see {{tl|website commit}}.}} | ||
+ | This is a link to https://sourceforge.net/p/nmr-relax/website/ci/831561/. | ||
+ | |||
{{obr}}website source | {{obr}}website source | ||
{{!}} commit = 831561 | {{!}} commit = 831561 | ||
{{!}} view = commit | {{!}} view = commit | ||
− | {{cbr}} | + | {{cbr}}. |
{{website source | {{website source | ||
| commit = 831561 | | commit = 831561 | ||
| view = commit | | view = commit | ||
− | }} | + | }}. |
=== File and line number === | === File and line number === | ||
+ | This is a link to https://sourceforge.net/p/nmr-relax/website/ci/master/tree/download.html#l27. | ||
+ | |||
{{obr}}website source | {{obr}}website source | ||
{{!}} path = download.html | {{!}} path = download.html | ||
{{!}} line = 27 | {{!}} line = 27 | ||
− | {{cbr}} | + | {{cbr}}. |
{{website source | {{website source | ||
| path = download.html | | path = download.html | ||
| line = 27 | | line = 27 | ||
− | }} | + | }}. |
=== File, line number, and commit === | === File, line number, and commit === | ||
+ | This is a link to https://sourceforge.net/p/nmr-relax/website/ci/f1d540377809fc4bbcd9b8163781576a17e48a0f/tree/download.html#l65. | ||
+ | |||
{{obr}}website source | {{obr}}website source | ||
{{!}} path = download.html | {{!}} path = download.html | ||
{{!}} commit = f1d540377809fc4bbcd9b8163781576a17e48a0f | {{!}} commit = f1d540377809fc4bbcd9b8163781576a17e48a0f | ||
{{!}} line = 65 | {{!}} line = 65 | ||
− | {{cbr}} | + | {{cbr}}. |
{{website source | {{website source | ||
Line 113: | Line 131: | ||
| commit = f1d540377809fc4bbcd9b8163781576a17e48a0f | | commit = f1d540377809fc4bbcd9b8163781576a17e48a0f | ||
| line = 65 | | line = 65 | ||
− | }} | + | }}. |
=== Custom label given === | === Custom label given === | ||
+ | This is a link to https://sourceforge.net/p/nmr-relax/website/ci/master/tree/download.html. | ||
+ | |||
{{obr}}website source | {{obr}}website source | ||
{{!}} path = download.html | {{!}} path = download.html | ||
{{!}} text = The relax download webpage | {{!}} text = The relax download webpage | ||
− | {{cbr}} | + | {{cbr}}. |
{{website source | {{website source | ||
| path = download.html | | path = download.html | ||
| text = The relax download webpage | | text = The relax download webpage | ||
− | }} | + | }}. |
=== Prefix of $WEBSITE_SRC === | === Prefix of $WEBSITE_SRC === | ||
+ | This is a link to https://sourceforge.net/p/nmr-relax/website/ci/master/tree/download.html. | ||
+ | |||
{{obr}}website source | {{obr}}website source | ||
{{!}} path = download.html | {{!}} path = download.html | ||
{{!}} pre = $WEBSITE_SRC | {{!}} pre = $WEBSITE_SRC | ||
− | {{cbr}} | + | {{cbr}}. |
{{website source | {{website source | ||
| path = download.html | | path = download.html | ||
| pre = $WEBSITE_SRC | | pre = $WEBSITE_SRC | ||
− | }} | + | }}. |
=== Full path === | === Full path === | ||
+ | This is a link to https://sourceforge.net/p/nmr-relax/website/ci/f1d540377809fc4bbcd9b8163781576a17e48a0f/tree/download.html#l65. | ||
+ | |||
{{obr}}website source | {{obr}}website source | ||
{{!}} path = download.html | {{!}} path = download.html | ||
Line 143: | Line 167: | ||
{{!}} line = 65 | {{!}} line = 65 | ||
{{!}} full = 1 | {{!}} full = 1 | ||
− | {{cbr}} | + | {{cbr}}. |
{{website source | {{website source | ||
Line 150: | Line 174: | ||
| line = 65 | | line = 65 | ||
| full = 1 | | full = 1 | ||
− | }} | + | }}. |
=== Git clone === | === Git clone === | ||
+ | {{note|For a simpler interface for this specific example, see {{tl|website clone}}.}} | ||
This is for <code><nowiki>git clone git://git.code.sf.net/p/nmr-relax/website</nowiki></code>. | This is for <code><nowiki>git clone git://git.code.sf.net/p/nmr-relax/website</nowiki></code>. | ||
Line 170: | Line 195: | ||
=== Aliased parameters === | === Aliased parameters === | ||
− | This is | + | This is a link to https://sourceforge.net/p/nmr-relax/website/ci/gh-pages/tree/download.html#l68. |
{{obr}}website source | {{obr}}website source | ||
{{!}} f = download.html | {{!}} f = download.html | ||
{{!}} b = gh-pages | {{!}} b = gh-pages | ||
+ | {{!}} l = 68 | ||
{{!}} full = 1 | {{!}} full = 1 | ||
− | {{cbr}} | + | {{cbr}}. |
{{website source | {{website source | ||
| f = download.html | | f = download.html | ||
| b = gh-pages | | b = gh-pages | ||
+ | | l = 68 | ||
| full = 1 | | full = 1 | ||
− | }} | + | }}. |
=== Numbered parameters === | === Numbered parameters === | ||
− | This is | + | This is a link to https://sourceforge.net/p/nmr-relax/website/ci/gh-pages/tree/download.html. |
− | {{obr}}website source {{!}} download.html {{!}} b = gh-pages {{!}} full = 1 {{cbr}} | + | {{obr}}website source {{!}} download.html {{!}} b = gh-pages {{!}} full = 1 {{cbr}}. |
− | {{website source | download.html | b = gh-pages | full = 1 }} | + | {{website source | download.html | b = gh-pages | full = 1 }}. |
}}</noinclude> | }}</noinclude> |
Revision as of 07:44, 27 October 2017
Template documentation
Goal
This template is for creating links or URLs for the relax website git version control repository. It is a subtemplate of the master {{repo link}} template designed to be specific for the relax website repository.
Usage
{{MISSING source | cmd = | opt = | protocol = | login = | type = | branch = | tag = | commit = | path = | line = | post = | view = | text = | pre = | simplepath = | full = }}
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 | |
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.
|
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 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://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
No parameters
This is a link to https://sourceforge.net/p/nmr-relax/website/ci/master/tree/.
{{website source}}.
The repository
This is a link to https://sourceforge.net/p/nmr-relax/website/ci/master/tree/.
{{website source | text = The website source repository }}.
The website source repository.
File
This is a link to https://sourceforge.net/p/nmr-relax/website/ci/master/tree/features.html.
{{website source | path = features.html }}.
nmr-relax/website/master/features.html.
File and a branch
This is a link to https://sourceforge.net/p/nmr-relax/website/ci/sf/tree/features.shtml.
{{website source | path = features.shtml | branch = sf }}.
nmr-relax/website/sf/features.shtml.
File and a commit
This is a link to https://sourceforge.net/p/nmr-relax/website/ci/831561/tree/relax.css.
{{website source | path = relax.css | commit = 831561 }}.
nmr-relax/website/831561/relax.css.
{{website source | path = relax.css | commit = 831561502ee086738d05419029563749d25e6593 }}.
nmr-relax/website/831561502ee086738d05419029563749d25e6593/relax.css.
Commit
Note For a simpler interface for this specific example, see {{website commit}}. |
This is a link to https://sourceforge.net/p/nmr-relax/website/ci/831561/.
{{website source | commit = 831561 | view = commit }}.
nmr-relax/website/831561 commit view.
File and line number
This is a link to https://sourceforge.net/p/nmr-relax/website/ci/master/tree/download.html#l27.
{{website source | path = download.html | line = 27 }}.
nmr-relax/website/master/download.html#l27.
File, line number, and commit
This is a link to https://sourceforge.net/p/nmr-relax/website/ci/f1d540377809fc4bbcd9b8163781576a17e48a0f/tree/download.html#l65.
{{website source | path = download.html | commit = f1d540377809fc4bbcd9b8163781576a17e48a0f | line = 65 }}.
nmr-relax/website/f1d540377809fc4bbcd9b8163781576a17e48a0f/download.html#l65.
Custom label given
This is a link to https://sourceforge.net/p/nmr-relax/website/ci/master/tree/download.html.
{{website source | path = download.html | text = The relax download webpage }}.
Prefix of $WEBSITE_SRC
This is a link to https://sourceforge.net/p/nmr-relax/website/ci/master/tree/download.html.
{{website source | path = download.html | pre = $WEBSITE_SRC }}.
Full path
This is a link to https://sourceforge.net/p/nmr-relax/website/ci/f1d540377809fc4bbcd9b8163781576a17e48a0f/tree/download.html#l65.
{{website source | path = download.html | commit = f1d540377809fc4bbcd9b8163781576a17e48a0f | line = 65 | full = 1 }}.
Git clone
Note For a simpler interface for this specific example, see {{website clone}}. |
This is for git clone git://git.code.sf.net/p/nmr-relax/website
.
{{#tag:code|{{#tag:nowiki|{{website source | cmd = git clone | protocol = git | type = git | full = 1 }}}}}}.
git clone git://git.code.sf.net/p/nmr-relax/website/
.
Aliased parameters
This is a link to https://sourceforge.net/p/nmr-relax/website/ci/gh-pages/tree/download.html#l68.
{{website source | f = download.html | b = gh-pages | l = 68 | full = 1 }}.
https://sourceforge.net/p/nmr-relax/website/ci/gh-pages/tree/download.html#l68.
Numbered parameters
This is a link to https://sourceforge.net/p/nmr-relax/website/ci/gh-pages/tree/download.html.
{{website source | download.html | b = gh-pages | full = 1 }}.
https://sourceforge.net/p/nmr-relax/website/ci/gh-pages/tree/download.html.
Related templates
|