Changes

2,628 bytes added ,  01:52, 27 August 2015
update now {{git file}} uses diffusion, markup
{{Documentation subpage}}
<!-- Categories go at the bottom of this page and interwikis go in Wikidata. -->

This template provides an alternative to {{tl|git file}} for linking to source code.

This uses the [[GitHub]] mirror instead of [[phab:diffusion|Diffusion]] <del>the Gitblit server at git.wikimedia.org</del> (WMF is [[phab:tag/gitblit-deprecate/ |deprecating gitblit]] and git.wikimedia.org in 2015). Editors may find GitHub's interface more user-friendly, faster responding, visually appealing, or otherwise preferable. Compare: <!-- set branch so that line number makes sense -->
* {{git file|file=index.php|text=diffusion link|line=39|branch=REL1_25}} ← <code><nowiki>{{git file|file=index.php|text=diffusion link|line=39|branch=REL1_25}}</nowiki></code>
* {{github|index.php|github link|line=39|branch=REL1_25}} ← <code><nowiki>{{github|index.php|github link|line=39|branch=REL1_25}}</nowiki></code>

== Usage ==
'''Basic'''
<nowiki>{{github</nowiki> |file=''composer.json'' }}
<nowiki>{{github</nowiki> |repo=mediawiki-extensions-''Flow'' |file=''composer.json'' }}
produces:
:{{github|file=composer.json }}
:{{github|repo=mediawiki-extensions-Flow|file=composer.json }}

'''Action'''
<pre>
{{github |repo=mediawiki-extensions-EventLogging
|file=server/bin/eventlogging-devserver
|text=development server | action=raw }}
</pre>
produces:
:{{github|repo=mediawiki-extensions-EventLogging
|file=server/bin/eventlogging-devserver
|text=development server |action=raw}}

'''Line number'''
<pre>{{github |file=tests/phpunit/includes/MessageTest.php |line=152 }}</pre>
produces:
:{{github |file=tests/phpunit/includes/MessageTest.php |line=152 }}

<templatedata>
{
"params": {
"repo": {
"description": "Full repository name (e.g. \"mediawiki\" or \"mediawiki/extensions/EventLogging\"). Must not include any \".git\" suffix.",
"type": "string",
"default": "mediawiki"
},
"action": {
"description": "A GitHub repo action. One of \"blob\", \"raw\", \"blame\", \"commits\", or \"tree\"",
"type": "string",
"default": "blob"
},
"branch": {
"type": "string",
"default": "master"
},
"file": {
"type": "string",
"default": "",
"required": true
},
"line": {
"type": "number"
},
"text": {
"description": "Custom label for the link created by this template.",
"type": "string",
"default": "The file path"
}
},
"description": "A convenient way of linking to source code.",
"paramOrder": [
"repo",
"action",
"branch",
"file",
"line",
"text"
]
}
</templatedata>

== See also ==
* {{tl|Git file}}
* {{tl|Git}}
* {{tl|GithubDownload}}
Anonymous user