Difference between revisions of "Template:StreamLinkTable"
(fixed rowspan using a little css magic) |
(created fancy readme, set stages to generic name) |
||
| Line 1: | Line 1: | ||
<noinclude> | <noinclude> | ||
| + | __TOC__ | ||
| + | === synopsis === | ||
| + | This is the "{{PAGENAME}}" template. | ||
| − | + | It will generate a table with various links derived from the <code>stages</code>, <code>languages</code>, <code>formats</code> and <code>types</code>. | |
| − | + | It should be called in the following format (all parameters are '''optional'''): | |
| − | + | <nowiki>{{</nowiki>{{PAGENAME}} | |
| + | |baseURL= | ||
| + | |stages= | ||
| + | |languages= | ||
| + | |languageCount= | ||
| + | |formats= | ||
| + | |types= | ||
| + | |typeCount= | ||
| + | }} | ||
| − | + | === parameters === | |
| − | + | The parameters all default to something useful for [[CCC]] and each has a specific syntax: | |
| − | + | baseURL | |
| − | + | * <code>baseURL</code>: first common part of the link, defaults to '''<nowiki>http://cdn.c3voc.de/</nowiki>''' | |
| − | + | * <code>stages</code>: comma separated (''',''') list of ''<code>Stage Label;urlPart</code>'' (note the semicolon ''';'''), defaults to 3 × '''Stage ''n'';s''n''''' | |
| − | + | * <code>languages</code>: comma separated (''',''') list of ''<code>Language Label;urlPart</code>'' (note the semicolon ''';'''), defaults to '''Native;_native_,Translated;_translated_''' | |
| − | + | * <code>languageCount</code>: number used for setting the correct table header span, set to reflect the amount of languages, defaults to '''2''' | |
| + | * <code>formats</code>: comma separated (''',''') list of ''<code>Format Label;urlPart</code>'' (note the semicolon ''';'''), defaults to '''WebM;.webm,HLS;.m3u8''' | ||
| + | * <code>types</code>: comma separated (''',''') list of ''<code>Type Label;urlPart</code>'' (note the semicolon ''';'''), defaults to '''HD;hd,SD;sd,Slides;slides''' | ||
| + | * <code>typeCount</code>: number used for setting the correct table header span, set to reflect the amount of types, defaults to '''3''' | ||
| − | ---- | + | The links are generated as followed (always using the item part ''after'' the semicolon: |
| + | <code>baseURL</code>+<code>stage</code>(outer row)+<code>language</code>(inner row)+<code>type</code>(inner column)+<code>format</code>(outer column), for example ''Stage 3 Native Slides as HLS'' will have the link: <code>http://cdn.c3voc.de/s3_native_slides.m3u8</code> | ||
| + | |||
| + | === css === | ||
| + | Note that for the best results, this table needs extra CSS in [[MediaWiki:Common.css]]: | ||
| + | <pre> | ||
| + | /* CSS span table rowspan only showing the first header */ | ||
| + | table.span tr>th.span2, | ||
| + | table.span tr>th.span3, | ||
| + | table.span tr>th.span4, | ||
| + | table.span tr>th.span5 | ||
| + | { | ||
| + | display: none; | ||
| + | } | ||
| + | |||
| + | table.span tr:nth-of-type(2n+1)>th.span2, | ||
| + | table.span tr:nth-of-type(3n+1)>th.span3, | ||
| + | table.span tr:nth-of-type(4n+1)>th.span4, | ||
| + | table.span tr:nth-of-type(5n+1)>th.span5 | ||
| + | { | ||
| + | display: table-cell; | ||
| + | } | ||
| + | </pre> | ||
| + | |||
| + | If it is not possible to have this CSS added, make sure to set <code>languageCount = 1</code>, or the table layout will break. | ||
| + | |||
| + | === example === | ||
| + | Edit the page to see how the following table is generated: | ||
</noinclude> | </noinclude> | ||
<table class="wikitable span"> | <table class="wikitable span"> | ||
| Line 27: | Line 68: | ||
|}} | |}} | ||
</tr> | </tr> | ||
| − | {{#arraymap:{{{stages| | + | {{#arraymap:{{{stages|Stage 1;s1, Stage 2;s2,Stage 3;s3}}}|,|stage| |
| − | {{#arraymap:{{{ | + | {{#arraymap:{{{languages|Native;_native_,Translated;_translated_}}}|,|language| |
<tr> | <tr> | ||
| − | <th class=" | + | <th class="span{{{languageCount|2}}}" rowspan="{{{languageCount|2}}}">{{#explode:stage|;|0}}</th> |
<th>{{#explode:language|;|0}}</th> | <th>{{#explode:language|;|0}}</th> | ||
{{#arraymap:{{{formats|WebM;.webm,HLS;.m3u8}}}|,|format| | {{#arraymap:{{{formats|WebM;.webm,HLS;.m3u8}}}|,|format| | ||
Revision as of 10:56, 7 December 2017
Contents
synopsis
This is the "StreamLinkTable" template.
It will generate a table with various links derived from the stages, languages, formats and types.
It should be called in the following format (all parameters are optional):
{{StreamLinkTable
|baseURL=
|stages=
|languages=
|languageCount=
|formats=
|types=
|typeCount=
}}
parameters
The parameters all default to something useful for CCC and each has a specific syntax: baseURL
baseURL: first common part of the link, defaults to http://cdn.c3voc.de/stages: comma separated (,) list ofStage Label;urlPart(note the semicolon ;), defaults to 3 × Stage n;snlanguages: comma separated (,) list ofLanguage Label;urlPart(note the semicolon ;), defaults to Native;_native_,Translated;_translated_languageCount: number used for setting the correct table header span, set to reflect the amount of languages, defaults to 2formats: comma separated (,) list ofFormat Label;urlPart(note the semicolon ;), defaults to WebM;.webm,HLS;.m3u8types: comma separated (,) list ofType Label;urlPart(note the semicolon ;), defaults to HD;hd,SD;sd,Slides;slidestypeCount: number used for setting the correct table header span, set to reflect the amount of types, defaults to 3
The links are generated as followed (always using the item part after the semicolon:
baseURL+stage(outer row)+language(inner row)+type(inner column)+format(outer column), for example Stage 3 Native Slides as HLS will have the link: http://cdn.c3voc.de/s3_native_slides.m3u8
css
Note that for the best results, this table needs extra CSS in MediaWiki:Common.css:
/* CSS span table rowspan only showing the first header */
table.span tr>th.span2,
table.span tr>th.span3,
table.span tr>th.span4,
table.span tr>th.span5
{
display: none;
}
table.span tr:nth-of-type(2n+1)>th.span2,
table.span tr:nth-of-type(3n+1)>th.span3,
table.span tr:nth-of-type(4n+1)>th.span4,
table.span tr:nth-of-type(5n+1)>th.span5
{
display: table-cell;
}
If it is not possible to have this CSS added, make sure to set languageCount = 1, or the table layout will break.
example
Edit the page to see how the following table is generated:
| WebM | HLS | ||||||
|---|---|---|---|---|---|---|---|
| HD | SD | Slides | HD | SD | Slides | ||
| Stage 1 | Native | link | link | link | link | link | link |
| Stage 1 | Translated | link | link | link | link | link | link |
| Stage 2 | Native | link | link | link | link | link | link |
| Stage 2 | Translated | link | link | link | link | link | link |
| Stage 3 | Native | link | link | link | link | link | link |
| Stage 3 | Translated | link | link | link | link | link | link |