Pikipedia:Template guidelines: Difference between revisions

m
Protected "Pikipedia:Template guidelines" ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only administrators] (indefinite))
No edit summary
m (Protected "Pikipedia:Template guidelines" ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only administrators] (indefinite)))
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
[[:Category:Templates|Templates]] are special pages that are inserted into normal articles, normally with content that can change dynamically. Templates on Pikipedia should adhere to the following policy.
{{shortcut|P:TEMPLATE}}
[[:Category:Templates|Templates]] are special pages that are inserted into normal articles, normally with content that can change dynamically. Templates on Pikipedia should adhere to the following guidelines.


==Documentation==
==Documentation==
Line 10: Line 11:
If the template has any parameters, this section should detail them using a table. The following is how the table should look like:
If the template has any parameters, this section should detail them using a table. The following is how the table should look like:


{| class = "wikitable"
{| class="wikitable"
! Parameter || Mandatory || Default || Purpose || Detailed description
! Parameter || Mandatory || Default || Purpose || Detailed description
|-
|-
Line 25: Line 26:
When creating the parameter documentation, the following code can be copy-pasted and edited accordingly:
When creating the parameter documentation, the following code can be copy-pasted and edited accordingly:
<pre>
<pre>
{| class = "wikitable"
{| class="wikitable"
! Parameter || Mandatory || Default || Purpose || Detailed description
! Parameter || Mandatory || Default || Purpose || Detailed description
|-
|-
Line 39: Line 40:
</pre>
</pre>


===Template===
===Skeleton===
For templates that have parameters, a template template section should be created. This is simply a snippet of MediaWiki markup surrounded by <code><nowiki><pre></nowiki></code> tags, so that editors who want to add the template to articles can just copy-paste the snippet and replace the values with their own. Value placeholders should start with &lt; and end with &gt;. Example of a template template:
For templates that have parameters, a template template (a template skeleton) section should be created. This is simply a snippet of MediaWiki markup surrounded by <code><nowiki><pre></nowiki></code> tags, so that editors who want to add the template to articles can just copy-paste the snippet and replace the values with their own. Value placeholders should start with &lt; and end with &gt;. Example of a template skeleton:
<pre>
<pre>
{{example | <parameter 1> | <parameter 2>}}
{{example | <parameter 1> | <parameter 2>}}
Line 48: Line 49:
In cases of dynamic and complex templates, it may be better to have a section with examples, that shows some of the template's behavior when presented with different parameters. The examples should be displayed inside a table like so:
In cases of dynamic and complex templates, it may be better to have a section with examples, that shows some of the template's behavior when presented with different parameters. The examples should be displayed inside a table like so:


{| class = "wikitable"
{| class="wikitable"
! Code || Result
! Code || Result
|-
|-
Line 58: Line 59:
* Result: What the template looks like.
* Result: What the template looks like.


Be careful with calling the template itself to provide the Result in cases where the template has side effects, such as adding a category to any page that includes it.
Be careful with calling the template itself to provide the result, in cases where the template has side effects, such as adding a category to any page that includes it.


Like before, the following template can be copy-pasted by editors to create an example table:
Like before, the following code can be copy-pasted by editors to help create an example table:


<pre>
<pre>
{| class = "wikitable"
{| class="wikitable"
! Code || Result
! Code || Result
|-
|-
Line 71: Line 72:
</pre>
</pre>


{{policy}}
{{guidelines}}
[[Category:Guidelines]]