Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

UniWiki:Templates: Difference between revisions

From EVE University Wiki
Templates on the UniWiki: reflow the intro paragraph a bit
m Remove forum link, board no longer exists.
 
(22 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Contribution menu}}
{{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 ===
=== Naming templates ===
Line 10: Line 24:


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.
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&#61;<!-- delete if N/A -->}} <!-- &#61; 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 <code><nowiki>{{Cleanup}}</nowiki></code> to the page, which produces the following:
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:
{{Cleanup}}  
{{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 27: 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 Cleanup|Candidates for Cleanup]] category.  
: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>
;<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.  
: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>
Line 39: Line 103:


;<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. Alternatively, you can always discuss it on the [http://forum.eveuniversity.org/viewforum.php?f=54 E-UNI forum].
: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>
Line 64: 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|On-Going Events}}</code>, <code>{{t|Member Services}}</code>, and <code>{{t|EVE University}}</code> for pages about the E-UNI and its members and services.
* <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|Infobox class}}</code>, used on class pages.
* <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|ExplorationNavbox}}</code> on pages about exploration.
* <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 96: Line 158:
=== Boilerplate messages ===
=== Boilerplate messages ===


Sometimes there's a piece of text which needs to be re-used over and over again; <code>{{t|Syllabus}}</code> and <code>{{t|SyllabusReviewed}}</code> are two common examples from the class pages.  
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]]
[[Category:Wiki Contributions]]
[[Category:Template]]