Code Geass Wiki:Formatting/Templates

Templates help separate content from formatting. When applied properly, they can greatly ease the work of editing or creating articles.

Using Templates
The following examples use two fictional template named Template:Foo and Template:Bar. Foo has three named parameters, Bar has two unnamed parameters and two optional named parameters.

Note that when using unnamed parameters without equal signs, all whitespaces before and after the value are passed to the template which can generate unexpected output. When using equal signs all whitespaces are trimmed before they are evaluated by the template.

Multiline Syntax
When using complex templates which generates a block or table of information (such as infobox templates) or templates which require a lot of parameters, it is recommended to use multiline syntax. Readability is very much improved when the numerous parameters of a complex template is spaced out over several lines.

When using unnamed parameters (in template code used with numbers, for example ) within complex templates, you can refer to them by using the number as parameter name:

Inline Syntax
When using templates which generate replacement text and are meant to be used within a block of text, or templates that have only a few parameters, inline syntax is recommended. Templates such as Gr and tl are good examples of such templates.

Creating Templates
When creating templates, use the following conventions as guidelines:
 * As parameter names are case-sensitive, specify parameters in lowercase.
 * Create templates in the  namespace (unless your template is for personal use only, in which case, save it in your own   namespace)
 * Categorize templates appropriately (see Category:Templates). Make sure to insert the category tags within  tags (see example below).
 * Provide a description and usage guidelines for your template, including explanations for parameters. Examples are encouraged to illustrate usage (this should go into the  block as well)

The following is a detailed example of how a template page should be formatted: ==Description== A short description about the template, followed by a general example with all parameters used ===Parameters=== ; bar1 : Description about parameter "bar1" ; bar2 : Optional. Description about parameter "bar2" (default:  ; bar3 : Optional. Description about parameter "bar3". Possible values: :*   for doing this :*   for doing that ==Examples== ==See Also== * Template formatting guide