Template:Github url

From FlightGear wiki
Revision as of 12:58, 17 November 2015 by Red Leader (talk | contribs) (New template, as per FGW:VP#GitLab and GitHub templates.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

https://github.com/

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

Goal

This template will return the URL of directory in GitHub, and optionally a file in that directory.

Usage

{{github url|project|path|l=|r=}}

All parameters are optional.

project
The name of the project, which is comes between https://github.com/ and /blob/... in the URL. If empty, the link will point to https://github.com.
path
What follows after /blob/<branch>/ in the URL. Can be the path to a file or a directory. If empty, the link will point to the root of the project.
l
A line number. This could just be a single number, or, when linking to a range of lines, two line numbers separated by a slash (/), for example l=1/5.
r
A commit reference. Usually the SHA-1 commit ID (which can be abbreviated), but it can also be a tag or a branch name. If empty, the link will point to the master branch.

Examples

No parameters given

{{github url}}

https://github.com/

Project given

{{github url|ruby/ruby}}

https://github.com/ruby/ruby

Project and path given

{{github url|NikolaiVChr/flightgear-saab-ja-37-viggen|Aircraft/JA37/readme.txt}}

https://github.com/NikolaiVChr/flightgear-saab-ja-37-viggen/blob/master/Aircraft/JA37/readme.txt

Project, path and a commit reference given

{{github url|NikolaiVChr/flightgear-saab-ja-37-viggen|index.html|r=gh-pages}}

https://github.com/NikolaiVChr/flightgear-saab-ja-37-viggen/blob/gh-pages/index.html

{{github url|NikolaiVChr/flightgear-saab-ja-37-viggen|Aircraft/JA37|r=FG-v3.4}}

https://github.com/NikolaiVChr/flightgear-saab-ja-37-viggen/blob/FG-v3.4/Aircraft/JA37

{{github url|NikolaiVChr/flightgear-saab-ja-37-viggen|Aircraft/JA37/readme.txt|r=79282e8}}

https://github.com/NikolaiVChr/flightgear-saab-ja-37-viggen/blob/79282e8/Aircraft/JA37/readme.txt

{{github url|NikolaiVChr/flightgear-saab-ja-37-viggen|Aircraft/JA37/readme.txt|r=79282e899712784c4bb21c04cc7482eca3908f71}}

https://github.com/NikolaiVChr/flightgear-saab-ja-37-viggen/blob/79282e899712784c4bb21c04cc7482eca3908f71/Aircraft/JA37/readme.txt

Line parameter given

{{github url|NikolaiVChr/flightgear-saab-ja-37-viggen|Aircraft/JA37/Nasal/radar.nas|l=2}}

https://github.com/NikolaiVChr/flightgear-saab-ja-37-viggen/blob/master/Aircraft/JA37/Nasal/radar.nas#L2

Mulitple lines given

{{github url|NikolaiVChr/flightgear-saab-ja-37-viggen|Aircraft/JA37/Nasal/radar.nas|l=17/22}}

https://github.com/NikolaiVChr/flightgear-saab-ja-37-viggen/blob/master/Aircraft/JA37/Nasal/radar.nas#L17-L22

Usage in a wiki URL

[{{github url|NikolaiVChr/flightgear-saab-ja-37-viggen|Aircraft/JA37/changelog.txt}} See the JA 37's changelog]

See the JA 37's changelog

Related templates

Source link templates

Commit link templates

Other