Help:Templates: Difference between revisions

From Unofficial Homecoming Wiki
Jump to navigation Jump to search
imported>Sekoia
(New page: == Overview == '''Templates''' are a very powerful feature of the wiki that are analogous to subroutines in computer programming languages. Here are some resources that may be helpful in ...)
 
imported>Blondeshell
 
(9 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{TOCright}}
== Overview ==
== Overview ==


'''Templates''' are a very powerful feature of the wiki that are analogous to subroutines in computer programming languages. Here are some resources that may be helpful in learning to use them.
Standardized formatting across Paragon Wiki is maintained by the use of sample markup language and templates.
 
:''Main article'': [[Help:Contents]]
 
 
==Sample markup language==
 
Sample markup language is the use of a simple cut-and-paste of formatting code from one page into another and then adding or changing the content to fit the article. This can be done from a blank sample form or by cutting-and-pasting from an existing article.
 
An example of a blank form is that used for creating a new page for a contact which can be found here: [[Help:Contact_Template | Sample contact form]].
 
 
==Templates==
 
Templates are specialized pages that define a specific type of formatting style. Templates are created in the '''Template:''' [[wikipedia:namespace|namespace]]. Editors can then '''''call''''' that template into a page and apply it to their text to make that text take on that pre-defined formatting. Templates are '''''called''''' with the double curly brackets <nowiki> {{ }} </nowiki>.
 
For example, on Paragon Wiki there are templates for colored fonts. The template for making text red is <nowiki> {{red|SampleText}} </nowiki> which would appear on a page as {{red|SampleText}}.
 
Templates can also accept parameters, details which change from use to use.  An example of this is the [[Template:Power|Power Template]].  This simple template takes four parameters, and formats the information into the power entry which is used on most of the [[:Category:Enemies|enemy]] pages.  Since the format is kept in one place, if, in the future, a new format is decided upon, rather than go through all the enemy pages and redoing their powers, one change to the [[Template:Power|power template]] will make those changes in the entire wiki.
 
== Available templates and sample markup language==
 
=== Samples ===
 
* [[:Help:Contact Template|Contact Template]] to use when creating a new article about a contact
* [[:Help:Preloaded Images|Preloaded Images]] such as powers icons and such.  Before uploading an image, please read.
 
=== Templates ===
 
* [[:Help:Useful Templates|Useful Templates]] can help formatting various articles.
* [[:Category:Mission Templates|Mission Templates]] are templates covering common missions, such as story arcs, zone contact intros (such as David Wincott), and security chief intros.  These missions can apply to multiple contacts.  They have been templated for easy insertion and to avoid errors in duplication.
* [[:Category:Contact Templates|Contact Templates]] are templates that can be used to duplicate new contact introductions among contacts.
* [[:Category:Userbox Templates|Userboxes]] are templates that can be placed on your userpage to indicate your interests.
 
 
== Creating and Editing Templates ==
 
