Template:Recipe/doc: Difference between revisions

From Against the Storm Official Wiki
(separated the documentation page)
 
(no longer needed)
Tag: Blanking
 
Line 1: Line 1:
This template calls <code>renderRecipe</code> in '''Module:RenderRecipe''' to get recipes for a product and/or a building. This will generate a new wikitable full of content from the game: buildings, stars of efficiency, ingredients, and products.


This template standardizes the display of recipes throughout this wiki and greatly simplifies the amount of writing that is necessary when adding new content pages, especially for resources and buildings.
== Usage ==
The table will contain exactly one recipe if the template is given both a product and building. The table will (usually) contain more than one row if the template is given either a product or a building. If nothing is provided, for example <code><nowiki>{{Recipe}}</nowiki></code>, an error will appear instead.
Here are ways to call the template, as they would be written in the article calling the template:
{| class="wikitable"
! Argument !! Examples !! Expected outcome
|-
| None
| <code><nowiki>{{Recipe}}</nowiki></code>
| An error
|-
| Product and building
| style="white-space: nowrap" | <code><nowiki>{{Recipe|Crystalized Dew|Brickyard}}</nowiki></code> <br> <code><nowiki>{{Recipe|product=Crystalized Dew|building=Brickyard}}</nowiki></code>
| A table with one row.
|-
| Product only
| style="white-space: nowrap" | <code><nowiki>{{Recipe|Pie}}</nowiki></code> <br> <code><nowiki>{{Recipe|product=Pie}}</nowiki></code>
| A table with several rows, one for each building in which '''Pie''' can be produced.
|-
| Building only
| style="white-space: nowrap" | <code><nowiki>{{Recipe||Scribe}}</nowiki></code> ''(note the double pipe)'' <br> <code><nowiki>{{Recipe|building=Scribe}}</nowiki></code>
| A table with several rows, one for each product that can be produced in the '''Scribe.'''
|}
== Examples ==
The following are generated by calling the template, as shown in the examples in the table above.
<code><nowiki>{{Recipe}}</nowiki></code> yields:
{{Recipe}}
<code><nowiki>{{Recipe|Crystalized Dew|Brickyard}}</nowiki></code> yields:
{{Recipe|Crystalized Dew|Brickyard}}
<code><nowiki>{{Recipe|Pie}}</nowiki></code> yields:
{{Recipe|Pie}}
<code><nowiki>{{Recipe||Scribe}}</nowiki></code> yields:
{{Recipe||Scribe}}

Latest revision as of 17:36, 13 February 2023