Difference between revisions of "Template:Git link"

From VideoLAN Wiki
Jump to navigation Jump to search
m (Simplify)
(New feature: parameters "f" and "hb". I question whether this template is convolute)
Line 2: Line 2:
 
-->{{#if:{{{p|}}}<!--
 
-->{{#if:{{{p|}}}<!--
 
   -->|{{#if:{{{a|}}}<!--
 
   -->|{{#if:{{{a|}}}<!--
     -->|{{#if:{{{h|}}}<!-- p given, a given
+
     -->|{{#if:{{{f|}}}<!--
         -->|[https://git.videolan.org/?p={{{p}}};a={{{a}}};h={{{h}}} {{{l|&#x5B;{{{h}}}&#x5D;}}}]<!--
+
        -->|{{#if:{{{h|}}}<!--
        -->|[https://git.videolan.org/?p={{{p}}};a=summary;h=HEAD {{{l|{{{p}}}}}}]<!--
+
          -->|{{#if:{{{hb|}}}<!--
       -->}}<!--
+
              p given, a given, f given, h given, hb given:
     -->|{{#if:{{{h|}}}<!-- p given, a not given
+
              -->|[https://git.videolan.org/?p={{{p}}};a={{{a}}};f={{{f}}};h={{{h}}};hb={{{hb}}} {{{l|{{{f}}}}}}]<!--
         -->|[https://git.videolan.org/?p={{{p}}};h={{{h}}} {{{l|&#x5B;{{{h}}}&#x5D;}}}]<!--
+
              p given, a given, f given, h given, hb not given:
        -->|[https://git.videolan.org/?p={{{p}}};h=HEAD {{{l|{{{p}}}}}}]<!--
+
              -->|[https://git.videolan.org/?p={{{p}}};a={{{a}}};f={{{f}}};h={{{h}}} {{{l|{{{f}}}}}}]<!--
       -->}}<!--
+
            -->}}<!-- end hb
   -->}}<!-- p not given
+
          -->|{{#if:{{{hb|}}}<!-- h not given branch
  -->|[https://git.videolan.org/ {{{l|Git}}}]<!--
+
              p given, a given, f given, h not given, hb given:
 +
              -->|[https://git.videolan.org/?p={{{p}}};a={{{a}}};f={{{f}}};hb={{{hb}}} {{{l|{{{f}}}}}}]<!--
 +
              p given, a given, f given, h not given, hb not given:
 +
              -->|[https://git.videolan.org/?p={{{p}}};a={{{a}}};f={{{f}}} {{{l|{{{f}}}}}}]<!--
 +
            -->}}<!-- end hb
 +
        -->}}<!-- end h
 +
         -->|{{#if:{{{h|}}}<!-- f not given branch
 +
          -->|{{#if:{{{hb|}}}<!--
 +
              p given, a given, f not given, h given, hb given:
 +
              -->|[https://git.videolan.org/?p={{{p}}};a={{{a}}};h={{{h}}};hb={{{hb}}} {{{l|&#x5B;{{{h}}}&#x5D;}}}]<!--
 +
              p given, a given, f not given, h given, hb not given:
 +
              -->|[https://git.videolan.org/?p={{{p}}};a={{{a}}};h={{{h}}} {{{l|&#x5B;{{{h}}}&#x5D;}}}]<!--
 +
            -->}}<!-- end hb
 +
          -->|{{#if:{{{hb|}}}<!-- h not given branch
 +
              p given, a given, f not given, h not given, hb given:
 +
              -->|[https://git.videolan.org/?p={{{p}}};a={{{a}}};hb={{{hb}}} {{{l|{{{p}}}}}}]<!--
 +
              p given, a given, f not given, h not given, hb not given:
 +
              -->|[https://git.videolan.org/?p={{{p}}};a={{{a}}} {{{l|{{{p}}}}}}]<!--
 +
            -->}}<!-- end hb
 +
        -->}}<!-- end h
 +
       -->}}<!-- end f
 +
     -->|{{#if:{{{f|}}}<!-- a not given branch
 +
        -->|{{#if:{{{h|}}}<!--
 +
          -->|{{#if:{{{hb|}}}<!--
 +
              p given, a not given, f given, h given, hb given:
 +
              -->|[https://git.videolan.org/?p={{{p}}};f={{{f}}};h={{{h}}};hb={{{hb}}} {{{l|{{{f}}}}}}]<!--
 +
              p given, a not given, f given, h given, hb not given:
 +
              -->|[https://git.videolan.org/?p={{{p}}};f={{{f}}};h={{{h}}} {{{l|{{{f}}}}}}]<!--
 +
            -->}}<!-- end hb
 +
          -->|{{#if:{{{hb|}}}<!-- h not given branch
 +
              p given, a not given, f given, h not given, hb given:
 +
              -->|[https://git.videolan.org/?p={{{p}}};f={{{f}}};hb={{{hb}}} {{{l|{{{f}}}}}}]<!--
 +
              p given, a not given, f given, h not given, hb not given:
 +
              -->|[https://git.videolan.org/?p={{{p}}};f={{{f}}}; {{{l|{{{f}}}}}}]<!--
 +
            -->}}<!-- end hb
 +
        -->}}<!-- end h
 +
         -->|{{#if:{{{h|}}}<!-- f not given branch
 +
          -->|{{#if:{{{hb|}}}<!--
 +
              p given, a not given, f not given, h given, hb given:
 +
              -->|[https://git.videolan.org/?p={{{p}}};h={{{h}}};hb={{{hb}}} {{{l|&#x5B;{{{h}}}&#x5D;}}}]<!--
 +
              p given, a not given, f not given, h given, hb not given:
 +
              -->|[https://git.videolan.org/?p={{{p}}};h={{{h}}} {{{l|&#x5B;{{{h}}}&#x5D;}}}]<!--
 +
            -->}}<!-- end hb
 +
          -->|{{#if:{{{hb|}}}<!--
 +
              p given, a not given, f not given, h not given, hb given:
 +
              -->|[https://git.videolan.org/?p={{{p}}};hb={{{hb}}} {{{l|{{{p}}}}}}]<!--
 +
              p given, a not given, f not given, h not given, hb not given:
 +
              -->|[https://git.videolan.org/?p={{{p}}} {{{l|{{{p}}}}}}]<!--
 +
            -->}}<!-- end hb
 +
        -->}}<!-- end h
 +
       -->}}<!-- end f
 +
   -->}}<!-- end a
 +
  -->|<!-- p not given branch -->[https://git.videolan.org/ {{{l|Git}}}]<!--
 
-->}}<noinclude>
 
-->}}<noinclude>
 
== Usage ==
 
== Usage ==
Line 17: Line 69:
 
or
 
or
 
  <code>{{ {{PAGENAME}} <nowiki>|p= |a= |h= |l= }}</nowiki></code>
 
  <code>{{ {{PAGENAME}} <nowiki>|p= |a= |h= |l= }}</nowiki></code>
 +
or
 +
<code>{{ {{PAGENAME}} <nowiki>|p= |a= |f= }}</nowiki></code>
 +
or
 +
<code>{{ {{PAGENAME}} <nowiki>|p= |a= |f= |h= }}</nowiki></code>
  
 
This is a meta-template.
 
This is a meta-template.
Line 23: Line 79:
 
* '''<code>|p=</code>''' is the '''branch''' e.g. <kbd>vlc.git</kbd>, <kbd>vlc/vlc-2.2.git</kbd> or <kbd>vlma.git</kbd> (see https://git.videolan.org for a list of branch names)
 
* '''<code>|p=</code>''' is the '''branch''' e.g. <kbd>vlc.git</kbd>, <kbd>vlc/vlc-2.2.git</kbd> or <kbd>vlma.git</kbd> (see https://git.videolan.org for a list of branch names)
 
* '''<code>|a=</code>''' is the '''format''' e.g. <kbd>blob</kbd>. No sanity checks are done by this template but only <kbd>summary</kbd>, <kbd>shortlog</kbd>, <kbd>log</kbd>, <kbd>commit</kbd>, <kbd>commitdiff</kbd>, <kbd>tree</kbd> and <kbd>patch</kbd> are valid.
 
* '''<code>|a=</code>''' is the '''format''' e.g. <kbd>blob</kbd>. No sanity checks are done by this template but only <kbd>summary</kbd>, <kbd>shortlog</kbd>, <kbd>log</kbd>, <kbd>commit</kbd>, <kbd>commitdiff</kbd>, <kbd>tree</kbd> and <kbd>patch</kbd> are valid.
 +
* '''<code>|f=</code>''' is the '''file''' e.g. <kbd>modules/demux/image.c</kbd>. You can pass directory names to <kbd>|f=</kbd> as well if <kbd>|a=tree</kbd>
 
* '''<code>|h=</code>''' is the '''hash''' e.g. <kbd>72f3067a6fddcd30e0ee33928a0ec6622ed2e74b</kbd>
 
* '''<code>|h=</code>''' is the '''hash''' e.g. <kbd>72f3067a6fddcd30e0ee33928a0ec6622ed2e74b</kbd>
 +
* '''<code>|hb=</code>''' ???
 
* '''<code>|l=</code>''' is the '''label''' (optional) e.g. <kbd>arbitrary</kbd>
 
* '''<code>|l=</code>''' is the '''label''' (optional) e.g. <kbd>arbitrary</kbd>
  
Line 33: Line 91:
 
  <code>{{{{PAGENAME}}<nowiki>|p=vlc.git|a=commit|h=72f3067a6fddcd30e0ee33928a0ec6622ed2e74b|l=label}}</nowiki></code>
 
  <code>{{{{PAGENAME}}<nowiki>|p=vlc.git|a=commit|h=72f3067a6fddcd30e0ee33928a0ec6622ed2e74b|l=label}}</nowiki></code>
 
{{{{PAGENAME}}|p=vlc.git|a=commit|h=72f3067a6fddcd30e0ee33928a0ec6622ed2e74b|l=label}}
 
{{{{PAGENAME}}|p=vlc.git|a=commit|h=72f3067a6fddcd30e0ee33928a0ec6622ed2e74b|l=label}}
 +
 +
Example 3:
 +
<code>{{{{PAGENAME}}<nowiki>|p=x264.git|a=tree|f=modules}}</nowiki></code>
 +
{{{{PAGENAME}}|p=vlc.git|a=tree|f=modules}}
 +
 +
Example 4:
 +
<code>{{{{PAGENAME}}<nowiki>|p=vlc.git|a=commitdiff|h=72f3067a6fddcd30e0ee33928a0ec6622ed2e74b}}</nowiki></code>
 +
{{{{PAGENAME}}|p=vlc.git|a=commitdiff|h=72f3067a6fddcd30e0ee33928a0ec6622ed2e74b}}
 +
 +
Example 5:
 +
<code>{{{{PAGENAME}}<nowiki>|p=x264.git|a=history}}</nowiki></code>
 +
{{{{PAGENAME}}|p=x264.git|a=history}}
  
 
This template will branch intelligently if any parameter or combination of parameters are omitted, because raw parameters send [[wikipedia:XSS|XSS]] requests:
 
This template will branch intelligently if any parameter or combination of parameters are omitted, because raw parameters send [[wikipedia:XSS|XSS]] requests:

Revision as of 02:53, 12 March 2019

Git

Usage

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

or

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

or

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

or

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

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.
  • |f= is the file e.g. modules/demux/image.c. You can pass directory names to |f= as well if |a=tree
  • |h= is the hash e.g. 72f3067a6fddcd30e0ee33928a0ec6622ed2e74b
  • |hb= ???
  • |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

Example 3:

{{Git link|p=x264.git|a=tree|f=modules}}

modules

Example 4:

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

[72f3067a6fddcd30e0ee33928a0ec6622ed2e74b]

Example 5:

{{Git link|p=x264.git|a=history}}

x264.git

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