Since a change in a Template can possibly affect hundreds of pages, this means that Templates should be edited with great care. Templates are usually created with a mixture of html and wikipedia markup language. Editors who are unsure how to create a template or need help editing one should consult with other editors and administrators on the forums in the [http://www.cohtitan.com/forum/index.php/board,68.0.html Formatting and Standardization Forum].
 
Editors can see how a Template is formatted by going to the '''Template:TemplateName''' page. The creator of the Template may have created an explanation of how the Template is coded; if not, then click on the edit tab to see the formatting language.
 
* [http://meta.wikimedia.org/wiki/Template Wikimedia's help page on templates]
* [http://www.mediawiki.org/wiki/Help:ParserFunctions Functions used in template math or logic expressions]
* [http://www.mediawiki.org/wiki/Help:Magic_words Special variable, i.e. ''magic words'' used in templates or articles ]
 
== Categorizing Templates ==
 
Templates used on Paragon Wiki are categorized in a hierarchy tree beginning at [[:Category: Templates]]
 
== Template documentation ==
 
:''See Wikipedia article'': [[wikipedia:wikipedia:Template documentation|Template documentation]]
 
=== Simple Template documentation ===
 
A Template can simply be the code or text that is called by its corresponding Template command. In such cases, when a Template page is viewed, it may appear to be blank or have some unprocessed parts of the coding appear on the page. Thus, in order to see what the code is, how it's constructed, and what parameters it takes; it must be viewed from the edit page of that Template.
 
The Template author can help other editors by including some documentation, that is, an explanation of the Template and how it's meant to be used and what parameters it takes. In order for such explanations to appear on the Template page without being called when the Template is used in target pages, the author will put the documentation between the '''<nowiki><noinclude> </noinclude></nowiki>''' tags. Here's an example of the code to be appended to the Template coding:
 
{{green|''[--last line of your template code--]''}}<nowiki><noinclude>
<!-- PLEASE ADD EXPLANATORY TEXT AND CATEGORIES HERE, THANKS -->
== Usage ==
 
== Examples ==
 
[[Category:Category Name]]
</noinclude></nowiki>
 
Note that the ''noinclude'' tag must follow the last character of the Template coding so that extraneous carriage returns or spaces are not called by the Template command.
 
This explanatory text will then appear on the Template page but will not be included on the target page in which the Template is used. In these cases, the author should add Category tags in between the ''noinclude'' tags also; for example, [[[[:Category: Mission Templates]]]].
 
=== Separate Template documentation page ===
 
However, if the documentation for a Template is lengthy, complicated, used for several templates, or expected to be edited by others, then it is recommended that a separated documentation page be created for that Template in the /doc [[Wikipedia:Wikipedia:Subpages|subpage]] of that Template. So, for example, the Template [[Template:ArcAward]] has the documentation subpage [[Template:ArcAward/doc]].
 
In the Template page itself, this code is dropped in to automatically point to and [[wikipedia:Transclusion|transclude]] the contents of the document page:
 
{{green|''[--last line of your template code--]''}}<nowiki><noinclude>
{{Documentation}}
<!-- PLEASE ADD THIS TEMPLATE'S CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS -->
&lt;/noinclude></nowiki>
 
Note that the ''noinclude'' tag must follow the last character of the Template coding so that extraneous carriage returns or spaces are not called by the Template command.
 
Then in the Template/doc page, this code is dropped in.
 
<nowiki>{{Documentation subpage}}
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
 
== Usage ==
 
== Examples ==
 
<includeonly><!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
[[Category:Category Name]]
</includeonly></nowiki>
 
Category links that are placed between the ''includeonly'' tags on the documentation page become attached to the main Template page. If categories on a documentation page are listed outside the ''includeonly'' tags, they are categorizing the documentation page, not the Template. {{tl|Documentation subpage}} automatically categorizes documentation pages, so there is never a need to list a category outside the ''includeonly'' tags.
 
Categories should not be listed in the main Template if using a /doc page. However, advanced usage of the Template call may place a page using that Template into a category; this is acceptable. For example, {{tl|bug}} creates a bug note display on the page it is used on, and automatically places that page in the [[[[:Category:Bugs]]]] list.


* [[m:Help:Template|Help:Template at Meta-Wiki]]
:''See also'': [[:Category:Template Documentation|Documentation creation templates at Paragon Wiki]]
* [[m:Help:ParserFunctions|Help:ParserFunctions at Meta-Wiki]]

Latest revision as of 20:49, 21 October 2017

Overview

Standardized formatting across Paragon Wiki is maintained by the use of sample markup language and templates.

Main article: Help:Contents


Sample markup language

Sample markup language is the use of a simple cut-and-paste of formatting code from one page into another and then adding or changing the content to fit the article. This can be done from a blank sample form or by cutting-and-pasting from an existing article.

An example of a blank form is that used for creating a new page for a contact which can be found here: Sample contact form.


Templates

Templates are specialized pages that define a specific type of formatting style. Templates are created in the Template: namespace. Editors can then call that template into a page and apply it to their text to make that text take on that pre-defined formatting. Templates are called with the double curly brackets {{ }} .

For example, on Paragon Wiki there are templates for colored fonts. The template for making text red is {{red|SampleText}} which would appear on a page as SampleText.

Templates can also accept parameters, details which change from use to use. An example of this is the Power Template. This simple template takes four parameters, and formats the information into the power entry which is used on most of the enemy pages. Since the format is kept in one place, if, in the future, a new format is decided upon, rather than go through all the enemy pages and redoing their powers, one change to the power template will make those changes in the entire wiki.

Available templates and sample markup language

Samples

Templates

  • Useful Templates can help formatting various articles.
  • Mission Templates are templates covering common missions, such as story arcs, zone contact intros (such as David Wincott), and security chief intros. These missions can apply to multiple contacts. They have been templated for easy insertion and to avoid errors in duplication.
  • Contact Templates are templates that can be used to duplicate new contact introductions among contacts.
  • Userboxes are templates that can be placed on your userpage to indicate your interests.


Creating and Editing Templates

Since a change in a Template can possibly affect hundreds of pages, this means that Templates should be edited with great care. Templates are usually created with a mixture of html and wikipedia markup language. Editors who are unsure how to create a template or need help editing one should consult with other editors and administrators on the forums in the Formatting and Standardization Forum.

Editors can see how a Template is formatted by going to the Template:TemplateName page. The creator of the Template may have created an explanation of how the Template is coded; if not, then click on the edit tab to see the formatting language.

Categorizing Templates

Templates used on Paragon Wiki are categorized in a hierarchy tree beginning at Category: Templates

Template documentation

See Wikipedia article: Template documentation

Simple Template documentation

A Template can simply be the code or text that is called by its corresponding Template command. In such cases, when a Template page is viewed, it may appear to be blank or have some unprocessed parts of the coding appear on the page. Thus, in order to see what the code is, how it's constructed, and what parameters it takes; it must be viewed from the edit page of that Template.

The Template author can help other editors by including some documentation, that is, an explanation of the Template and how it's meant to be used and what parameters it takes. In order for such explanations to appear on the Template page without being called when the Template is used in target pages, the author will put the documentation between the <noinclude> </noinclude> tags. Here's an example of the code to be appended to the Template coding:

[--last line of your template code--]<noinclude>
<!-- PLEASE ADD EXPLANATORY TEXT AND CATEGORIES HERE, THANKS -->
== Usage ==

== Examples ==

[[Category:Category Name]]
</noinclude>

Note that the noinclude tag must follow the last character of the Template coding so that extraneous carriage returns or spaces are not called by the Template command.

This explanatory text will then appear on the Template page but will not be included on the target page in which the Template is used. In these cases, the author should add Category tags in between the noinclude tags also; for example, [[Category: Mission Templates]].

Separate Template documentation page

However, if the documentation for a Template is lengthy, complicated, used for several templates, or expected to be edited by others, then it is recommended that a separated documentation page be created for that Template in the /doc subpage of that Template. So, for example, the Template Template:ArcAward has the documentation subpage Template:ArcAward/doc.

In the Template page itself, this code is dropped in to automatically point to and transclude the contents of the document page:

[--last line of your template code--]<noinclude>
{{Documentation}}
<!-- PLEASE ADD THIS TEMPLATE'S CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS -->
</noinclude>

Note that the noinclude tag must follow the last character of the Template coding so that extraneous carriage returns or spaces are not called by the Template command.

Then in the Template/doc page, this code is dropped in.

{{Documentation subpage}}
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->

== Usage ==

== Examples ==

<includeonly><!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
[[Category:Category Name]]
</includeonly>

Category links that are placed between the includeonly tags on the documentation page become attached to the main Template page. If categories on a documentation page are listed outside the includeonly tags, they are categorizing the documentation page, not the Template. {{Documentation subpage}} automatically categorizes documentation pages, so there is never a need to list a category outside the includeonly tags.

Categories should not be listed in the main Template if using a /doc page. However, advanced usage of the Template call may place a page using that Template into a category; this is acceptable. For example, {{bug}} creates a bug note display on the page it is used on, and automatically places that page in the [[Category:Bugs]] list.

See also: Documentation creation templates at Paragon Wiki