Template:Usage

From Zelda Dungeon Wiki
Jump to navigation Jump to search
Want an adless experience? Log in or Create an account.

{{Usage}}

Purpose

In an effort to maintain consistent, complete, concise, and coherent documentation for [[Templates]], each template page includes a Usage section, using this template to demonstrate how to properly utilize that template according to its Purpose.

Usage

In its simplest form, this template can be displayed in-line or on its own line.

{{Usage| parameter1 | parameter2 | ... | parameter9 }}

Thus, {{Usage|quality|name|description}}

becomes {{Usage| quality | name | description }}

To specify a subpage of the template, pass an argument to the named parameter "sub".

{{Usage| sub= | param1 | param2 | ... }}

Parameters

It's often useful to define the parameters for a template. Using {{Usage/Param}}, one can describe each parameter and even specify if it's optional and, if so, its default value.

{{Usage/Param| parameter | description | optional | default }}

  • parameter — A name for the parameter. If it isn't a named parameter, this is arbitrary.
  • description — A description of the named parameter.
  • optional — If this argument is included, the parameter will be marked "Optional." (Optional.)
  • default — Use this parameter only if "optional" is also specified. This will display what value is used if the parameter isn't given an argument. (Optional.)

Blocks

For templates with a large number of parameters, or whose arguments are expected to be lengthy, it's best to break them up into several lines. This is especially used for templates that use named parameters so that the undefined ones can be omitted. This also makes it easier to copy, paste, and fill out values. In order to format it consistently, pass the parameters into {{Usage/Block}}. After the parameter descriptions, {{Clear}} must always be added to prevent subsequent text from being pushed to the right.

{{Usage/Block| param1 | param2 | ... | param20 }}

  • param1...param20 — Each named parameter, up to 20.
ExampleResult
{{Usage/Block|name|rank|serial}}
{{Usage/Param|name|description}}
{{Usage/Param|rank|description}}
{{Usage/Param|serial|description}}
{{Clear}}
{{Usage
| name = 
| rank = 
| serial = 
}}


  • name — description
  • rank — description
  • serial — description

As with the basic use of {{Usage}}, an optional "sub" parameter can be set to specify a subpage. Also, one anonymous parameter can be added by passing a value to "anon", like so:

ExampleResult
{{Usage/Block|sub=Deceased|anon=cause
|date|medals|family}}
{{Usage/Param|cause|description}}
{{Usage/Param|date|description}}
{{Usage/Param|medals|description}}
{{Usage/Param|family|description}}
{{Clear}}
{{Usage/Deceased|cause
| date = 
| medals = 
| family = 
}}


  • cause — description
  • date — description
  • medals — description
  • family — description

Composites

Some templates make use of subtemplates to effect more modularity. To demonstrate the use of several templates working together, simply place them in a preformatted box floated to the left, with a description either to the right of or below the box.

ExampleResult
{{Float|left|<pre>
{{Several}}
{{Templates}}
</pre>}}
Description
{{Clear|left}}
{{Several}}
{{Templates}}

Description

Examples

The best way to demonstrate a template may depend on the template itself. For simple one-liners, this is often enough:

<code><nowiki>{{Template}}</nowiki></code> → {{Template}}

Other times it may be necessary to lay out the code and the result in a table. To simplify this, use {{Usage/Example}} and {{Usage/Result}}. Start with {{Usage/Example}}, then wrap the code in <pre> tags. Finally, copy the code - without the <pre> tags - as an argument to {{Usage/Result}}.

{{Usage/Example}}
<pre>{{TemplateCode}}</pre>
{{Usage/Result|
{{TemplateCode}}
}}

Note that {{Usage/Example}} is used by itself with the example code following it, while {{Usage/Result}} takes the result code as an argument.