跳转到内容

模板:Github/doc

来自天灾之下:危险连接资料站

This template provides an alternative to {{Git file }} for linking to source code.

This uses the GitHub mirror instead of Gitiles or Diffusion the Gitblit server at git.wikimedia.org (WMF deprecated gitblit and git.wikimedia.org in 2015). Editors may find GitHub's interface more user-friendly, faster responding, visually appealing, or otherwise preferable. Compare:

  • gitiles link ← {{git file|file=index.php|text=gitiles link|line=39|branch=REL1_25}}
  • github link ← {{github|index.php|github link|line=39|branch=REL1_25}}

Usage

Basic

 {{github |file=composer.json }}
 {{github |repo=mediawiki-extensions-Flow |file=composer.json }}

produces:

composer.json
composer.json

Action

{{github |repo=mediawiki-extensions-EventLogging 
 |file=server/bin/eventlogging-devserver
 |text=development server | action=raw }}

produces:

development server

Line number

{{github |file=tests/phpunit/includes/MessageTest.php |line=152 }}

produces:

tests/phpunit/includes/MessageTest.php

A convenient way of linking to source code on GitHub.

模板参数

此模板首选参数不换行的行内格式。

参数描述类型状态
GitHub owner nameowner

The GitHub username of the user or organization that owns the repository

默认值
wikimedia
字符串可选
GitHub repository namerepo

Full repository name (e.g. "mediawiki" or "mediawiki-extensions-EventLogging"). Must not include any ".git" suffix.

默认值
mediawiki
字符串可选
GitHub repository actionaction

A GitHub repo action. One of "blob", "raw", "blame", "commits", or "tree"

默认值
blob
字符串可选
GitHub branchbranch

Represents the git branch of the repository to view

默认值
master
示例值
REL1_34
字符串可选
Caminho absoluto do ficheirofile

Represents the full, absolute path to the file

字符串必需
Line numberline

Represents the line number to directly link to

数字可选
Link labeltext

Custom label for the link created by this template.

默认值
The file path
字符串可选

See also