Template:Git file

From Linux Web Expert

[[git:mediawiki/core/+/HEAD/|]]

Template documentation


Usage

<templatedata> { "params": { "project": { "label": { "en": "Repository", "cs": "Úložiště", "tr": "Depo" }, "description": { "en": "Which Git repository the file is in.", "cs": "Ve kterém úložišti Git se soubor nachází.", "tr": "Dosyanın içinde bulunduğu Git deposu." }, "type": "string", "default": { "en": "mediawiki/core", "cs": "mediawiki/core", "tr": "mediawiki/core" } }, "action": { "label": { "en": "Mode", "cs": "Mód", "tr": "Mod" }, "description": { "en": "One of “browse”, “tree” or “blame” or “history”.", "cs": "Jedno z “browse”, “tree” nebo “blame” nebo “history”.", "tr": "“browse\", “tree” veya “blame” veya “history” modlardan biri." }, "type": "string", "default": { "en": "browse", "cs": "browse", "tr": "browse" } }, "branch": { "label": { "en": "Branch", "cs": "Větev", "tr": "Dal" }, "description": { "en": "Which branch of the repository the file is in.", "cs": "Ve které větvi úložiště se soubor nachází.", "tr": "Dosyanın deponun hangi dalında olduğu." }, "type": "string", "default": { "en": "HEAD", "cs": "HEAD", "tr": "HEAD" } }, "file": { "label": { "en": "File", "cs": "Soubor", "tr": "Dosya" }, "description": { "en": "Path to the file within the specified repository and branch.", "cs": "Cesta k souboru v rámci zadaného úložiště a větve.", "tr": "Belirtilen depo ve daldaki dosyanın yolu." }, "example": { "en": "includes/MediaWiki.php", "cs": "includes/MediaWiki.php", "tr": "includes/MediaWiki.php" }, "type": "string", "required": true, "suggested": true, "aliases": [ "1" ] }, "sha": { "label": { "en": "Commit", "cs": "Vazba", "tr": "Taahhüt" }, "description": { "en": "The SHA-1 hash of the specific commit within a branch. Use this to make a permalink.", "cs": "Hash SHA-1 konkrétního potvrzení v rámci větve. Použijte toto k vytvoření trvalého odkazu.", "tr": "Bir daldaki belirli kaydetmenin SHA-1 karma değeri. Kalıcı bağlantı oluşturmak için bunu kullanın." }, "type": "string" }, "line": { "label": { "en": "Line number", "cs": "Číslo řádku", "tr": "Satır numarası" }, "description": { "en": "The link will anchor to this line within the file, and highlight it.", "cs": "Odkaz se ukotví na tento řádek v souboru a zvýrazní jej.", "tr": "Bağlantı, dosya içindeki bu satıra bağlanacak ve onu vurgulayacaktır." }, "example": { "en": "42", "cs": "42", "tr": "42" }, "type": "number" }, "text": { "label": { "en": "Label", "cs": "Označení", "tr": "Metin" }, "description": { "en": "The text that become the link.", "cs": "Text, který se stane odkazem.", "tr": "Bağlantı haline gelen metin." }, "type": "string", "default": { "en": "The “file” parameter value.", "cs": "Hodnota parametru “file”.", "tr": "“file” parametresi değeri." }, "aliases": [ "2" ] } }, "description": { "en": "Generates a link to view the file in Gerrit.", "cs": "Vygeneruje odkaz pro zobrazení souboru v Gerritu.", "tr": "Dosyayı Gerrit'te görüntülemek için bir bağlantı oluşturur." }, "paramOrder": [ "text", "action", "project", "branch", "sha", "file", "line" ], "format": "inline" } </templatedata>


Example

Basic

{{Git file|file=composer.json}} produces

composer.json

{{Git file|project=mediawiki/extensions/Flow|file=FlowActions.php}} produces

FlowActions.php
Text

{{Git file|project=mediawiki/extensions/EventLogging|file=devserver/bin/eventlogging-devserver|text=development server}} produces

development server
Action

{{Git file|file=composer.json|action=raw}} {{Git file|file=composer.json|action=blame}} {{Git file|file=composer.json|action=history}} produces

composer.json
composer.json
composer.json

{{Git file|project=mediawiki/extensions/EventLogging|text=EventLogging extension}} produces

EventLogging extension
Line number

{{Git file|file=tests/phpunit/includes/MessageTest.php|line=123}} produces

tests/phpunit/includes/MessageTest.php
Project summary page (deprecated)

{{Git file|project=oojs/core|action=summary|text=OOjs (core)}} produces

OOjs (core)

Known issues

Notes

The template has to use numeric entities &#59; and &32; for semicolon and hashmark because, as WP:Advanced template coding says, "MediaWiki wiki-formats the clauses inside #if". MediaWiki would sometimes parse these characters as introducing a definition term and numbered list (even though they're not at the start of new lines).

See also

  • {{Git repo }} links to a repository summary
  • {{MW file }} generates a box with various links to a file in MediaWiki core, used by Manual.
  • {{Git }} generates links to various git-related objects on gerrit, like commits or changesets
  • {{Github }} links to a file on the GitHub mirror of a repository (by default wikimedia/mediawiki)
  • lots of other fancy templates for extensions on gerrit, see Category:Git.