Template:Collection table: Difference between revisions

From Tygron Support wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
 
(12 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{#ifeq: {{{type|}}}|table|{{{!}}class="wikitable {{#if:{{{allowselflink|}}}||noselflink}}" <!--
<includeonly>{{#ifeq: {{{type|}}}|table|<table class="{{{tableclass|wikitable}}} {{#if:{{{allowselflink|}}}||noselflink}}"><tr><!--
-->{{#if: {{{1|}}}|<nowiki></nowiki>
-->{{#if:{{{icon|}}}|{{#if: {{{3|Icon}}}|<nowiki></nowiki>
! {{{1|}}}|}}{{#if: {{{3|}}}|<nowiki></nowiki>
<th class="icon-cell"> {{{3|Icon}}}</th>|}}|}}{{#if: {{{1|}}}|<nowiki></nowiki>
! {{{3|}}}|}}{{#if: {{{5|}}}|<nowiki></nowiki>
<th> {{{1|}}}</th>|}}{{#if:{{{icon|}}}||{{#if: {{{3|}}}|<nowiki></nowiki>
! {{{5|}}}|}}{{#if: {{{7|}}}|<nowiki></nowiki>
<th> {{{3|}}}</th>}}}}{{#if: {{{5|}}}|<nowiki></nowiki>
! {{{7|}}}|}}{{#if: {{{9|}}}|<nowiki></nowiki>
<th> {{{5|}}}</th>|}}{{#if: {{{7|}}}|<nowiki></nowiki>
! {{{9|}}}|}}{{#if: {{{11|}}}|<nowiki></nowiki>
<th> {{{7|}}}</th>|}}{{#if: {{{9|}}}|<nowiki></nowiki>
! {{{11|}}}|}}{{#if: {{{13|}}}|<nowiki></nowiki>
<th> {{{9|}}}</th>|}}{{#if: {{{11|}}}|<nowiki></nowiki>
! {{{13|}}}
<th> {{{11|}}}</th>|}}{{#if: {{{13|}}}|<nowiki></nowiki>
|}}{{#if: {{{content|}}}|{{{content|}}}|}}
<th> {{{13|}}}</th>
{{!}}}<noinclude><!--End of table--></noinclude>
|}}</tr>
{{#if:{{{suppresscategory|}}}||[[Category:{{{category|}}}]]<nowiki></nowiki>}}
{{#if: {{{content|}}}|
|<nowiki></nowiki><noinclude><!--Start of row--></noinclude>
{{{content|}}}|}}
{{#if: {{{1|}}}|<nowiki></nowiki>
</table><noinclude><!--End of table--></noinclude>
{{!}}-
{{#if:{{{suppresscategory|}}}||{{#if:{{{category|}}}|[[Category:{{{category|}}}]]|}}<nowiki></nowiki>}}
{{!}} {{#if: {{{attribute|}}}<!--
|<!--<nowiki></nowiki>--><noinclude><!--Start of row--></noinclude>
-->| {{#if: {{{postfix|}}} | [[{{lc:{{{2|}}}}} ({{{postfix|}}})|{{{2|}}}]] | [[{{lc:{{{2|}}}}}|{{{2|}}}]]}}<!--
<tr>
-->| {{#if: {{{postfix|}}}|{{linkappend|post=&nbsp;({{{postfix|}}})| {{{2|}}} }}|[[{{{2|}}}]]}}<!--
<!--
-->}}}}{{#if: {{{3|}}}|<nowiki></nowiki>
If there's an icon, place it first
{{!}} {{{4|}}}|}}{{#if: {{{5|}}}|<nowiki></nowiki>
        -->{{#if:{{{icon|}}}|
{{!}} {{{6|}}}|}}{{#if: {{{7|}}}|<nowiki></nowiki>
<!--        --><td class="icon-cell"> {{#if: {{{4|}}}| [[File:{{{4|}}}|{{{iconsize|75x75px}}}]] </td>|}}<!--
{{!}} {{{8|}}}|}}{{#if: {{{9|}}}|<nowiki></nowiki>
            -->|<!--
{{!}} {{{10|}}}|}}{{#if: {{{11|}}}|<nowiki></nowiki>
    -->}}<!--
{{!}} {{{12|}}}|}}{{#if: {{{13|}}}|<nowiki></nowiki>
 
{{!}} {{{14|}}}|}}
If there's a link defined, create it by definition, otherwise from predefined pre/postfixes
}}<noinclude>
        -->{{#if: {{{1|}}}|<nowiki></nowiki>
<!--        --><td> {{#if:{{{linkoverride|}}}<!--
                -->|{{{linkoverride|}}}<!--
                -->|{{linkappend|pre={{#if:{{{prefix|}}}|{{{prefix|}}}&nbsp;|}}|post={{#if:{{{postterm|}}}|&nbsp;{{{postterm|}}}|}}{{#if:{{{postfix|}}}|&nbsp;({{{postfix|}}})|}}|lc={{{attribute|}}}|{{{2|}}}}}<!--
            -->}}</td><!--
        -->}}<!--
If there wasn't an icon, place next entry
        -->{{#if:{{{icon|}}}<!--
    -->|<!--
-->|<td>{{#if: {{{3|}}}|<nowiki></nowiki>
<!--            -->{{#if: {{{4|}}}| {{{4|}}} |}}<!--
                -->|<!--
        -->}}</td><!--
    -->}}<!--
        -->{{#if: {{{5|}}}|<nowiki></nowiki>
<!--        --><td> {{{6|}}}</td><!--
            -->|<!--
    -->}}<!--
        -->{{#if: {{{7|}}}|<nowiki></nowiki>
<!--        --><td> {{{8|}}}</td><!--
            -->|<!--
    -->}}<!--
        -->{{#if: {{{9|}}}|<nowiki></nowiki>
<!--        --><td> {{{10|}}}</td><!--
            -->|<!--
    -->}}<!--
        -->{{#if: {{{11|}}}|<nowiki></nowiki>
<!--        --><td> {{{12|}}}</td><!--
            -->|<!--
    -->}}<!--
        -->{{#if: {{{13|}}}|<nowiki></nowiki>
<!--        --><td> {{{14|}}}</td><!--
            -->|<!--
    -->}}<!--
--></tr>}}</includeonly><noinclude>
; Parameters
; Parameters
* type: table:
* type: table:
** tableclass: If this has a value, the table has the indicated styling class applied (for example: "table sortable overlay"). If no tablestyle is specified, the default is "wikitable".
** suppresscategory: If this has a value, no category tag is added.
** suppresscategory: If this has a value, no category tag is added.
** allowselflink: If this does not have a value, a class is added to the table preventing a link to the same article from becoming bold.
** allowselflink: If this does not have a value, a class is added to the table preventing a link to the same article from becoming bold.
** content: The rows for the table.
** content: The rows for the table.
** attribute: If it has a value, treats the first provided value as an attribute name (i.e. fully capitalized).
** attribute: If it has a value, treats the first provided value as an attribute name (i.e. fully capitalized).
** postfix: If provided, a postfix is added as a clarifying term in parenthesis in the link title
** icon: If provided, treats the second provided value as an icon. Placing it ahead of the first entry and injecting a predefined image syntax around it.
** iconsize: The size of the displayed icon, if "icon" is provided. If no iconsize is specified, the default is "75x75px".
** prefix: If provided, a prefix is added as a clarifying term in in the link url.
** postterm: If provided, serves as a postfix before the clarifying term in parenthesis in the link url.
** postfix: If provided, a postfix is added as a clarifying term in parenthesis in the link url.
** category: The category to add the article to (if not suppressed).
** category: The category to add the article to (if not suppressed).
** 1...n
** 1...n
Line 37: Line 77:
* type: row:
* type: row:
** named parameters as defined by the table structure
** named parameters as defined by the table structure
; Implementations
Implementations of this template are automatically listed here: [//{{SERVERNAME}}/w/index.php?title=Special:WhatLinksHere&target=Template:Collection+table&namespace=10 //{{SERVERNAME}}/w/index.php?title=Special:WhatLinksHere&target=Template:Collection+table&namespace=10]


; Usage
; Usage
Create an intermediate template with the following approximate structure:
Create an intermediate template with the following approximate structure. This example will be called "template:panel attributes":
<pre><nowiki>{{collection table
<pre><nowiki>
{{collection table<!--
Fixed pass-through parameters-->
| type={{{type|table}}}
| type={{{type|table}}}
| suppresscategory={{{suppresscategory|&lt;noinclude&gt;template&lt;/noinclude&gt;}}}
| suppresscategory={{{suppresscategory|&lt;noinclude&gt;template&lt;/noinclude&gt;}}}
| allowselflink={{{allowselflink}}}
| allowselflink={{{allowselflink|}}}
| content={{{1|}}}
| linkoverride={{{linkoverride|}}}
| content={{{1|}}}<!--
 
Configurable attributes-->
| attribute=true
| attribute=true
| postfix=Panel Attribute
| postfix=Panel Attribute
| category=Panel Attributes
| category=Panel Attributes<!--
 
Actual content structure-->
| Attribute name | {{{attribute|}}}<!--
| Attribute name | {{{attribute|}}}<!--
-->| Unit | {{{unit|}}}<!--
-->| Unit | {{{unit|}}}<!--
Line 61: Line 111:


The following parameters must be used when using the final template:
The following parameters must be used when using the final template:
* suppresscategory: on the overview page
* allowselflink: on the overview page
* 1: the content for the table
* type: table to specify the table is being defined
* type: table to specify the table is being defined
** suppresscategory: on the overview page
** allowselflink: on the overview page
** 1: the content for the table
* type: row to specify the row is being defined
* type: row to specify the row is being defined
* attributes defined in the intermediate template for content of rows
** linkoverride: if specified, rather than the automatically generated link for the first entry, use this parameter verbatim
** attributes defined in the intermediate template for content of rows


On the overview page, structure the template as follows to create a seamless overview:
On the overview page, structure the template as follows to create a seamless overview:
Line 75: Line 126:


On the specific page, structure the template as follows to allow for inclusion onto an overview page:
On the specific page, structure the template as follows to allow for inclusion onto an overview page:
<pre><nowiki>{{panel attributes
<pre><nowiki>{{panel attributes|
| &lt;onlyinclude&gt;
&lt;onlyinclude&gt;{{panel attributes|type=row
{{panel attributes|type=row|attribute=VISIBLE|unit={{boolean}}|description=Whether you can see it}} &lt;/onlyinclude&gt;
  |attribute=VISIBLE
  |unit={{boolean}}
  |description=Whether you can see it
}} &lt;/onlyinclude&gt;
}}</nowiki></pre>
}}</nowiki></pre>
</noinclude>
</noinclude>

Latest revision as of 09:19, 18 February 2022

Parameters
  • type: table:
    • tableclass: If this has a value, the table has the indicated styling class applied (for example: "table sortable overlay"). If no tablestyle is specified, the default is "wikitable".
    • suppresscategory: If this has a value, no category tag is added.
    • allowselflink: If this does not have a value, a class is added to the table preventing a link to the same article from becoming bold.
    • content: The rows for the table.
    • attribute: If it has a value, treats the first provided value as an attribute name (i.e. fully capitalized).
    • icon: If provided, treats the second provided value as an icon. Placing it ahead of the first entry and injecting a predefined image syntax around it.
    • iconsize: The size of the displayed icon, if "icon" is provided. If no iconsize is specified, the default is "75x75px".
    • prefix: If provided, a prefix is added as a clarifying term in in the link url.
    • postterm: If provided, serves as a postfix before the clarifying term in parenthesis in the link url.
    • postfix: If provided, a postfix is added as a clarifying term in parenthesis in the link url.
    • category: The category to add the article to (if not suppressed).
    • 1...n
  • type: row:
    • named parameters as defined by the table structure
Implementations

Implementations of this template are automatically listed here: //support.tygron.com/w/index.php?title=Special:WhatLinksHere&target=Template:Collection+table&namespace=10

Usage

Create an intermediate template with the following approximate structure. This example will be called "template:panel attributes":

{{collection table<!--
Fixed pass-through parameters-->
| type={{{type|table}}}
| suppresscategory={{{suppresscategory|<noinclude>template</noinclude>}}}
| allowselflink={{{allowselflink|}}}
| linkoverride={{{linkoverride|}}}
| content={{{1|}}}<!--

Configurable attributes-->
| attribute=true
| postfix=Panel Attribute
| category=Panel Attributes<!--

Actual content structure-->
| Attribute name | {{{attribute|}}}<!--
-->| Unit | {{{unit|}}}<!--
-->| Description | {{{description|}}}<!--
-->}}

Set the category to the category the individual entries need to be collected under (plural). Set the postfix to the clarifying term in the parenthesis in the title (singular). The remainder of the attributes come in pairs: The name in the header, and the parameter used in the rows.

The first value is always a link to a specific article.

Category is automatically included on the page that template is used on (unless supressed) if a category is configured. The first value in the table is automaticallly postfixed if a postfix is configured.

The following parameters must be used when using the final template:

  • type: table to specify the table is being defined
    • suppresscategory: on the overview page
    • allowselflink: on the overview page
    • 1: the content for the table
  • type: row to specify the row is being defined
    • linkoverride: if specified, rather than the automatically generated link for the first entry, use this parameter verbatim
    • attributes defined in the intermediate template for content of rows

On the overview page, structure the template as follows to create a seamless overview:

{{panel attributes|suppresscategory=true|allowselflinks=true|
{{:Visible (Panel Attribute)}}
}}

On the specific page, structure the template as follows to allow for inclusion onto an overview page:

{{panel attributes|
<onlyinclude>{{panel attributes|type=row
  |attribute=VISIBLE
  |unit={{boolean}}
  |description=Whether you can see it
}} </onlyinclude>
}}