Template:Repo link/doc: Difference between revisions

Jump to navigation Jump to search
Switch to the {{repo link/doc design *}} set of templates for providing the design documentation.
(Changed the category to Category:Repository link templates.)
(Switch to the {{repo link/doc design *}} set of templates for providing the design documentation.)
Line 39: Line 39:
}}
}}


== Design ==
{{repo link/doc design intro}}
In this section, the following notation will be used:
{{repo link/doc design overview}}
; Angular brackets + lower case text <code><nowiki><xyz></nowiki></code>: Template parameters.
{{repo link/doc design sourceforge}}
; Angular brackets + upper case text <code><nowiki><XYZ></nowiki></code>: Template constructed text.
{{repo link/doc design github}}
; Square brackets <code><nowiki>[xyz]</nowiki></code>: Optional text, only added if the parameter is set.
{{repo link/doc design gitlab}}
; Or symbol <code>{{!}}</code>: The value on the left, if present, otherwise the value on the right of the symbol.
{{repo link/doc design gitorious}}
 
{{repo link/doc design generic}}
=== Overview ===
Independent of the '''site''' parameter, the general design is:
<nowiki><cmd> <opt> [<URL> <TEXT>] <post></nowiki>
 
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:
<nowiki><cmd> <opt> <URL> <post></nowiki>
 
The URL is constructed differently for each of the categories of the '''site''' parameter.
 
=== Site: SourceForge ===
==== Project vs. developer page ====
For a normal SourceForge project and a SourceForge developer page, the base URL is respectively constructed as:
<nowiki><protocol>://<DOMAIN>/p/<proj>/<repo>/</nowiki>
<nowiki><protocol>://<DOMAIN>/u/<user>/<repo>/</nowiki>
 
This will be abstracted as:
<nowiki><protocol>://<DOMAIN>/<u|p>/<user|proj>/<repo>/</nowiki>
 
For the '''git''' and '''svn''' values of the '''type''' parameter, a login is allowed:
<nowiki><protocol>://[<login>@]<DOMAIN>/<u|p>/<user|proj>/<repo>/</nowiki>
 
==== SourceForge <URL> for 'type=git' ====
For this parameter value, the complete <code><URL></code> value will be:
<nowiki><protocol>://[<login>@]git.code.sf.net/<u|p>/<user|proj>/<repo>/</nowiki>
 
==== SourceForge <URL> for 'type=git web' ====
For this parameter value, the <code><URL></code> value will be:
<nowiki><protocol>://sourceforge.net/<u|p>/<user|proj>/<repo>/ci/<commit|branch>/<VIEW>/<path>[#l<line>]</nowiki>
 
The <code><VIEW></code> value for different values of '''view''' is:
; tree:  <code>tree/</code>.
; log: <code>log/?path{{=}}</code>.
; commit: nothing.
 
If the parameter setting '''view=rss''' is used, a different <code><URL></code> value is produced:
<nowiki><protocol>://sourceforge.net/<u|p>/<user|proj>/<repo>/feed/</nowiki>
 
==== SourceForge <URL> for 'type=svn' ====
For this parameter value, the <code><URL></code> value will instead be:
<nowiki><protocol>://[<login>@]svn.code.sf.net/<u|p>/<user|proj>/<repo>/<branch>[/<path>][@<commit>]</nowiki>
 
==== SourceForge <URL> for 'type=svn web' ====
For this parameter value, the <code><URL></code> value will be:
<nowiki><protocol>://sourceforge.net/<u|p>/<user|proj>/<repo>/<commit|HEAD>/<VIEW>/<branch>[/<path>][#l<line>]</nowiki>
 
The <code><VIEW></code> value for different values of '''view''' is:
; tree:  <code>tree/</code>.
; log: <code>log/?path{{=}}</code>.
 
If the parameter setting '''view=commit''' is used, a truncated <URL> value is produced:
<nowiki><protocol>://sourceforge.net/<u|p>/<user|proj>/<repo>/<commit|HEAD>/</nowiki>
 
If the parameter setting '''view=rss''' is used, a different <URL> value is produced:
<nowiki><protocol>://sourceforge.net/<u|p>/<user|proj>/<repo>/feed/</nowiki>
 
