模板:Github
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:
Action
{{github |repo=mediawiki-extensions-EventLogging
|file=server/bin/eventlogging-devserver
|text=development server | action=raw }}
produces:
Line number
{{github |file=tests/phpunit/includes/MessageTest.php |line=152 }}
produces:
A convenient way of linking to source code on GitHub.
| 参数 | 描述 | 类型 | 状态 | |
|---|---|---|---|---|
| GitHub owner name | owner | The GitHub username of the user or organization that owns the repository
| 字符串 | 可选 |
| GitHub repository name | repo | Full repository name (e.g. "mediawiki" or "mediawiki-extensions-EventLogging"). Must not include any ".git" suffix.
| 字符串 | 可选 |
| GitHub repository action | action | A GitHub repo action. One of "blob", "raw", "blame", "commits", or "tree"
| 字符串 | 可选 |
| GitHub branch | branch | Represents the git branch of the repository to view
| 字符串 | 可选 |
| Caminho absoluto do ficheiro | file | Represents the full, absolute path to the file | 字符串 | 必需 |
| Line number | line | Represents the line number to directly link to | 数字 | 可选 |
| Link label | text | Custom label for the link created by this template.
| 字符串 | 可选 |
See also
- {{Git file}}
- {{Git}}
- {{GithubDownload}}