Template:Species link: Difference between revisions

From Against the Storm Official Wiki
No edit summary
Line 1: Line 1:
<includeonly>{{#invoke:ResourceLink|renderLink|resource={{{1|{{{resource|}}} }}}|iconsize={{{2|{{{iconsize|}}} }}} }}</includeonly><noinclude>
<includeonly>{{#invoke:SpeciesLink|renderLink|Species={{{1|{{{Species|}}} }}}|iconsize={{{2|{{{iconsize|}}} }}} }}</includeonly><noinclude>


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




This template is used like this: <code><nowiki>{{Species link|resource|iconsize}}</nowiki></code>
This template is used like this: <code><nowiki>{{Species link|Species|iconsize}}</nowiki></code>




This template calls <code>renderLink</code> in '''Module:ResourceLink''' to make icons and short wiki links to a resource'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 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 resourcesthroughout the wiki and simplifies the amount of writing that is necessary when adding new content pages.
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 resource links a little easier.
A shortcut template also exists <code><nowiki>{{rl}}</nowiki></code>, to make writing a page with many Species links a little easier.




== Usage ==
== Usage ==


Use the name of the resource name as it appears in the game. (The background code performs some normalization, but only to catch small mistakes in spacing or apostrophes.)
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 resource name will result in a text-sized icon and a link to the wiki page for that resource. This is useful in-line with text in paragraphs, where resource icons can still be recognized.
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 resource icon increases recognition. IF the resource is not known to the data modules behind the scenes, an error will appear.
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.
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.
Line 36: Line 36:
| An error.
| An error.
|-
|-
| Resource name or <br /> Resource name and a "small" icon size
| 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>
|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 resource.
| A small, text-sized icon and link to the wiki page for the Species.
|-
|-
| Resource name and a "med" icon size
| 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>
|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 resource icon and a link to its wiki page.
| A fair-sized Species icon and a link to its wiki page.
|-
|-
| Resource name and a "large" icon size
| 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>
|style="white-space: nowrap"| <code><nowiki>{{Species link|Fox|large}}</nowiki></code> <br /> <code><nowiki>{{Species link|Waterskins|large}}</nowiki></code>
| A large resource icon and a link to its wiki page.
| A large Species icon and a link to its wiki page.
|-
|-
| Resource name and a "huge" icon size
| 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>
|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 resource icon and a link to its wiki page.
| A very large Species icon and a link to its wiki page.
|}
|}


Line 92: Line 92:




7. With no resource but an icon size, <code><nowiki>{{Species link||large}}</nowiki></code> yields:
7. With no Species but an icon size, <code><nowiki>{{Species link||large}}</nowiki></code> yields:


'''{{Species link||large}}'''
'''{{Species link||large}}'''
Line 100: Line 100:




8. With a valid resource but invalid icon size, <code><nowiki>{{Species link|Fox|gigantic}}</nowiki></code> yields:
8. With a valid Species but invalid icon size, <code><nowiki>{{Species link|Fox|gigantic}}</nowiki></code> yields:


{{Species link|Fox|gigantic}}</noinclude>
{{Species link|Fox|gigantic}}</noinclude>

Revision as of 10:05, 11 November 2023


{{#invoke:SpeciesLink|renderLink|Species={{{1|{{{Species|}}} }}}|iconsize={{{2|{{{iconsize|}}} }}} }}


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


This template calls renderLink 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 {{rl}}, 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 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 {{Species link}} An error.
Species name or
Species name and a "small" icon size
{{Species link|Fox}}
{{Species link|Crystalized Dew|small}}
A small, text-sized icon and link to the wiki page for the Species.
Species name and a "med" icon size {{Species link|Fox|med}}
{{Species link|Training Gear|med}}
A fair-sized Species icon and a link to its wiki page.
Species name and a "large" icon size {{Species link|Fox|large}}
{{Species link|Waterskins|large}}
A large Species icon and a link to its wiki page.
Species name and a "huge" icon size {{Species link|Fox|huge}}
{{Species link|Pack of Trade Goods|huge}}
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. {{Species link|Fox}} yields:

Script error: The function "renderLink" does not exist.


2. {{Species link|Fox|med}} yields:

Script error: The function "renderLink" does not exist.


3. {{Species link|Fox|large}} yields:

Script error: The function "renderLink" does not exist.


4. {{Species link|Fox|huge}} yields:

Script error: The function "renderLink" does not exist.


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


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

Script error: The function "renderLink" does not exist.


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

Script error: The function "renderLink" does not exist.


7. With no Species but an icon size, {{Species 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 Species but invalid icon size, {{Species link|Fox|gigantic}} yields:

Script error: The function "renderLink" does not exist.