==== SourceForge URL <TEXT> for 'type=git' and 'type=git web' ====
The link text <code><TEXT></code>, if the '''full''' parameter is not set, will be:
<nowiki><user|proj>/<repo>/<commit|branch>[/<path>][#l<line>] <DESC></nowiki>
 
If the '''simplepath''' parameter is set, this changes to:
<nowiki>[/<path>][#l<line>] <DESC></nowiki>
 
If the '''pre''' parameter is supplied, this changes to:
<nowiki><pre>[/<path>][#l<line>] <DESC></nowiki>
 
The RSS feed is a special case in that <code><TEXT></code> will be one of:
<nowiki><user|proj>/<repo> <DESC></nowiki>
<nowiki><pre> <DESC></nowiki>
 
The description <code><DESC></code> is dependent on the '''view''' parameter:
; tree: Nothing.
; log: <code>log view</code>.
; commit: <code>commit view</code>.
; rss: <code>RSS feed</code>.
 
The '''text''' parameter trumps all, and <code><TEXT></code> is simply:
<nowiki><text></nowiki>
 
==== SourceForge URL <TEXT> for 'type=svn' and 'type=svn web' ====
The link text <code><TEXT></code>, if the '''full''' parameter is not set, will be:
<nowiki><user|proj>/<repo>/<branch>[/<path>][#l<line>][@r<commit>] <DESC></nowiki>
 
If the '''simplepath''' parameter is set, this changes to:
<nowiki>[/<path>][#l<line>][@r<commit>] <DESC></nowiki>
 
If the '''pre''' parameter is supplied, this changes to:
<nowiki><pre>[/<path>][#l<line>][@r<commit>] <DESC></nowiki>
 
The RSS feed is a special case in that <code><TEXT></code> will be one of:
<nowiki><user|proj>/<repo> <DESC></nowiki>
<nowiki><pre> <DESC></nowiki>
 
The description <code><DESC></code> is dependent on the '''view''' parameter:
; tree: Nothing.
; log: <code>log view</code>.
; commit: <code>commit view</code>.
; rss: <code>RSS feed</code>.
 
The '''text''' parameter trumps all, and <code><TEXT></code> is simply:
<nowiki><text></nowiki>
 
=== Site: GitHub ===
The base URL for GitHub repositories is:
<nowiki><protocol>://github.com/<user|proj>/<repo></nowiki>
 
==== GitHub <URL> for 'type=git' ====
For this parameter value, the complete <code><URL></code> value will be:
<nowiki><protocol>://github.com/<user|proj>/<repo>.git</nowiki>
 
==== GitHub <URL> for 'type=git web' ====
For this parameter value, the <code><URL></code> value will be:
<nowiki><protocol>://github.com/<user|proj>/<repo>/<view>/<commit|branch>[/<path>][#L<line>]</nowiki>
 
==== GitHub <URL> for 'type=zip' ====
For this parameter value, the zip file URL will be:
<nowiki><protocol>://github.com/<proj>/<repo>/archive/<commit|tag|branch>.zip</nowiki>
 
If neither a commit, branch, nor tag is specified, the URL will default to:
<nowiki><protocol>://github.com/<proj>/<repo>/archive/master.zip</nowiki>
 
==== GitHub URL <TEXT> for 'type=git' and 'type=git web' ====
The link text <code><TEXT></code>, if the '''full''' parameter is not set, will be:
<nowiki>github/<user|proj>/<repo>/<commit|branch|HEAD>[/<path>][#L<line>]</nowiki>
 
If the '''simplepath''' parameter is set, this changes to:
<nowiki>[/<path>][#L<line>]</nowiki>
 
If the '''pre''' parameter is supplied, this changes to:
<nowiki><pre>[/<path>][#L<line>]</nowiki>
 
The '''text''' parameter trumps all, and <code><TEXT></code> is simply:
<nowiki><text></nowiki>
 
==== GitHub URL <TEXT> for 'type=zip' ====
The link text <code><TEXT></code>, if the '''full''' parameter is not set, will be:
<nowiki>github/<user|proj>/<repo>/[<commit|tag|branch>] zip file</nowiki>
 
If the '''simplepath''' parameter is set, this changes to:
<nowiki> zip file</nowiki>
 
If the '''pre''' parameter is supplied, this changes to:
<nowiki><pre> zip file</nowiki>
 
The '''text''' parameter trumps all, and <code><TEXT></code> is simply:
<nowiki><text></nowiki>
 
=== Site: GitLab ===
The base URL for GitLab repositories is:
<nowiki><protocol>://gitlab.com/<proj>[/<repo>]</nowiki>
 
==== GitLab <URL> for 'type=git' ====
For this parameter value, the complete <code><URL></code> value will be:
<nowiki><protocol>://gitlab.com/<proj>[/<repo>].git</nowiki>
 
==== 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:
<nowiki><protocol>://gitlab.com/<proj>/<repo>/repository/archive.zip</nowiki>
 
If a branch, tag, or commit is specified, this will be added as a query:
<nowiki><protocol>://gitlab.com/<proj>/<repo>/repository/archive.zip[?ref=<commit|tag|branch>]</nowiki>
 
==== GitLab URL <TEXT> ====
This is not implemented yet.  Please add new examples to allow this template to be extended.
 
=== Site: Gitorious ===
The Gitorious URLs are predominantly query rather than path based.  And only the <code>https://</code> protocol is supported.  The base URL constructed by this template is:
<nowiki><protocol>://gitorious.org/<proj>/<repo></nowiki>
 
==== Gitorious <URL> for 'type=git' ====
For this parameter value, the complete <code><URL></code> value will be:
<nowiki><protocol>://gitorious.org/<proj>/<repo>.git</nowiki>
 
==== Gitorious <URL> for 'type=git web' ====
As the current archival system is based on queries &mdash; the text after the <code>?</code> character &mdash; absolutely any random path after the <code>gitorious.org/</code> domain name can be used.  But, for aesthetics, the project and repository name will be appended by this template.  The <code><URL></code> will be:
<nowiki><protocol>://gitorious.org/<proj>/<repo>?<QUERY>[#l<line>]</nowiki>
 
The <code><QUERY></code> string consists of parts for the project and repository (<code>p=</code>), the type of view (<code>a=</code>), the path (<code>f=</code>), and the commit, branch or tag (<code>h=</code> or <code>hb=</code>, depending on the view).
The <code><URL></code> fragment for the project and repository is constructed as:
<nowiki><protocol>://gitorious.org/<proj>/<repo>?p=<proj>:<repo>.git</nowiki>
 
The <code><URL></code> fragment for the view is constructed as:
<nowiki><protocol>://gitorious.org/<proj>/<repo>?a=<VIEW></nowiki>
 
Where <code><VIEW></code> is the value of the '''view''' parameter, if supplied, with the value of '''raw''' translated to <code>blob_plain</code>.  If not supplied, the value of <code>blob</code> is used if '''path''' is given, <code>commit</code> if '''commit''' is given, or <code>summary</code> otherwise.
The <code><URL></code> fragment for the path is constructed as:
<nowiki><protocol>://gitorious.org/<proj>/<repo>?f=<path></nowiki>
 
If the '''view''' parameter is set to one of '''blob''', '''raw''', or '''tree''', the <code><URL></code> fragment for the commit, branch or tag is constructed as:
<nowiki><protocol>://gitorious.org/<proj>/<repo>[?hb=<commit>|refs/heads/<branch>]</nowiki>
 
Otherwise it will be:
<nowiki><protocol>://gitorious.org/<proj>/<repo>[?h=<commit>|refs/heads/<branch>]</nowiki>
 
In summary, the full web URL will be:
<nowiki><protocol>://gitorious.org/<proj>/<repo>?p=<proj>:<repo>.git;a=<VIEW>[;f=<path>][;<h|hb>=<commit>|refs/heads/<branch>][#l<line>]</nowiki>
 
==== Gitorious URL <TEXT> ====
The link text <code><TEXT></code>, if the '''full''' parameter is not set, will be:
<nowiki><proj>/<repo>/<commit|branch|HEAD>[/<path>][#l<line>]</nowiki>
 
If the '''simplepath''' parameter is set, this changes to:
<nowiki>[/<path>][#l<line>]</nowiki>
 
If the '''pre''' parameter is supplied, this changes to:
<nowiki><pre>[/<path>][#l<line>]</nowiki>
 
The '''text''' parameter trumps all, and <code><TEXT></code> is simply:
<nowiki><text></nowiki>
 
=== Site: Generic ===
If the '''site''' parameter does not match one of the know open source infrastructures, then an attempt will be made to create a generic repository link.  The base URL for generic repositories is:
<nowiki><protocol>://[<login>@]<site>/<user|proj>[/<repo>]</nowiki>
 
==== Generic repository <URL> for 'type=git'====
For this parameter value, the complete <code><URL></code> value will be the base URL.
 
==== Generic repository <URL> for 'type=git web' ====
This is not implemented yet.  Please add new examples to allow this template to be extended.
 
==== Generic repository <URL> for 'type=svn' ====
For this parameter value, the complete <code><URL></code> value will be:
<nowiki><protocol>://[<login>@]<site>/<user|proj>[/<repo>]/<branch></nowiki>
 
The value of '''branch''' defaults to <code>trunk</code>.
 
==== Generic repository <URL> for 'type=svn web' ====
This is not implemented yet.  Please add new examples to allow this template to be extended.
 
==== Generic repository URL <TEXT> ====
This is not implemented yet.  Please add new examples to allow this template to be extended.


== Plain text ==
== Plain text ==

Navigation menu