Template
TemplateStyles
From Dogcraft Wiki
mNo edit summary |
(proper documentation + templatedata) |
||
Line 1: | Line 1: | ||
{{Sidebar | <includeonly>{{Sidebar | ||
|content1={{Notice | |content1={{Notice | ||
|icon=fa-solid fa-file-code | |icon=fa-solid fa-file-code | ||
Line 13: | Line 13: | ||
|bodystyle=padding:0;border-spacing:0;width:auto;max-width:22em;background-color:#e9edef; | |bodystyle=padding:0;border-spacing:0;width:auto;max-width:22em;background-color:#e9edef; | ||
|navbar=none | |navbar=none | ||
}}[[Category:Templates using TemplateStyles]]<noinclude> | }}[[Category:Templates using TemplateStyles]]</includeonly><noinclude> | ||
==TemplateStyles notice== | |||
This template is used to show that templates use [[mw:Extension:TemplateStyles|TemplateStyles]]. It is meant to be placed at the top of the template's documentation and show which CSS styelsheet page(s) it uses. It and automatically adds the template to [[:Category:Templates using TemplateStyles]]. | |||
{{TemplateStyles|TemplateStyles/styles.css|, [[Template: | This concept is based on Wikipedia's [[wp:Template:TemplateStyles|<pre><nowiki>{{Uses TemplateStyles}}</nowiki></pre>]] template, but is implemented differently. (Using a combination of the [[Sidebar|<pre><nowiki>{{Sidebar}}</nowiki></pre>]] and [[Notice|<pre><nowiki>{{Notice}}</nowiki></pre>]] templates.) | ||
==Example(s)== | |||
===No parameters=== | |||
When no parameters are set, the template will use "Template:<nowiki>{{PAGENAME}}</nowiki>/styles.css" as the CSS page shown. (<nowiki>{{PAGENAME}}</nowiki> being the name of the actual template.) This should be enough in most cases. | |||
<pre><nowiki>{{TemplateStyles}}</nowiki></pre> generates: <pre><nowiki>{{TemplateStyles}}</nowiki></pre> | |||
===Single parameter=== | |||
The name of the CSS page to show can be set using the template's first (unnamed) parameter. This is useful if the stylesheet page is not called "styles.css". The whole title must be set except for the "Template:" namespace name. | |||
<pre><nowiki>{{TemplateStyles|TemplateStyles/dark.css}}</nowiki></pre> generates: <pre><nowiki>{{TemplateStyles|TemplateStyles/dark.css}}</nowiki></pre> | |||
===Two parameters=== | |||
A second parameter is available to set any further stylesheets in the case of templates using more then one. This parameter is completely free-form, requiring entering everything manually including the link itself and commas. (An example can be seen bellow) | |||
<pre><nowiki>{{TemplateStyles|TemplateStyles/styles.css|, [[Template:TemplateStyles/dark.css|TemplateStyles/dark.css]] and [[Template:TemplateStyles/dark.css|TemplateStyles/mobile.css]]}}</nowiki></pre> generates: <pre><nowiki>{{TemplateStyles||, [[Template:TemplateStyles/dark.css|TemplateStyles/dark.css]] and [[Template:TemplateStyles/dark.css|TemplateStyles/mobile.css]]}}</nowiki></pre> | |||
==Template data== | |||
<templatedata> | |||
{ | |||
"params": { | |||
"1": { | |||
"label": "CSS stylesheet", | |||
"description": "The full name of the CSS stylesheet this template uses, excluding the \"Template:\" namespace name at the start. This parameter is optional.", | |||
"example": "Pagetabs/styles.css", | |||
"type": "wiki-page-name", | |||
"suggested": true | |||
}, | |||
"2": { | |||
"label": "Further CSS Stylesheets", | |||
"description": "Completely free-form parameter for specifying further CSS stylesheets for templates using more then one. ", | |||
"example": ", [[Template:Pagetabs/dark.css]] and [[Template:Pagetabs/mobile.css]]", | |||
"type": "string", | |||
"suggested": true | |||
} | |||
}, | |||
"format": "inline", | |||
"description": "Used to show that a template uses TemplateStyles, and link the CSS page(s) used." | |||
} | |||
</templatedata> | |||
</noinclude> |
Revision as of 22:41, 11 July 2022
TemplateStyles notice
This template is used to show that templates use TemplateStyles. It is meant to be placed at the top of the template's documentation and show which CSS styelsheet page(s) it uses. It and automatically adds the template to Category:Templates using TemplateStyles.
This concept is based on Wikipedia's
{{Uses TemplateStyles}}
template, but is implemented differently. (Using a combination of the
{{Sidebar}}
and
{{Notice}}
templates.)
Example(s)
No parameters
When no parameters are set, the template will use "Template:{{PAGENAME}}/styles.css" as the CSS page shown. ({{PAGENAME}} being the name of the actual template.) This should be enough in most cases.
{{TemplateStyles}}
generates:
{{TemplateStyles}}
Single parameter
The name of the CSS page to show can be set using the template's first (unnamed) parameter. This is useful if the stylesheet page is not called "styles.css". The whole title must be set except for the "Template:" namespace name.
{{TemplateStyles|TemplateStyles/dark.css}}
generates:
{{TemplateStyles|TemplateStyles/dark.css}}
Two parameters
A second parameter is available to set any further stylesheets in the case of templates using more then one. This parameter is completely free-form, requiring entering everything manually including the link itself and commas. (An example can be seen bellow)
{{TemplateStyles|TemplateStyles/styles.css|, [[Template:TemplateStyles/dark.css|TemplateStyles/dark.css]] and [[Template:TemplateStyles/dark.css|TemplateStyles/mobile.css]]}}
generates:
{{TemplateStyles||, [[Template:TemplateStyles/dark.css|TemplateStyles/dark.css]] and [[Template:TemplateStyles/dark.css|TemplateStyles/mobile.css]]}}
Template data
Used to show that a template uses TemplateStyles, and link the CSS page(s) used.
Parameter | Description | Type | Status | |
---|---|---|---|---|
CSS stylesheet | 1 | The full name of the CSS stylesheet this template uses, excluding the "Template:" namespace name at the start. This parameter is optional.
| Page name | suggested |
Further CSS Stylesheets | 2 | Completely free-form parameter for specifying further CSS stylesheets for templates using more then one.
| String | suggested |