Difference between revisions of "Template:Git link"

From VideoLAN Wiki
Jump to navigation Jump to search
m ([ and ] should appear solely for commits, simplify advanced example)
m (Whitespace (no effect))
Line 1: Line 1:
 
<!--
 
<!--
 
-->{{#if:{{{p|}}}<!--
 
-->{{#if:{{{p|}}}<!--
    -->|{{#if:{{{a|}}}<!--
+
  -->|{{#if:{{{a|}}}<!--
        -->|{{#if:{{{h|}}}<!-- p given, a given
+
    -->|{{#if:{{{h|}}}<!-- p given, a given
              -->|[https://git.videolan.org/?p={{{p}}};a={{{a}}};h={{{h}}} {{{l|&#x5B;{{{h}}}&#x5D;}}}]<!--
+
        -->|[https://git.videolan.org/?p={{{p}}};a={{{a}}};h={{{h}}} {{{l|&#x5B;{{{h}}}&#x5D;}}}]<!--
              -->|[https://git.videolan.org/?p={{{p}}};a=summary;h=HEAD {{{l|{{{p}}}}}}]<!--
+
        -->|[https://git.videolan.org/?p={{{p}}};a=summary;h=HEAD {{{l|{{{p}}}}}}]<!--
          -->}}<!--
+
      -->}}<!--
        -->|{{#if:{{{h|}}}<!-- p given, a not given
+
    -->|{{#if:{{{h|}}}<!-- p given, a not given
              -->|[https://git.videolan.org/?p={{{p}}};h={{{h}}} {{{l|&#x5B;{{{h}}}&#x5D;}}}]<!--
+
        -->|[https://git.videolan.org/?p={{{p}}};h={{{h}}} {{{l|&#x5B;{{{h}}}&#x5D;}}}]<!--
              -->|[https://git.videolan.org/?p={{{p}}};h=HEAD {{{l|{{{p}}}}}}]<!--
+
        -->|[https://git.videolan.org/?p={{{p}}};h=HEAD {{{l|{{{p}}}}}}]<!--
          -->}}<!--
+
      -->}}<!--
    -->}}<!--
+
  -->}}<!--
    -->|{{#if:{{{a|}}}<!--
+
  -->|{{#if:{{{a|}}}<!--
        -->|{{#if:{{{h|}}}<!-- p not given, a given
+
    -->|{{#if:{{{h|}}}<!-- p not given, a given
              -->|[https://git.videolan.org/ {{{l|Git}}}]<!--
+
        -->|[https://git.videolan.org/ {{{l|Git}}}]<!--
              -->|[https://git.videolan.org/ {{{l|Git}}}]<!--
+
        -->|[https://git.videolan.org/ {{{l|Git}}}]<!--
          -->}}<!--
+
      -->}}<!--
        -->|{{#if:{{{h|}}}<!-- p not given, a not given
+
    -->|{{#if:{{{h|}}}<!-- p not given, a not given
              -->|[https://git.videolan.org/ {{{l|Git}}}]<!--
+
        -->|[https://git.videolan.org/ {{{l|Git}}}]<!--
              -->|[https://git.videolan.org/ {{{l|Git}}}]<!--
+
        -->|[https://git.videolan.org/ {{{l|Git}}}]<!--
          -->}}<!--
+
      -->}}<!--
    -->}}<!--
+
  -->}}<!--
 
-->}}<noinclude>
 
-->}}<noinclude>
 
== Usage ==
 
== Usage ==

Revision as of 08:21, 11 March 2019

Git

Usage

{{ Git link |p= |a= |h= }}

or

{{ Git link |p= |a= |h= |l= }}

This is a meta-template.

Parameters:

  • |p= is the branch e.g. vlc.git, vlc/vlc-2.2.git or vlma.git (see https://git.videolan.org for a list of branch names)
  • |a= is the format e.g. blob. No sanity checks are done by this template but only summary, shortlog, log, commit, commitdiff, tree and patch are valid.
  • |h= is the hash e.g. 72f3067a6fddcd30e0ee33928a0ec6622ed2e74b
  • |l= is the label (optional) e.g. arbitrary

Example 1:

{{Git link|p=vlc.git|a=commit|h=72f3067a6fddcd30e0ee33928a0ec6622ed2e74b}}

[72f3067a6fddcd30e0ee33928a0ec6622ed2e74b]

Example 2:

{{Git link|p=vlc.git|a=commit|h=72f3067a6fddcd30e0ee33928a0ec6622ed2e74b|l=label}}

label

This template will branch intelligently if any parameter or combination of parameters are omitted, because raw parameters send XSS requests:

  • {{Git link}} gives Git
  • {{Git link|p=vlc.git}} gives vlc.git
  • {{Git link|a=blob|h=72f3067a6fddcd30e0ee33928a0ec6622ed2e74b}} gives Git