Template:Github

From Linux Web Expert

example/file.php

Template documentation


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

This uses the GitHub mirror instead of 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:

  • diffusion link{{git file|file=index.php|text=diffusion 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

<templatedata> { "params": { "repo": { "description": { "en": "Full repository name (e.g. \"mediawiki\" or \"mediawiki-extensions-EventLogging\"). Must not include any \".git\" suffix.", "cs": "Celý název úložiště (např. \"mediawiki\" nebo \"mediawiki-extensions-EventLogging\"). Nesmí obsahovat žádnou příponu \".git\"." }, "type": "string", "default": "mediawiki", "label": { "en": "GitHub repository name", "cs": "Název úložiště GitHub" } }, "action": { "description": { "en": "A GitHub repo action. One of \"blob\", \"raw\", \"blame\", \"commits\", or \"tree\"", "cs": "Akce úložiště GitHub. Jedna z položek \"blob\", \"raw\", \"blame\", \"commits\" nebo \"tree\"" }, "type": "string", "default": "blob", "label": { "en": "GitHub repository action", "cs": "Akce úložiště GitHub" } }, "branch": { "type": "string", "default": "master", "label": { "en": "GitHub branch", "cs": "Pobočka GitHub" }, "description": { "en": "Represents the git branch of the repository to view", "cs": "Představuje git větev úložiště k zobrazení" }, "example": "REL1_34" }, "file": { "type": "string", "required": true, "label": { "en": "Absolute file path", "cs": "Absolutní cesta k souboru" }, "description": { "en": "Represents the full, absolute path to the file", "cs": "Představuje úplnou, absolutní cestu k souboru" } }, "line": { "type": "number", "label": { "en": "Line number", "cs": "Číslo řádku" }, "description": { "en": "Represents the line number to directly link to", "cs": "Představuje číslo řádku, na který se má přímo odkazovat" } }, "text": { "description": { "en": "Custom label for the link created by this template.", "cs": "Vlastní štítek pro odkaz vytvořený touto šablonou." }, "type": "string", "default": "The file path", "label": { "en": "Link label", "cs": "Štítek odkazu" } }, "owner": { "label": { "en": "GitHub owner name", "cs": "Jméno vlastníka GitHubu" }, "description": { "en": "The GitHub username of the user or organization that owns the repository", "cs": "Uživatelské jméno GitHubu uživatele nebo organizace, která vlastní úložiště" }, "type": "string", "default": "wikimedia" } }, "description": { "en": "A convenient way of linking to source code on GitHub.", "cs": "Pohodlný způsob propojení se zdrojovým kódem na GitHubu." }, "paramOrder": [ "owner", "repo", "action", "branch", "file", "line", "text" ], "format": "inline" } </templatedata>

See also