Difference between revisions of "UniWiki:Templates"
Lelira cirim (talk | contribs) (→Formatting templates: added expansion_past) |
m (Remove forum link, board no longer exists.) |
||
(29 intermediate revisions by 8 users not shown) | |||
Line 1: | Line 1: | ||
− | {{ | + | {{update|Note to self: update it with new templates, transclude where possible, reduce signposting language. [[User:Arin Mara|Arin Mara]] ([[User talk:Arin Mara|talk]]) 09:48, 23 April 2022 (UTC)<br> |
− | + | [[#Boilerplate messages]] need new examples templates Syllabus and and Syllabus Reviewd are (to be) deleted.}} | |
'''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. | '''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 == | == 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 [https://en.wikipedia.org/wiki/Help:Template getting started with templates], which covers both basic and advanced 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 [https://en.wikipedia.org/wiki/Help:Template getting started with templates], which covers both basic and advanced templates. |
+ | |||
+ | === Template pages === | ||
+ | |||
+ | All templates should consist of two pages: the main template page (<code>Template:<template name></code>) and the template's [[#Template documentation|documentation page]] (<code>Template:<template name>/doc</code>). | ||
+ | |||
+ | A template's main page should consist only of the template itself (sometimes wrapped in {{tag|includeonly}} tags) and the {{tl|Documentation}} template wrapped in {{tag|noinclude}} tags: | ||
+ | |||
+ | {{code|<nowiki><noinclude>{{documentation}}</noinclude></nowiki>}} | ||
+ | |||
+ | 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 <code></includeonly></code> and <code><nowiki><noinclude></nowiki></code>, as transclusion does not ignore whitespace and unnecessary whitespace may interfere with template functions. | ||
+ | |||
+ | All categorization should be placed on the [[#Template documentation|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 <code><nowiki>{{multiple words}}</nowiki></code> or <code><nowiki>{{multiple_words}}</nowiki></code> 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</code> to the template's main page: | ||
+ | |||
+ | {{code|Template:<template name>/doc}} | ||
+ | |||
+ | The {{tl|Documentation}} template can be used on a template's main page (wrapped in {{tag|noinclude}} tags) to automatically transclude a template's documentation, so long as the documentation page follows the aforementioned naming convention. | ||
+ | |||
+ | If the {{tl|Documentation}} template is included on a template page for which documentation has not yet been written, {{tl|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: | ||
+ | |||
+ | <pre> | ||
+ | ; 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 --> | ||
+ | :: some CSS, JS, file, or other template | ||
+ | :; Used by <!-- delete if N/A --> | ||
+ | :: template <!-- Preferably use the {{T|templatename}} --> | ||
+ | |||
+ | ; Syntax | ||
+ | : {{T|Templatename|param<!-- delete if N/A -->|namedparam=<!-- delete if N/A -->}} <!-- = is the = sign --> | ||
+ | :; Parameters <!-- delete if N/A --> | ||
+ | ::; param | ||
+ | ::: Param description. | ||
+ | ::; param : Param description. | ||
+ | ::; namedparam | ||
+ | ::: Namedparam description. | ||
+ | |||
+ | ; Sample <!-- delete if N/A --> | ||
+ | :<code><nowiki>{{templatename|foo1<!-- delete if N/A -->|foo2=<!-- delete if N/A -->}}</nowiki></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]]<!-- Any categories for the template itself --></includeonly> | ||
+ | <noinclude>[[Category:Template documentation]]</noinclude> | ||
+ | </pre> | ||
+ | |||
+ | 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 {{tag|noinclude}} tags to ensure it is not transcluded with the actual documentation: | ||
+ | |||
+ | {{code|<nowiki><noinclude>{{main|Template:<template name>}}</noinclude></nowiki>}} | ||
== Using templates == | == 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 | + | 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 {{T|Cleanup}} to the page, which produces the following: |
− | {{ | + | {{Banner|color= #153E7E|border= #153E7E|'''This article should be cleaned up or improved.''' The reason is: ''unspecified''. }} |
Some templates can be used with parameters to customise how they look. For instance, you can use the template <code>{{t|Example}}</code> to mark an example on a page. You pass parameters to templates by using the pipe character | . <code><nowiki>{{Example|This is an example of how a template can look (how very meta!)}}</nowiki></code> produces the following: | Some templates can be used with parameters to customise how they look. For instance, you can use the template <code>{{t|Example}}</code> to mark an example on a page. You pass parameters to templates by using the pipe character | . <code><nowiki>{{Example|This is an example of how a template can look (how very meta!)}}</nowiki></code> produces the following: | ||
Line 14: | Line 83: | ||
== Templates on the UniWiki == | == 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 <code>{{t|skill}}</code> template), which explains what the template is for, and how to use it. | |
+ | |||
+ | You can also browse the [[:Category:Template|full list of templates]] available for use on the UniWiki. | ||
=== Maintenance templates === | === Maintenance templates === | ||
Line 20: | Line 91: | ||
;<code>{{t|Cleanup}}</code> | ;<code>{{t|Cleanup}}</code> | ||
− | :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 [[:Category:Candidates for | + | :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 [[:Category:Candidates for cleanup|Candidates for cleanup]] category. |
+ | |||
+ | ;<code>{{t|Update}}</code> | ||
+ | :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 [[:Category:Needing updates|Needing updates]] category. | ||
;<code>{{t|Stub}}</code> | ;<code>{{t|Stub}}</code> | ||
: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 [[:Category:Stubs|Stubs]] category. | :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 [[:Category:Stubs|Stubs]] category. | ||
− | ;<code>{{t|Work in | + | ;<code>{{t|Work in progress}}</code> |
: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! | :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! | ||
;<code>{{t|Merge}}</code> | ;<code>{{t|Merge}}</code> | ||
− | :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 | + | :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. |
;<code>{{t|Deletion}}</code> | ;<code>{{t|Deletion}}</code> | ||
− | :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. | + | :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 === | === Ship templates === | ||
Line 54: | Line 128: | ||
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: | 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: | ||
− | * <code>{{t| | + | * <code>{{t|Community Group Navbar}}</code>, <code>{{t|EVEUniversityNav}}</code>, and <code>{{t|EVE University}}</code> for pages about the E-UNI and its members and services. |
− | |||
* <code>{{t|Incursion sites}}</code> and <code>{{t|Incursions links}}</code> on pages about incursions. | * <code>{{t|Incursion sites}}</code> and <code>{{t|Incursions links}}</code> on pages about incursions. | ||
* <code>{{t|Wormhole Links}}</code> on pages about wormholes. | * <code>{{t|Wormhole Links}}</code> on pages about wormholes. | ||
* <code>{{t|Industry Links}}</code> on pages about Industry. | * <code>{{t|Industry Links}}</code> on pages about Industry. | ||
− | |||
* <code>{{t|ShipsMatrix}}</code>, a list of all the ships in the UniWiki ships database. | * <code>{{t|ShipsMatrix}}</code>, a list of all the ships in the UniWiki ships database. | ||
Line 67: | Line 139: | ||
;<code>{{t|Hatnote}}</code> | ;<code>{{t|Hatnote}}</code> | ||
− | :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 | + | :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 <code>{{t|Main}}</code> and <code>{{t|See also}}</code> are variants, with more specific wording. |
;<code>{{t|Note box}}</code> and <code>{{t|Important note box}}</code> | ;<code>{{t|Note box}}</code> and <code>{{t|Important note box}}</code> | ||
Line 86: | Line 158: | ||
=== Boilerplate messages === | === Boilerplate messages === | ||
− | Sometimes there's a piece of text which needs to be re-used over and over again; <code>{{ | + | Sometimes there's a piece of text which needs to be re-used over and over again; <code>{{tl|Syllabus}}</code> and <code>{{tl|Syllabus Reviewed}}</code> are two common examples from the class pages. |
+ | |||
+ | {{UniWikiNav}} | ||
+ | [[Category:Editing]] | ||
[[Category:Wiki Information]] | [[Category:Wiki Information]] | ||
− | |||
− |
Latest revision as of 12:36, 4 November 2024
Reason: Note to self: update it with new templates, transclude where possible, reduce signposting language. Arin Mara (talk) 09:48, 23 April 2022 (UTC)
#Boilerplate messages need new examples templates Syllabus and and Syllabus Reviewd are (to be) deleted.
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 /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 --> :: some CSS, JS, file, or other template :; Used by <!-- delete if N/A --> :: template <!-- Preferably use the {{T|templatename}} --> ; Syntax : {{T|Templatename|param<!-- delete if N/A -->|namedparam=<!-- delete if N/A -->}} <!-- = is the = sign --> :; Parameters <!-- delete if N/A --> ::; param ::: Param description. ::; param : Param description. ::; namedparam ::: Namedparam description. ; Sample <!-- delete if N/A --> :<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]]<!-- Any categories for the template itself --></includeonly> <noinclude>[[Category:Template documentation]]</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.
{{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:
{{Community Group Navbar}}
,{{EVEUniversityNav}}
, and{{EVE University}}
for pages about the E-UNI and its members and services.{{Incursion sites}}
and{{Incursions links}}
on pages about incursions.{{Wormhole Links}}
on pages about wormholes.{{Industry Links}}
on pages about Industry.{{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;
and {{Syllabus}}
are two common examples from the class pages.
{{Syllabus Reviewed}}
|