Template:Species link: Difference between revisions

From Against the Storm Official Wiki
m (swapping prioritization of template parameters; no functional change)
 
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<includeonly>{{#invoke:SpeciesLink|renderLink|Species={{{1|{{{Species|}}} }}}|iconsize={{{2|{{{iconsize|}}} }}} }}</includeonly><noinclude>
<includeonly>{{#invoke:SpeciesLink|main
    |species={{{species|{{{1|}}} }}}
    |size={{{size|{{{2|}}} }}}
    |display={{{display|}}}
}}</includeonly><noinclude>


<code><nowiki>{{#invoke:SpeciesLink|renderLink|Species={{{1|{{{Species|}}} }}}|iconsize={{{2|{{{iconsize|}}} }}} }}</nowiki></code>
{{Documentation}}


 
[[Category:Link templates]]
This template is used like this: <code><nowiki>{{Species link|Species|iconsize}}</nowiki></code>
[[Category:Lua-based templates]]</noinclude>
 
 
This template calls <code>renderLink</code> in '''Module:SpeciesLink''' to make icons and short wiki links to a Species's page. The icon can be small, huge, or in between. The small icon is sized appropriately to fit well into in-line text.
 
This template standardizes the display of icons and Speciessthroughout the wiki and simplifies the amount of writing that is necessary when adding new content pages.
 
 
A shortcut template also exists <code><nowiki>{{rl}}</nowiki></code>, to make writing a page with many Species links a little easier.
 
 
== Usage ==
 
Use the name of the species name as it appears in the game. (The background code performs some normalization, but only to catch small mistakes in spacing or apostrophes.)
 
Giving the template a Species name will result in a text-sized icon and a link to the wiki page for that Species. This is useful in-line with text in paragraphs, where Species icons can still be recognized.
 
 
Telling the template what size to make the icon allows the icon to be larger and more distinguishable. This is useful when creating tables where a larger Species icon increases recognition. IF the Species is not known to the data modules behind the scenes, an error will appear.
 
The default is a small icon, for use in-line with text. You can also use <code>med</code>, <code>large</code>, <code>huge</code>, or write <code>small</code> explicitly, to describe the desired size of the icon, as you can see below.
 
 
Here are ways to call the template and the expected result:
 
{| class="wikitable"
! Argument !! Examples !! Expected outcome
|-
| None
|style="white-space: nowrap"| <code><nowiki>{{Species link}}</nowiki></code>
| An error.
|-
| Species name or <br /> Species name and a "small" icon size
|style="white-space: nowrap"| <code><nowiki>{{Species link|Fox}}</nowiki></code> <br /> <code><nowiki>{{Species link|Crystalized Dew|small}}</nowiki></code>
| A small, text-sized icon and link to the wiki page for the Species.
|-
| Species name and a "med" icon size
|style="white-space: nowrap"| <code><nowiki>{{Species link|Fox|med}}</nowiki></code> <br /> <code><nowiki>{{Species link|Training Gear|med}}</nowiki></code>
| A fair-sized Species icon and a link to its wiki page.
|-
| Species name and a "large" icon size
|style="white-space: nowrap"| <code><nowiki>{{Species link|Fox|large}}</nowiki></code> <br /> <code><nowiki>{{Species link|Waterskins|large}}</nowiki></code>
| A large Species icon and a link to its wiki page.
|-
| Species name and a "huge" icon size
|style="white-space: nowrap"| <code><nowiki>{{Species link|Fox|huge}}</nowiki></code> <br /> <code><nowiki>{{Species link|Pack of Trade Goods|huge}}</nowiki></code>
| A very large Species icon and a link to its wiki page.
|}
 
 
== Examples ==
 
The following are generated by calling the template, as shown in the examples in the table above.
 
 
1. <code><nowiki>{{Species_link|Fox}}</nowiki></code> yields:
 
{{Species_link|Fox}}
 
 
2. <code><nowiki>{{Species link|Fox|med}}</nowiki></code> yields:
 
{{Species_link|Fox|med}}
 
 
3. <code><nowiki>{{Species link|Fox|large}}</nowiki></code> yields:
 
{{Species_link|Fox|large}}
 
 
4. <code><nowiki>{{Species link|Fox|huge}}</nowiki></code> yields:
 
{{Species_link|Fox|huge}}
 
 
The following are error messages generated by calling the template incorrectly.
 
 
5. With no arguments, <code><nowiki>{{Species link}}</nowiki></code> yields:
 
'''{{Species link}}'''
 
 
6. With the name of something that doesn't exist in the game, <code><nowiki>{{Species link|Foxes}}</nowiki></code> yields:
 
'''{{Species link|Foxes}}'''
 
 
7. With no Species but an icon size, <code><nowiki>{{Species link||large}}</nowiki></code> yields:
 
'''{{Species link||large}}'''
 
 
Finally, providing an icon size that is not recognized does not break the template.
 
 
8. With a valid Species but invalid icon size, <code><nowiki>{{Species link|Fox|gigantic}}</nowiki></code> yields:
 
{{Species link|Fox|gigantic}}</noinclude>

Latest revision as of 03:12, 15 October 2024


This is the Template Documentation from Template:Species link/doc.

Overview

Creates a link to a species' page.

Parameters

Species

The name of the species is the only required parameter. Use the name of the species as it appears in game. A missing or misspelled species name will result in an error.

If you do not wish to write the code species=, you may skip that, but you must specify the name of the species before any other parameters.

Parameter Type Description
species string The name of the species, as it appears in the game, either singular or plural.

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:
  • none
  • small
  • medium
  • large
  • huge

The default is small, which is text-height for use in paragraphs. If you do not name this parameter with size=, it must come second.

display string if you include display=notext, only the icon will be rendered. There are currently no other options for this parameter.

Examples

Basic usage

{{Species link|species=Humans}}

Yields Humans Humans, a text-height icon that flows well in paragraphs without impacting line height.


{{Species link|human|size=medium}}

Yields a slightly larger icon, suitable for easy recognition in tables:

Humans Humans


{{Species link|human|large}}

Yields a larger icon, suitable for tables featuring the species as an important factor:

Humans Humans

Other examples

{{Species link|species=Harpy|size=small|display=notext}}

Yields just a linked icon Harpies for the Harpies. Use this sparingly, because it is not as accessible, and in paragraphs the icons can be hard to distinguish. This is good in tables where the icon functions as a reminder than an important factor. An example where this is useful is in the infoboxes of buildings which feature specialization as an important factor, and the species icon is shown next to the specialization as just a quick reminder.


{{Species link|human|none}}

Yields just the text link, Humans, suitable for when mentioning more than one time in the same paragraph to avoid cluttering the paragraph with icons. (This is preferable to using a regular wiki link, so the styling matches, even if it appears to have the same styling right now.)


{{Species link|Foxes|size=gigantic}}

Providing an icon size that is not recognized does not return an error. Instead, the template shows the default, small icon size: Foxes Foxes

Errors

The following are error messages generated by calling the template incorrectly.

{{Species link}}

With no arguments: Lua error in Module:SpeciesLink at line 58: You must specify the name of the species. Please see the template documentation for how to use the parameters.

{{Species link|Centaurs}}

Naming a species that doesn't exist in the game: Lua error in Module:SpeciesLink at line 41: You specified an invalid species name. Please see the template documentation for how to use the parameters.