Template:Specialization link: Difference between revisions

From Against the Storm Official Wiki
m (added category)
(updating to new parameters and function call; sorry for the change)
Line 1: Line 1:
<includeonly>{{#invoke:SpecializationLink|renderLink|spec={{{1|{{{spec|}}} }}}|iconsize={{{2|{{{iconsize|}}} }}} }}</includeonly><noinclude>
<includeonly>{{#invoke:SpecializationLink|main
|spec={{{spec|{{{1|}}}}}}
|size={{{size|{{{2|}}}}}}
}}</includeonly><noinclude>


<code><nowiki>{{#invoke:SpecializationLink|renderLink|spec={{{1|{{{spec|}}} }}}|iconsize={{{2|{{{iconsize|}}} }}} }}</nowiki></code>
<code><nowiki>{{#invoke:SpecializationLink|renderLink|spec={{{1|{{{spec|}}} }}}|iconsize={{{2|{{{iconsize|}}} }}} }}</nowiki></code>

Revision as of 18:01, 8 November 2024


{{#invoke:SpecializationLink|renderLink|spec={{{1|{{{spec|}}} }}}|iconsize={{{2|{{{iconsize|}}} }}} }}


This template is used like this: {{Specialization link|spec|iconsize}}


This template calls renderLink in Module:SpecializationLink to make icons and short wiki links to a specialization'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 specializations throughout the wiki and simplifies the amount of writing that is necessary when adding new content pages.


Usage

Use the name of the specialization as it appears in the game.

Giving the template a specialization name will result in a text-sized icon and a link to the wiki page for that specialization . This is useful in-line with text in paragraphs, where specialization 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 icon increases recognition. If you request a link to a specialization that doesn't exist, an error will appear.

The default is a small icon, for use in-line with text. You can also use med, large, huge, or write small 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:

Argument Examples Expected outcome
None {{Specialization link}} An error.
Specialization name or
Specialization name and a "small" icon size
{{Specialization link|Farming}}
{{Specialization link|Alchemy|small}}
A small, text-sized icon and link to the wiki page for the specialization.
Specialization name and a "med" icon size {{Specialization link|Farming|med}}
{{Specialization link|Meat production|med}}
A fair-sized specialization icon and a link to its wiki page.
Specialization name and a "large" icon size {{Specialization link|Farming|large}}
{{Specialization link|Wood|large}}
A large specialization icon and a link to its wiki page.
Resource name and a "huge" icon size {{Specialization link|Farming|huge}}
{{Specialization link|Engineering|huge}}
A very large specialization 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. {{Specialization link|Farming}} yields:

Lua error in Module:SpecializationLink at line 39: The Specialization link template requires the name of a specialization.


2. {{Specialization link|Farming|med}} yields:

Lua error in Module:SpecializationLink at line 39: The Specialization link template requires the name of a specialization.


3. {{Specialization link|Farming|large}} yields:

Lua error in Module:SpecializationLink at line 39: The Specialization link template requires the name of a specialization.


4. {{Specialization link|Farming|huge}} yields (currently the same as large, since the icons are not high enough resolution to render that big).

Lua error in Module:SpecializationLink at line 39: The Specialization link template requires the name of a specialization.


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


5. With no arguments, {{Specialization link}} yields:

Lua error in Module:SpecializationLink at line 39: The Specialization link template requires the name of a specialization.


6. With the name of something that doesn't exist in the game, {{Specialization link|Meat}} yields:

Lua error in Module:SpecializationLink at line 39: The Specialization link template requires the name of a specialization.


7. With no specialization but an icon size, {{Specialization link||large}} yields:

Lua error in Module:SpecializationLink at line 39: The Specialization link template requires the name of a specialization.


Finally, providing an icon size that is not recognized does not break the template.


8. With a valid specialization but invalid icon size, {{Specialization link|Farming|gigantic}} yields:

Lua error in Module:SpecializationLink at line 39: The Specialization link template requires the name of a specialization.