Template:Repo link/doc commit: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
(Removal of the 'Usage' section title, as this is provided by the {{repo link/doc usage}} template.)
(Addition of the relevant {{repo link/doc design *}} templates and {{repo link/doc plain text}} for more extensive documentation, and introduction of the 'git' and 'svn' parameter for finer control.)
Line 15: Line 15:
| pos_text    = 2
| pos_text    = 2
| sf          = 1
| sf          = 1
| svn        = 1
| svn        = {{{svn|1}}}
| git        = 1
| git        = {{{git|1}}}
| break      = 0
| break      = 0
}}
}}
{{repo link/doc design intro}}
{{repo link/doc design overview}}
{{repo link/doc design sourceforge|user=0|git={{{git|1}}}|svn={{{svn|1}}}}}
{{repo link/doc plain text}}


== Examples ==
== Examples ==

Revision as of 18:56, 6 March 2016

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

Goal

This template can be used when linking to summaries of commits for the MISSING git repository at SourceForge. It is a subtemplate of the master {{repo link}} template designed to link to specific version control commits.

Usage

{{MISSING commit
| commit
| text       =
}}

The parameters are:

Parameter Description Abbreviated
parameter
Numbered
parameter
Status
commit The commit identifier (git hash or svn revision number). This defaults to HEAD. 1 mandatory
text Text to display as the link label. t 2 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 or svn, 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> for 'type=svn'

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

<protocol>://[<login>@]svn.code.sf.net/p/<proj>/<repo>/<branch>[/<path>][@<commit>]

SourceForge <URL> for 'type=svn web'

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

<protocol>://sourceforge.net/p/<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/p/<proj>/<repo>/<commit|HEAD>/

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>

SourceForge URL <TEXT> for 'type=svn' and 'type=svn web'

The link text <TEXT>, if the full parameter is not set, will be:

<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:

<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/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

Auto-generated text

{{MISSING commit | MISSING}}

Template:MISSING commit

User supplied text

MISSING {{MISSING commit | MISSING | text = MISSING}}.

MISSING Template:MISSING commit .

Parameter alias

MISSING {{MISSING commit | MISSING | t = MISSING}}.

MISSING Template:MISSING commit .

Numbered parameters

MISSING {{MISSING commit | MISSING | MISSING}}.

MISSING Template:MISSING commit .

Related templates