Difference between revisions of "Template:Git link"
Jump to navigation
Jump to search
m (Simplify) |
(Tweaks) |
||
(4 intermediate revisions by the same user not shown) | |||
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|[{{{h}}}]}}}]<!-- | + | -->|{{#if:{{{h|}}}<!-- |
− | + | -->|{{#if:{{{hb|}}}<!-- | |
− | -->}}<!-- | + | p given, a given, f given, h given, hb given: show filename |
− | -->|{{#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|[{{{h}}}]}}}]<!-- | + | p given, a given, f given, h given, hb not given: show filename |
− | + | -->|[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 |
− | + | p given, a given, f given, h not given, hb given: show filename | |
+ | -->|[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: show filename | ||
+ | -->|[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: show hash | ||
+ | -->|[https://git.videolan.org/?p={{{p}}};a={{{a}}};h={{{h}}};hb={{{hb}}} {{{l|[{{{h}}}]}}}]<!-- | ||
+ | p given, a given, f not given, h given, hb not given: show hash | ||
+ | -->|[https://git.videolan.org/?p={{{p}}};a={{{a}}};h={{{h}}} {{{l|[{{{h}}}]}}}]<!-- | ||
+ | -->}}<!-- end hb | ||
+ | -->|{{#if:{{{hb|}}}<!-- h not given branch | ||
+ | p given, a given, f not given, h not given, hb given: show branch | ||
+ | -->|[https://git.videolan.org/?p={{{p}}} {{{l|{{{p}}}}}}]<!-- | ||
+ | p given, a given, f not given, h not given, hb not given: show branch | ||
+ | -->|[https://git.videolan.org/?p={{{p}}} {{{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: show filename | ||
+ | -->|[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: show filename | ||
+ | -->|[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: show filename | ||
+ | -->|[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: show filename | ||
+ | -->|[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: show hash | ||
+ | -->|[https://git.videolan.org/?p={{{p}}};h={{{h}}};hb={{{hb}}} {{{l|[{{{h}}}]}}}]<!-- | ||
+ | p given, a not given, f not given, h given, hb not given: show hash | ||
+ | -->|[https://git.videolan.org/?p={{{p}}};h={{{h}}} {{{l|[{{{h}}}]}}}]<!-- | ||
+ | -->}}<!-- end hb | ||
+ | -->|{{#if:{{{hb|}}}<!-- | ||
+ | p given, a not given, f not given, h not given, hb given: show branch | ||
+ | -->|[https://git.videolan.org/?p={{{p}}} {{{l|{{{p}}}}}}]<!-- | ||
+ | p given, a not given, f not given, h not given, hb not given: show branch | ||
+ | -->|[https://git.videolan.org/?p={{{p}}} {{{l|{{{p}}}}}}]<!-- | ||
+ | -->}}<!-- end hb | ||
+ | -->}}<!-- end h | ||
+ | -->}}<!-- end f | ||
+ | -->}}<!-- end a | ||
+ | -->|<!-- p not given branch: show Git -->[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, a wrapper around URL requests to git.videolan.org. This template ''does not'' perform [[wikipedia:sanity check|sanity check]]s. It saves keystrokes and avoids [[wikipedia:XSS|XSS]] requests from passed parameters. |
Parameters: | Parameters: | ||
* '''<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>. | + | * '''<code>|a=</code>''' is the '''format''' e.g. <kbd>blob</kbd>. This may be given free-form but only the following are valid: <kbd>summary</kbd>, <kbd>shortlog</kbd>, <kbd>log</kbd>, <kbd>commit</kbd>, <kbd>commitdiff</kbd>, <kbd>tree</kbd> and <kbd>patch</kbd> |
+ | * '''<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 31: | Line 89: | ||
Example 2: | Example 2: | ||
− | <code>{{{{PAGENAME}}<nowiki>|p=vlc.git|a=commit|h=72f3067a6fddcd30e0ee33928a0ec6622ed2e74b|l= | + | <code>{{{{PAGENAME}}<nowiki>|p=vlc.git|a=commit|h=72f3067a6fddcd30e0ee33928a0ec6622ed2e74b|l=First revision of VLC}}</nowiki></code> |
− | {{{{PAGENAME}}|p=vlc.git|a=commit|h=72f3067a6fddcd30e0ee33928a0ec6622ed2e74b|l= | + | {{{{PAGENAME}}|p=vlc.git|a=commit|h=72f3067a6fddcd30e0ee33928a0ec6622ed2e74b|l=First revision of VLC}} |
+ | |||
+ | Example 3: | ||
+ | <code>{{{{PAGENAME}}<nowiki>|p=x264.git|a=tree|f=doc}}</nowiki></code> | ||
+ | {{{{PAGENAME}}|p=x264.git|a=tree|f=doc}} | ||
+ | |||
+ | 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}} | ||
+ | |||
+ | Example 6: | ||
+ | <code>{{{{PAGENAME}}<nowiki>|p=vlc/vlc-2.0.git|a=blob|f=modules/video_filter/crop.c|h=b5e946097a7e7acbe0c90446d0752ff0f7f706ec|hb=HEAD|l=This module no longer exists. Here's a link to it anyway}}</nowiki></code> | ||
+ | {{{{PAGENAME}}|p=vlc/vlc-2.0.git|a=blob|f=modules/video_filter/crop.c|h=b5e946097a7e7acbe0c90446d0752ff0f7f706ec|hb=HEAD|l=This module no longer exists. Here's a link to it anyway}} | ||
− | This template will branch | + | This template will branch to the most specific condition upon parameter omission: |
− | * <code>{{{{PAGENAME}}<nowiki>}}</nowiki></code> gives {{{{PAGENAME}}<!---->}} | + | * <code>{{{{PAGENAME}}<nowiki>}}</nowiki></code> gives {{{{PAGENAME}}<!---->}} rather than https://git.videolan.org/?p={{{p}}};a={{{a}}};f={{{f}}};h={{{h}}};hb={{{hb}}} |
− | * <code>{{{{PAGENAME}}| | + | * <code>{{{{PAGENAME}}|a=blob|h=72f3067a6fddcd30e0ee33928a0ec6622ed2e74b<nowiki>}}</nowiki></code> gives {{{{PAGENAME}}|a=blob|h=72f3067a6fddcd30e0ee33928a0ec6622ed2e74b}} because no branch was specified |
− | * <code>{{{{PAGENAME}}|a= | + | * <code>{{{{PAGENAME}}|p=vlc.git|a=summary|hb=HEAD<nowiki>}}</nowiki></code> gives {{{{PAGENAME}}|p=vlc.git|a=summary|hb=HEAD}} |
[[Category:Templates]] | [[Category:Templates]] | ||
</noinclude> | </noinclude> |
Latest revision as of 03:44, 12 March 2019
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, a wrapper around URL requests to git.videolan.org. This template does not perform sanity checks. It saves keystrokes and avoids XSS requests from passed parameters.
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. This may be given free-form but only the following are valid: summary, shortlog, log, commit, commitdiff, tree and patch|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=First revision of VLC}}
Example 3:
{{Git link|p=x264.git|a=tree|f=doc}}
Example 4:
{{Git link|p=vlc.git|a=commitdiff|h=72f3067a6fddcd30e0ee33928a0ec6622ed2e74b}}
[72f3067a6fddcd30e0ee33928a0ec6622ed2e74b]
Example 5:
{{Git link|p=x264.git|a=history}}
Example 6:
{{Git link|p=vlc/vlc-2.0.git|a=blob|f=modules/video_filter/crop.c|h=b5e946097a7e7acbe0c90446d0752ff0f7f706ec|hb=HEAD|l=This module no longer exists. Here's a link to it anyway}}
This module no longer exists. Here's a link to it anyway
This template will branch to the most specific condition upon parameter omission:
{{Git link}}
gives Git rather than https://git.videolan.org/?p={{{p}}};a={{{a}}};f={{{f}}};h={{{h}}};hb={{{hb}}}{{Git link|a=blob|h=72f3067a6fddcd30e0ee33928a0ec6622ed2e74b}}
gives Git because no branch was specified{{Git link|p=vlc.git|a=summary|hb=HEAD}}
gives vlc.git