Help:Template

From ParabolaWiki
Jump to: navigation, search
Summary
A basic introduction to using and creating templates.

A template is a piece of predefined wikitext that can be inserted into an article. Templates are primarily used to aid in formatting content.

Visit Category:Template for a listing of all available templates.

1 Usage

Templates are used by adding the following markup to an article:

{{Template Name}}

Most templates take additional arguments, such as Template:Note:

{{Note|This text should be noted.}}

which produces:

Note: This text should be noted.

Some templates use named parameters, such as Template:Hc:

{{Hc|head=/etc/rc.local|output=exit 0}}

which produces:

/etc/rc.local
exit 0

The general format is:

{{Template Name|param1|param2|...|paramN}}

See each templates' page for specific usage instructions.

1.1 Escape template-breaking characters

There are some characters that, if used inside a template, will break its output: most frequently this happens with = (the equal sign) and | (the pipe sign).

The easiest and most effective solutions to this problem are:

  • Using numbered parameters like in:
Note: This method is effective only with = and is very useful with query strings in URLs, e.g. http://parabolagnulinux.org/?foo=bar
{{Note|1=This method is effective only with = and is very useful with query strings in URLs, e.g. http://parabolagnulinux.org/?foo=bar}}
  • Replacing the offending characters with their respective HTML entities, like in:
Note: {{{1}}}
{{Note|This method supports all kinds of characters, including =, | and }} ( http://parabolagnulinux.org/?foo=bar )}}
  • Enclosing the offending characters in <nowiki> tags, like in:
Note: This method displays all kinds of characters ( = | }} ), but completely prevents the wiki engine from processing text markup or markdown, like links ( http://parabolagnulinux.org/ ) and other templates ( {{ic|foo}} ).
{{Note|<nowiki>This method displays all kinds of characters ( = | }} ), but completely prevents the wiki engine from processing text markup or markdown, like links ( http://parabolagnulinux.org/ ) and other templates ( {{ic|foo}} ).</nowiki>}}

2 Creation

{{Note|

  • Only create relevant templates. If you are attempting to create a very specialized template that will likely only ever be used on a few articles, please do not bother, avoid cluttering up the templates namespace.
  • Only create concise templates. Remember: Keep It Simple, Stupid!

The following template should be used when creating new templates to ensure that the template is a member of Category:Template and to facilitate usage and editing:

<noinclude>{{Template}}

'''A brief description of the template'''

====Usage====

{{ic|<nowiki>{{Template Name|param1|param2|...|paramN}}</nowiki>}}

====Example====

{{Template Name|param1|param2|...|paramN}}</noinclude><includeonly>Template code goes here...</includeonly>

To begin the creation process, simply visit Template:Template Name (substituting Template Name with the desired name of the template), edit, and add the relevant wikitext.

3 See also