Template:Specialization link/doc: Difference between revisions
(moving documentation to subpage; will update soon) |
(Rewriting doc to be similar to other docs and discuss the new display override parameters, etc.) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
== Overview == | |||
Creates a link to a specialization's page. | |||
The template validates that you have correctly spelled the specialization name, and it automatically looks up and includes the icon for you. Any links returned by this template '''should''' have articles and not be redlinks. | |||
A shortcut exists for this template, [[Template:sl]]. You can use <code><nowiki>{{sl}}</nowiki></code> instead of <code><nowiki>{{Specialization link}}</nowiki></code> with the same parameters. | |||
== Parameters == | |||
=== Specialization === | |||
The name of the specialization is the only required parameter. Use it as it appears in-game; a missing or mispelled name will result in an error. | |||
= | If you do not wish to write the code <code>name=</code>, you may skip that, but you must specify the specialization before any other parameters. | ||
{|class=wikitable | |||
! Parameter !! Type !! Description | |||
|- | |||
| name || string || '''Required.''' The name of the specialization, as it appears in the game. | |||
|} | |||
=== Output overrides === | |||
All of these parameters are optional and change how the link is formatted. | |||
{|class=wikitable | |||
! Parameter !! Type !! Description | |||
{| class= | |||
! | |||
|- | |- | ||
| | | size || string || The size of the icon to display. Choose one of the following: | ||
| | * none | ||
* small | |||
* medium | |||
* large | |||
* huge (same as large for this template) | |||
The default is <code>small</code>, suitable for paragraphs. | |||
|- | |- | ||
| | | display || string || If you include <code>display=notext</code> only the icon will be rendered. | ||
| | |||
If you include <code>display=show_type</code> then ''Comfort'' or ''Proficiency'' will be added after the name, according to the specialization you specified. | |||
|} | |} | ||
Specialization links that are written into paragraphs should use the small icon, which is the default. | |||
== Examples == | == Examples == | ||
=== Basic usage === | |||
<pre>{{Specialization link|Masonry}}</pre> | |||
Makes a simple link to the {{Specialization link|Masonry}} article with a small icon for use in-line in paragraphs like this. Please do not use larger icons than this in paragraphs or it will push the lines further apart, decreasing readability. | |||
<pre>{{Specialization link|Masonry|size=medium}}</pre> | |||
Yields a moderately sized icon, suitable for use in lists and tables. | |||
{{Specialization link|Masonry|size=medium}} | |||
<pre>{{Specialization link|Masonry|large}}</pre> | |||
Yields a large icon, suitable to headline tables focusing on specializations. | |||
{{Specialization link|Masonry|large}} | |||
=== Other examples === | |||
<pre>{{Specialization link|Meat production|none}}</pre> | |||
Yields only the label {{Specialization link|Meat production|none}}, without an icon. As a great alternative to displaying the small icon after the first mention of the specialization in a paragraph, to avoid overwhelming the reader with icons. | |||
<pre>{{Specialization link|Meat production|large|display=notext}}</pre> | |||
Yields only the icon, and can be leverage the high recognizability of specialization graphics. | |||
{{Specialization link|Meat production|large|display=notext}} | |||
<pre>{{Specialization link|Meat production|medium|display=show_type}}</pre> | |||
Yields a longer label that includes the type of the specialization. Not as useful in most cases, but especially when comparing or grouping types of specializations. | |||
{{Specialization link|Meat production|medium|display=show_type}} | |||
<pre>{{Specialization link|Meat production|size=gigantic}}</pre> | |||
Specifying an icon size that is not recognized does not return an error. Instead, it defaults to the small icon like this: {{Specialization link|Meat production|size=gigantic}}. | |||
=== Errors === | |||
The following are error messages generated by calling the template incorrectly. | |||
<pre>{{Specialization link}}</pre> | |||
With no arguments: {{Specialization link}} | |||
<pre>{{Specialization link|name=Shipbuilding}}</pre> | |||
Naming a specialization that doesn't exist in the game: {{Specialization link|name=Shipbuilding}} | |||
{{Specialization link| | <pre>{{Specialization link|large|Meat production}}</pre> | ||
Swapping the order of the parameters so that the specialization is not first: {{Specialization link|large|Meat production}} |
Latest revision as of 22:05, 8 November 2024
Overview
Creates a link to a specialization's page.
The template validates that you have correctly spelled the specialization name, and it automatically looks up and includes the icon for you. Any links returned by this template should have articles and not be redlinks.
A shortcut exists for this template, Template:sl. You can use {{sl}}
instead of {{Specialization link}}
with the same parameters.
Parameters
Specialization
The name of the specialization is the only required parameter. Use it as it appears in-game; a missing or mispelled name will result in an error.
If you do not wish to write the code name=
, you may skip that, but you must specify the specialization before any other parameters.
Parameter | Type | Description |
---|---|---|
name | string | Required. The name of the specialization, as it appears in the game. |
Output overrides
All of these parameters are optional and change how the link is formatted.
Parameter | Type | Description |
---|---|---|
size | string | The size of the icon to display. Choose one of the following:
The default is |
display | string | If you include display=notext only the icon will be rendered.
If you include |
Specialization links that are written into paragraphs should use the small icon, which is the default.
Examples
Basic usage
{{Specialization link|Masonry}}
Makes a simple link to the Masonry article with a small icon for use in-line in paragraphs like this. Please do not use larger icons than this in paragraphs or it will push the lines further apart, decreasing readability.
{{Specialization link|Masonry|size=medium}}
Yields a moderately sized icon, suitable for use in lists and tables.
{{Specialization link|Masonry|large}}
Yields a large icon, suitable to headline tables focusing on specializations.
Other examples
{{Specialization link|Meat production|none}}
Yields only the label Meat production, without an icon. As a great alternative to displaying the small icon after the first mention of the specialization in a paragraph, to avoid overwhelming the reader with icons.
{{Specialization link|Meat production|large|display=notext}}
Yields only the icon, and can be leverage the high recognizability of specialization graphics.
{{Specialization link|Meat production|medium|display=show_type}}
Yields a longer label that includes the type of the specialization. Not as useful in most cases, but especially when comparing or grouping types of specializations.
{{Specialization link|Meat production|size=gigantic}}
Specifying an icon size that is not recognized does not return an error. Instead, it defaults to the small icon like this: Meat production.
Errors
The following are error messages generated by calling the template incorrectly.
{{Specialization link}}
With no arguments: Lua error in Module:SpecializationLink at line 39: The Specialization link template requires the name of a specialization.
{{Specialization link|name=Shipbuilding}}
Naming a specialization that doesn't exist in the game: Lua error in Module:SpecializationLink at line 56: No specialization found with that name: Shipbuilding.
{{Specialization link|large|Meat production}}
Swapping the order of the parameters so that the specialization is not first: Lua error in Module:SpecializationLink at line 56: No specialization found with that name: large.