Difference between revisions of "UniWiki:Templates"
(→Creating and editing templates: Added section detailing template documentation.) |
(Removed category: Wiki Contributions.) |
||
Line 150: | Line 150: | ||
[[Category:Wiki Information]] | [[Category:Wiki Information]] | ||
− | |||
[[Category:Template]] | [[Category:Template]] |
Revision as of 20:05, 4 April 2017
Templates are pages on the Wiki which are designed to be included in other pages. They are normally used for repetitive material (such as text and information boxes, icons, or standard messages). Using templates not only saves having to copy parts of pages to other pages, but they ensure a consistent style throughout the Wiki.
Creating and editing templates
Anyone can create or edit templates; it works just like editing pages! More advanced templates can take advantage of some programming capabilities, which can look daunting at first glance. Fortunately, Wikipedia has an excellent page on getting started with templates, which covers both basic and advanced templates.
Template pages
All templates should consist of two pages: the main template page (Template:<template name>
) and the template's documentation page (Template:<template name>/doc
).
A template's main page should consist only of the template itself (sometimes wrapped in <includeonly>...</includeonly>
tags) and the {{Documentation}}
template wrapped in <noinclude>...</noinclude>
tags:
<noinclude>{{documentation}}</noinclude> |
For templates that generate a misleading edit link on pages in which they are included, it may also be appropriate to include a comment alerting would-be editors that they are in danger of editing the template itself, rather than the template call inside the containing article.
Care should be taken to avoid any whitespace between </includeonly>
and <noinclude>
, as transclusion does not ignore whitespace and unnecessary whitespace may interfere with template functions.
All categorization should be placed on the template documentation page.
Naming templates
All templates, like all wiki pages and all uploaded files, must have a unique name. These names may even be expressed as {{multiple words}}
or {{multiple_words}}
as the wiki itself will convert the space to an underscore automatically when it creates the template page.
If you are unsure what to name your template early on, choose something slightly cryptic instead of a common term that someone else may/has already used. That name will be reserved by the system indefinitely; please ask an administrator to help rename your template later, if necessary.
Template documentation
All templates should include documentation which describes their purpose and use. Template documentation should be written on a separate page, made by appending <code/doc to the template's main page:
Template:<template name>/doc |
The {{Documentation}}
template can be used on a template's main page (wrapped in <noinclude>...</noinclude>
tags) to automatically transclude a template's documentation, so long as the documentation page follows the aforementioned naming convention.
If the {{Documentation}}
template is included on a template page for which documentation has not yet been written, {{Documentation}}
will generate a helpful link that will pre-populate the documentation page with a general outline of how documentation may be written, which also includes basic formatting:
;Description :This template is used to do something. ;Dependencies:<!-- delete if N/A --> :* Uses (some CSS, JS, file, or other template).<!-- delete if N/A --> ;Syntax :Type <code>{{t|templatename|param1<!-- delete if N/A -->|namedparam=<!-- delete if N/A -->}}</code> somewhere. ;Sample output :<code>{{templatename|foo1<!-- delete if N/A -->|foo2=<!-- delete if N/A -->}}</code> ::gives... {{templatename|foo1<!-- delete if N/A -->|foo2=<!-- delete if N/A -->}} ;See also:<!-- delete if N/A --> :* [[Template:<!-- Some other template -->]]<!-- delete if N/A --> :* [[<!-- Some other related page -->]]<!-- delete if N/A --> <includeonly>[[Category:Template|{{PAGENAME}}]]<!-- Any categories for the template itself --></includeonly> <noinclude>[[Category:Template documentation|{{PAGENAME}}]]</noinclude>
Following this guideline is not required, but it can be useful to editors who lack experience writing template documentation. As noted in the pre-populated text, the documentation, when transcluded on the main template page, will assign the template itself to Category:Template, and the documentation page to Category:Template documentation. Any other categories for either template or documentation should be applied using this method as well.
Link to main template
Though not required or suggested by the pre-populated text, it can be useful to include a link to a template's main page at the top of its documentation page, as MediaWiki does not automatically generate such links for templates (though it does in other namespaces). This link must be wrapped in <noinclude>...</noinclude>
tags to ensure it is not transcluded with the actual documentation:
<noinclude>{{main|Template:<template name>}}</noinclude> |
Using templates
You can insert by encasing its name in curly brackets. For instance, if you would like to mark a page as "needing cleanup", add the code {{Cleanup}}
to the page, which produces the following:
Some templates can be used with parameters to customise how they look. For instance, you can use the template {{Example}}
to mark an example on a page. You pass parameters to templates by using the pipe character | . {{Example|This is an example of how a template can look (how very meta!)}}
produces the following:
Templates on the UniWiki
Below is a list of the most commonly used templates on the UniWiki, along with tips on how best to use them. Some templates are trivially easy to use, whilst others can be customised with large numbers of parameters. Luckily, each template should include a documentation section (for an example, take a look at the {{skill}}
template), which explains what the template is for, and how to use it.
You can also browse the full list of templates available for use on the UniWiki.
Maintenance templates
These templates are used to mark pages which need attention - either because they're short, need cleanup, are outdated, should be deleted, and so forth. They are usually placed at the top of a page (although you can place them in the middle of a page, to indicate that there is a particular section of a page needing attention). Adding one of these templates to a page automatically puts the page in a special Category, making it easy to find all the outdated pages, for instance (in order to fix them, obviously! :) ).
{{Cleanup}}
- Indicates that the page needs to be cleaned up or improved; use this template to mark pages which have a lot of spelling errors, unwieldy layout, or which generally look very unfinished. All pages tagged with this template are automatically added to the Candidates for Cleanup category.
{{Update}}
- This indicates that the page needs to be updated because its content is out of date (e.g. because the game mechanics or the Eve community has changed). All pages tagged with this template are automatically added to the Needing Updates category.
{{Stub}}
- Use this template on pages which are short and which you feel should be expanded. All pages thus marked as "stubs" are automatically added to the Stubs category.
{{Work in progress}}
- Use this template to mark a page which you are currently working on, as a way of letting other Wiki editors know that someone is busy editing or expanding the page. Don't forget to take it off after you're done!
{{Merge}}
- If you see two articles on a similar subject, and you think they should be combined into one article, then feel free to go ahead and do so! If, however, you're unsure and would like to discuss it with other editors, use this template. Alternatively, you can always discuss it on the E-UNI forum.
{{Deletion}}
- Only Wiki admins are allowed to permanently delete pages from the Wiki. If there's a page which you think is superfluous, abusive, was created by accident etc, put this template on the page, and an admin will soon get around to deleting it.
Ship templates
Ships are at the core of EVE, and so it's no surprise that the UniWiki has some beautiful templates for describing ships and their fittings.
{{ShipFitting}}
- Use this template to add a new ship fitting to a page. As there are a myrid different ways of fitting a ship in EVE, this template needs a lot of parameters; check the template documentation for details on how to use it. For an example of how the template looks when in use, take a look at any ship page on the wiki (for instance, a Rifter).
{{ShipArticle}}
,{{Ship}}
, and others- These templates form the heart of the UniWiki's ship database. They are highly complex but produce beautiful ship overviews - and you probably won't need to use them until CCP rebalances ships in the next expansion to EVE.
Skill templates
{{Skill}}
- This template is used to produce the skill summary boxes for the UniWiki skill listings.
{{Sk}}
- Use this template when you would like to link to a skill from another page, as it makes it easy to find the correct link, and show additional information about the skill (such as its multiplier or the cost of the skill book).
Topic index templates and infoboxes
You will find these infoboxes and navigation boxes on many pages (including this one - see that black bar at the top?), as they are handy for navigating between pages on similar topics, or for showing key information about a page at a glance. If you're writing or editing a page, check to see if there is a template which you can use to better integrate your page with other similar pages. Some of the more common ones are:
{{On-Going Events}}
,{{Member Services}}
, and{{EVE University}}
for pages about the E-UNI and its members and services.{{Infobox class}}
, used on class pages.{{Incursion sites}}
and{{Incursions links}}
on pages about incursions.{{Wormhole Links}}
on pages about wormholes.{{Industry Links}}
on pages about Industry.{{ExplorationNavbox}}
on pages about exploration.{{ShipsMatrix}}
, a list of all the ships in the UniWiki ships database.
Formatting templates
These templates are designed to harmonise the design of the different pages on the UniWiki, and allow editors to re-use style elements without having to go to the trouble of re-coding them for every page.
{{Hatnote}}
- If there is a more comprehensive page on the subject you're writing about, use this template to insert a note at the top of the paragraph, letting the reader know that more detailed information is available elsewhere, if they're interested. The templates
{{Main}}
and{{See also}}
are variants, with more specific wording.
{{Note box}}
and{{Important note box}}
- These templates create colored text boxes, which you can use to highlight important information.
{{Example}}
- Sometimes an example makes it much easier to explain a complicated concept; you can use this template to set the example off from the rest of the article text.
{{Box}}
and{{Color box}}
- Use this template to insert a coloured box into an article, to highlight an piece of information, or as a building block for a more complex diagram or infobox.
{{Co}}
and{{Color}}
- Want to use different-coloured text in your article? These templates can make that happen.
{{Expansion past}}
- A collapsing text block that can be used to indicate how a feature has changed from a past expansion.
Boilerplate messages
Sometimes there's a piece of text which needs to be re-used over and over again; {{Syllabus}}
and {{SyllabusReviewed}}
are two common examples from the class pages.