|
|
Line 1: |
Line 1: |
| <includeonly>{{#invoke:BuildingLink|renderLink|building={{{1|{{{building|}}} }}}|iconsize={{{2|{{{iconsize|}}} }}} }}</includeonly><noinclude> | | <includeonly>Loading...</includeonly><noinclude> |
|
| |
|
| == Overview ==
| |
|
| |
|
| This template makes icons and short wiki links to a building's page. This template standardizes the display of icons and buildings throughout the wiki and simplifies the amount of writing needed.
| | 1={{{1|}}} |
|
| |
|
| A shortcut template also exists, <code><nowiki>{{bl}}</nowiki></code>, and its use is encouraged to make writing links even easier.
| | 2={{{2|}}} |
|
| |
|
| == Usage == | | 3={{{3|}}} |
|
| |
|
| This template is used like this: <code><nowiki>{{Building link|building|iconsize}}</nowiki></code>. Use the name of the building as it appears in the game.
| | name={{{name|{{{1|}}} }}} |
|
| |
|
| Since the rendering of the template ends in a standard wikilink, you can append an ''s'' after the template to write the plural of the building. Just like a regular wiki link, <code><nowiki>{{bl|Kiln}}s</nowiki></code> yields {{bl|Kiln}}s, plural, with the ''s'' included in the link text.
| | size={{{size| {{{2|}}} }}} |
|
| |
|
| Giving the template a building name will result in a short link to the wiki page for that building. This is useful in-line with text in paragraphs, where an icon would be too small to recognize but anything large enough to recognize would disrupt the display of the lines of text when it tries to wrap around the icon.
| | display={{{display|}}} |
|
| |
|
| Telling the template what size to make the icon will add an icon before the name of the building that also links to the wiki page. This is useful when creating tables where the building icon aids recognition and where there is space to do so, for example in a table. If the building is not known to the data modules behind the scenes, an error will appear.
| | plural={{{3| {{{2| {{{1|}}} }}} }}} |
|
| |
|
| The default is no icon, for use in-line with text. You can also use <code>med</code>, <code>large</code>, or <code>huge</code> to describe the desired size of the icon, as you can see below.
| | {{#invoke:BuildingLink|renderLink |
| | |name={{{name|{{{1|}}} }}} |
| | |size={{{size| {{{2|}}} }}} |
| | |display={{{display|}}} |
| | |plural={{{3| {{{2| {{{1|}}} }}} }}} |
| | }}<noinclude> |
|
| |
|
| Here are ways to call the template and the expected result:
| | <pre>1. {{Building_link|Cookhouse|display=notext}}</pre> |
| | {{Building_link|Cookhouse|display=notext}} |
|
| |
|
| {| class="wikitable"
| |
| ! Parameter !! Examples !! Expected outcome
| |
| |-
| |
| | None
| |
| |style="white-space: nowrap"| <code><nowiki>{{Building link}}</nowiki></code>
| |
| | An error.
| |
| |-
| |
| | Building name
| |
| |style="white-space: nowrap"| <code><nowiki>{{Building link|Monastery}}</code></nowiki>
| |
| | A link to the wiki page for the building.
| |
| |-
| |
| | Building name and a "medium" icon size
| |
| |style="white-space: nowrap"| <code><nowiki>{{bl|Small Farm|med}}</code></nowiki>
| |
| | A moderately sized icon and a link to its wiki page.
| |
| |-
| |
| | Building name and a "large" icon size
| |
| |style="white-space: nowrap"| <code><nowiki>{{bl|Foragers' Camp|large}}</code></nowiki>
| |
| | A large building icon and a link to its wiki page.
| |
| |-
| |
| | Building name and a "huge" icon size
| |
| |style="white-space: nowrap"| <code><nowiki>{{bl|Cookhouse|huge}}</code></nowiki>
| |
| | A very large building icon and a link to its wiki page.
| |
| |}
| |
|
| |
|
|
| |
|
| == Examples == | | <pre>2. {{Building_link|Cookhouse|display=notext|s}}</pre> |
| | {{Building_link|Cookhouse|display=notext|s}} |
|
| |
|
| The following are generated by calling the template, as shown in the examples in the table above.
| |
|
| |
|
| 1. <code><nowiki>{{Building link|Monastery}}</nowiki></code> yields:
| | <pre>3. {{Building_link|name=Cookhouse|display=notext}}</pre> |
| | {{Building_link|name=Cookhouse|display=notext}} |
|
| |
|
| {{Building_link|Monastery}}
| |
|
| |
|
| 2. <code><nowiki>{{bl|Small Farm|med}}</nowiki></code> yields:
| | <pre>4. {{Building_link|name=Cookhouse|s|display=notext}}</pre> |
| | {{Building_link|name=Cookhouse|s|display=notext}} |
|
| |
|
| {{bl|Small Farm|med}}
| |
|
| |
|
| 3. <code><nowiki>{{bl|Foragers' Camp|large}}</nowiki></code> yields:
| | <pre>5. {{Building_link|Cookhouse|large|display=notext}}</pre> |
| | {{Building_link|Cookhouse|large|display=notext}} |
|
| |
|
| {{bl|Foragers' Camp|large}}
| |
|
| |
|
| 4. <code><nowiki>{{bl|Cookhouse|huge}}</nowiki></code> yields:
| | <pre>6. {{Building_link|Cookhouse|large|display=notext|s}}</pre> |
| | {{Building_link|Cookhouse|large|display=notext|s}} |
|
| |
|
| {{bl|Cookhouse|huge}}
| |
|
| |
|
| The following are error messages generated by calling the template incorrectly.
| | <pre>7. {{Building_link|name=Cookhouse|size=large|s|display=notext}}</pre> |
| | {{Building_link|name=Cookhouse|size=large|s|display=notext}} |
|
| |
|
| 5. With no arguments, <code><nowiki>{{Building_link}}</nowiki></code> yields:
| |
|
| |
|
| '''{{Building_link}}'''
| | <pre>8. {{Building_link|name=Cookhouse|size=large|display=notext|s}}</pre> |
| | {{Building_link|name=Cookhouse|size=large|display=notext|s}} |
|
| |
|
| 6. With the name of something that doesn't exist in the game, <code><nowiki>{{Building_link|Cookhuse}}</nowiki></code> yields:
| |
|
| |
| '''{{Building_link|Cookhuse}}'''
| |
|
| |
| 7. With no building but an icon size, <code><nowiki>{{Building_link||large}}</nowiki></code> yields:
| |
|
| |
| '''{{Building_link||large}}'''
| |
|
| |
| Finally, providing an icon size that is not recognized does not break the template.
| |
|
| |
| 8. With a valid building but invalid icon size, <code><nowiki>{{Building link|Cookhouse|gigantic}}</nowiki></code> yields:
| |
|
| |
| {{Building_link|Cookhouse|gigantic}}
| |
|
| |
|
| [[Category:Link templates]] | | [[Category:Link templates]] |
| [[Category:Lua-based templates]]</noinclude> | | [[Category:Lua-based templates]]</noinclude> |
1=
2=
3=
name=
size=
display=
plural=
Script error: The function "renderLink" does not exist.
1. {{Building_link|Cookhouse|display=notext}}
Loading...
2. {{Building_link|Cookhouse|display=notext|s}}
Loading...
3. {{Building_link|name=Cookhouse|display=notext}}
Loading...
4. {{Building_link|name=Cookhouse|s|display=notext}}
Loading...
5. {{Building_link|Cookhouse|large|display=notext}}
Loading...
6. {{Building_link|Cookhouse|large|display=notext|s}}
Loading...
7. {{Building_link|name=Cookhouse|size=large|s|display=notext}}
Loading...
8. {{Building_link|name=Cookhouse|size=large|display=notext|s}}
Loading...