Template:Specialization link: Difference between revisions
(created) |
m (added category) |
||
Line 99: | Line 99: | ||
8. With a valid specialization but invalid icon size, <code><nowiki>{{Specialization link|Farming|gigantic}}</nowiki></code> yields: | 8. With a valid specialization but invalid icon size, <code><nowiki>{{Specialization link|Farming|gigantic}}</nowiki></code> yields: | ||
{{Specialization link|Farming|gigantic}}</noinclude> | {{Specialization link|Farming|gigantic}} | ||
[[Category:Link templates]] | |||
[[Category:Lua-based modules]]</noinclude> |
Revision as of 04:09, 2 October 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:
Script error: The function "renderLink" does not exist.
2. {{Specialization link|Farming|med}}
yields:
Script error: The function "renderLink" does not exist.
3. {{Specialization link|Farming|large}}
yields:
Script error: The function "renderLink" does not exist.
4. {{Specialization link|Farming|huge}}
yields (currently the same as large
, since the icons are not high enough resolution to render that big).
Script error: The function "renderLink" does not exist.
The following are error messages generated by calling the template incorrectly.
5. With no arguments, {{Specialization link}}
yields:
Script error: The function "renderLink" does not exist.
6. With the name of something that doesn't exist in the game, {{Specialization link|Meat}}
yields:
Script error: The function "renderLink" does not exist.
7. With no specialization but an icon size, {{Specialization link||large}}
yields:
Script error: The function "renderLink" does not exist.
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:
Script error: The function "renderLink" does not exist.