Template:Repo link: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
m (Add stub for GitLab)
(+ two-letter repo names; +-error message; +templ: obr, cbr; + For now commented GitLab doc)
Line 1: Line 1:
{{#switch: {{{site|}}}
{{#switch: {{{site|}}}
|gito
| g
|gitorious = [https://{{#if: {{{subdom|}}} | {{{subdom}}}. }}gitorious.org/<!--
| gito
| gitorious = [https://{{#if: {{{subdom|}}} | {{{subdom}}}. }}gitorious.org/<!--
-->{{{proj|fg/fgdata}}}/{{{view|source}}}/{{{brrev|master}}}:{{{path|}}}<!--
-->{{{proj|fg/fgdata}}}/{{{view|source}}}/{{{brrev|master}}}:{{{path|}}}<!--
-->{{#if: {{{lines|}}} |&#35;L{{{lines}}} }}<!--
-->{{#if: {{{lines|}}} |&#35;L{{{lines}}} }}<!--
--> {{#if: {{{text|}}} | {{{text}}} | {{#if: {{{pre|}}} | {{{pre}}} | {{{proj|fg/fgdata}}} }}/{{#if: {{{path|}}} | {{{path}}} |{{{brrev|master}}}}} }}]
--> {{#if: {{{text|}}} | {{{text}}} | {{#if: {{{pre|}}} | {{{pre}}} | {{{proj|fg/fgdata}}} }}/{{#if: {{{path|}}} | {{{path}}} |{{{brrev|master}}}}} }}]
|gith
| gh
|github = [https://{{#ifeq: {{{view|tree}}} | raw | raw.githubusercontent | github }}.com/<!--
| gith
| github = [https://{{#ifeq: {{{view|tree}}} | raw | raw.githubusercontent | github }}.com/<!--
-->{{{proj|}}}/<!--
-->{{{proj|}}}/<!--
-->{{#ifeq: {{{view|tree}}} | raw | | {{{view|tree}}}/ }}<!--
-->{{#ifeq: {{{view|tree}}} | raw | | {{{view|tree}}}/ }}<!--
Line 12: Line 14:
-->{{#if: {{{lines|}}} | &#35;L{{{lines}}} }}<!--
-->{{#if: {{{lines|}}} | &#35;L{{{lines}}} }}<!--
--> {{#if: {{{text|}}} | {{{text}}} | {{#if: {{{pre|}}} | {{{pre}}} | {{{proj|}}} }}/{{#if: {{{path|}}} | {{{path}}} | {{{brrev|master}}}}} }}]
--> {{#if: {{{text|}}} | {{{text}}} | {{#if: {{{pre|}}} | {{{pre}}} | {{{proj|}}} }}/{{#if: {{{path|}}} | {{{path}}} | {{{brrev|master}}}}} }}]
|gitl
| gl
|gitlab = [https://about.gitlab.com/ GitLab.com]
| gitl
|sf
| gitlab = [https://about.gitlab.com/ GitLab.com]
|svn
| sf
|sourceforge = [http://sourceforge.net/p/<!--
| svn
| sourceforge = [http://sourceforge.net/p/<!--
-->{{{proj|flightgear/fgaddon}}}/{{{rev|HEAD}}}/tree/{{{branch|trunk}}}/{{{path|Aircraft}}}<!--  
-->{{{proj|flightgear/fgaddon}}}/{{{rev|HEAD}}}/tree/{{{branch|trunk}}}/{{{path|Aircraft}}}<!--  
-->{{#if: {{{lines|}}} | &#35;l{{{lines}}} }}<!--
-->{{#if: {{{lines|}}} | &#35;l{{{lines}}} }}<!--
--> {{#if: {{{text|}}} | {{{text}}} | {{#if: {{{pre|}}} | {{{pre}}} | {{{proj|flightgear/fgaddon}}}/{{{branch|{{{rev|HEAD}}}}}}}}/{{#if: {{{path|}}} | {{{path}}} | Aircraft }} }}]
--> {{#if: {{{text|}}} | {{{text}}} | {{#if: {{{pre|}}} | {{{pre}}} | {{{proj|flightgear/fgaddon}}}/{{{branch|{{{rev|HEAD}}}}}}}}/{{#if: {{{path|}}} | {{{path}}} | Aircraft }} }}]
|#default = <big style="color: red">{{tl|Repo link}} does not recognize site name.</big>
| #default = <big style="color: red">{{tl|Repo link}}: Invalid or missing site</big>
}}<noinclude>{{Informative template|1=
}}<noinclude>{{Informative template|1=
__NOTOC__
__NOTOC__
Line 31: Line 34:


== Usage ==
== Usage ==
  <nowiki>{{</nowiki>'''repo link
  {{obr}}'''repo link
  {{!}} site  =
  {{!}} site  =
  {{!}} ''subdom'' =
  {{!}} ''subdom'' =
Line 45: Line 48:
  {{!}} ''text''  =  
  {{!}} ''text''  =  
  {{!}} ''pre''    =
  {{!}} ''pre''    =
  <nowiki>}}</nowiki>
  {{cbr}}


All parameters except '''site''' are optional.
All parameters except '''site''' are optional.


; site: Points the template to a repository host:
; site: Points the template to a repository host:
:* For [https://gitorious.org/ Gitorious] use either '''gito''' or '''gitorious'''
:* For [https://gitorious.org/ Gitorious] use either '''g''', '''gito''' or '''gitorious'''
:* For [https://github.com/ GitHub] use either '''gith''' or '''github'''
:* For [https://github.com/ GitHub] use either '''gh''', '''gith''' or '''github'''
<!-- :* For [https://about.gitlab.com/ GitLab] use either '''gl''', '''gitl''' or '''gitlab''' -->
:* For [http://sourceforge.net/ SourceForge] use either '''svn''', '''sf''' or '''sourceforge'''
:* For [http://sourceforge.net/ SourceForge] use either '''svn''', '''sf''' or '''sourceforge'''


Line 86: Line 90:
== Examples ==
== Examples ==
=== Gitorious example ===
=== Gitorious example ===
  <nowiki>{{repo link
  {{obr}}repo link
| site  = gito
{{!}} site  = gito
| proj  = fg/hoorays-fgdata
{{!}} proj  = fg/hoorays-fgdata
| view  = source
{{!}} view  = source
| brrev  = topics/scriptable-ai-submodule
{{!}} brrev  = topics/scriptable-ai-submodule
| path  = Nasal/ai/ai.nas
{{!}} path  = Nasal/ai/ai.nas
| lines  = 1-2
{{!}} lines  = 1-2
| text  = Scripted AI Objects repo
{{!}} text  = Scripted AI Objects repo
}}</nowiki>
{{cbr}}


{{repo link
{{repo link
Line 107: Line 111:


=== Subdomain example ===
=== Subdomain example ===
  <nowiki>{{repo link
  {{obr}}repo link
| site  = gito
{{!}} site  = gito
| subdom = qt
{{!}} subdom = qt
| proj  = qt/qt
{{!}} proj  = qt/qt
| view  = source
{{!}} view  = source
| brrev  = 4.7
{{!}} brrev  = 4.7
| path  = examples/README
{{!}} path  = examples/README
| lines  = 1
{{!}} lines  = 1
}}</nowiki>
{{cbr}}


{{repo link
{{repo link
Line 128: Line 132:


=== GitHub example ===
=== GitHub example ===
  <nowiki>{{repo link
  {{obr}}repo link
| site  = gith
{{!}} site  = gith
| proj  = bhugh/Bombable
{{!}} proj  = bhugh/Bombable
| path  = examples/README
{{!}} path  = examples/README
| lines  = 30
{{!}} lines  = 30
| path  = Aircraft/A-10-Bombable/A-10-Bombable-set.xml
{{!}} path  = Aircraft/A-10-Bombable/A-10-Bombable-set.xml
| pre    = $FG_ROOT
{{!}} pre    = $FG_ROOT
}}</nowiki>
{{cbr}}


{{repo link
{{repo link
Line 147: Line 151:


=== SourceForge example ===
=== SourceForge example ===
  <nowiki>{{repo link
  {{obr}}repo link
| site = sf
{{!}} site = sf
| rev = 280
{{!}} rev = 280
| branch = branches/release-3.4.0
{{!}} branch = branches/release-3.4.0
| text = FG 3.4 add-on aircraft
{{!}} text = FG 3.4 add-on aircraft
}}</nowiki>
{{cbr}}


{{repo link
{{repo link

Revision as of 15:38, 5 April 2015

{{Repo link}}: Invalid or missing site

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

Goal

This template is used when linking to repositories.

This template unifies and aims to replace the two previous link templates used when linking to repositories on different hosts.

Note This template will add an external link. You will therefore have to answer a security question before your edit is saved.

Usage

{{repo link
| site   =
| subdom =
| proj   =
| view   =
| brrev  =

| branch =
| rev    =

| path   =
| lines  = 
| text   = 
| pre    =
}}

All parameters except site are optional.

site
Points the template to a repository host:
  • For Gitorious use either g, gito or gitorious
  • For GitHub use either gh, gith or github
  • For SourceForge use either svn, sf or sourceforge
subdom
Subdomain, applicable only to Gitorious links. See example below for usage.
proj
Project name, for example fg/fgdata
view
View to display:
  • For Gitorious use either source, blame, history or raw
  • For GitHub use either blob, blame, commits or raw
Note Not used for SourceForge
brrev
Branch, tag or commit
Note Only used for Gitorious and GitHub
branch
Branch
Note Only used for Sourceforge
rev
Revision number
Note Only used for Sourceforge
path
Path to desired file.
lines
Line number(s) to go to in a file.
  • For Gitorious and GitHub either use:
    • A single line number, for example 2
    • Two line numbers separated with a hyphen (-), for example 3-10
  • For SourceForge: Only use of a single line number is supported
pre
Prefix to a link label.
text
Text to display as the link label. Overrides pre.

Examples

Gitorious example

{{repo link
| site   = gito
| proj   = fg/hoorays-fgdata
| view   = source
| brrev  = topics/scriptable-ai-submodule
| path   = Nasal/ai/ai.nas
| lines  = 1-2
| text   = Scripted AI Objects repo
}}

Scripted AI Objects repo

Subdomain example

{{repo link
| site   = gito
| subdom = qt
| proj   = qt/qt
| view   = source
| brrev  = 4.7
| path   = examples/README
| lines  = 1
}}

qt/qt/examples/README

GitHub example

{{repo link
| site   = gith
| proj   = bhugh/Bombable
| path   = examples/README
| lines  = 30
| path   = Aircraft/A-10-Bombable/A-10-Bombable-set.xml
| pre    = $FG_ROOT
}}

$FG_ROOT/Aircraft/A-10-Bombable/A-10-Bombable-set.xml

SourceForge example

{{repo link
| site = sf
| rev = 280
| branch = branches/release-3.4.0
| text = FG 3.4 add-on aircraft
}}

FG 3.4 add-on aircraft

Related

See also