Difference between revisions of "Template:Ask Table Formatter"
Jump to navigation
Jump to search
(Failed experiment. Reverting) |
|||
Line 1: | Line 1: | ||
<includeonly> | <includeonly> | ||
|- | |- | ||
− | ! {{{1|Alpaca}}} | + | ! [[{{{1|Alpaca}}}]] |
{{#if: {{{2|}}} | {{!}}{{!}} {{{2|}}}}}<!-- | {{#if: {{{2|}}} | {{!}}{{!}} {{{2|}}}}}<!-- | ||
-->{{#if: {{{3|}}} | {{!}}{{!}} {{{3|}}}}}<!-- | -->{{#if: {{{3|}}} | {{!}}{{!}} {{{3|}}}}}<!-- | ||
Line 10: | Line 10: | ||
-->{{#if: {{{8|}}} | {{!}}{{!}} {{{8|}}}}}<!-- | -->{{#if: {{{8|}}} | {{!}}{{!}} {{{8|}}}}}<!-- | ||
-->{{#if: {{{9|}}} | {{!}}{{!}} {{{9|}}}}}<!-- | -->{{#if: {{{9|}}} | {{!}}{{!}} {{{9|}}}}}<!-- | ||
− | -->{{#if: {{{10|}}} | {{!}}{{!}} {{{10|}}}}} | + | -->{{#if: {{{10|}}} | {{!}}{{!}} {{{10|}}}}}<!-- |
− | </includeonly><noinclude>{{Documentation wanted}} | + | -->{{#if: {{#varexists:formatterNumeratorVariable1}} | {{#if: {{#varexists:formatterDenominatorVariable1}} |{{!}}{{!}} {{#expr:{{Q|{{{1|}}}|{{#var:formatterNumeratorVariable1}}}}/{{Q|{{{1|}}}|{{#var:formatterDenominatorVariable1}}}} round 2}} }} }}<!-- |
+ | -->{{#if: {{#varexists:formatterNumeratorVariable2}} | {{#if: {{#varexists:formatterDenominatorVariable2}} |{{!}}{{!}} {{#expr:{{Q|{{{1|}}}|{{#var:formatterNumeratorVariable2}}}}/{{Q|{{{1|}}}|{{#var:formatterDenominatorVariable2}}}} round 2}} }} }}<!-- | ||
+ | -->{{#if: {{#varexists:formatterNumeratorVariable3}} | {{#if: {{#varexists:formatterDenominatorVariable3}} |{{!}}{{!}} {{#expr:{{Q|{{{1|}}}|{{#var:formatterNumeratorVariable3}}}}/{{Q|{{{1|}}}|{{#var:formatterDenominatorVariable3}}}} round 2}} }} }}</includeonly><noinclude>{{Documentation wanted}} | ||
This row template is used in the [[Animals]] page | This row template is used in the [[Animals]] page | ||
+ | {{#vardefine:formatterNumeratorVariable1|Daily Milk Average}} | ||
+ | {{#vardefine:formatterDenominatorVariable1|Real Hunger Rate}} | ||
<div><li style="display: inline-table;"> | <div><li style="display: inline-table;"> | ||
{| {{STDT| sortable c_08 text-center}} | {| {{STDT| sortable c_08 text-center}} | ||
Line 25: | Line 29: | ||
| format = template | | format = template | ||
| template = Animals/ProductsRow | | template = Animals/ProductsRow | ||
− | | link = | + | | link = none}} |
|} | |} | ||
</li><div> | </li><div> |
Revision as of 06:16, 19 June 2022
This page has been marked as needing documentation of its function and purpose. You can help RimWorld Wiki by creating it here |
This row template is used in the Animals page
Animal | Milk Amount | Milking Interval | Daily Milk Average | |
---|---|---|---|---|
Caribou | 10 | 2 | 5 | 11.36 |
Cow | 14 | 1 | 14 | 16.28 |
Dromedary | 18 | 2 | 9 | 10.47 |
Elk | 11 | 1 | 11 | 12.79 |
Goat | 12 | 3 | 4 | 11.11 |
Yak | 11 | 1 | 11 | 12.79 |
This template allows any table created by the "#ask" to use the Template: STDT formatting properly, including the shaded first cell.
Parameters
This template does not use traditional template parameters, instead it is fed up to 10 parameters to display by the #ask itself. Further, up to three ratios can be defined to be displayed as the final columns in the table be defining the following wiki variables
- Ratio 1 = formatterNumeratorVariable1 / formatterDenominatorVariable1 * formatterFactorVariable1
- Ratio 2 = formatterNumeratorVariable2 / formatterDenominatorVariable2 * formatterFactorVariable2
- Ratio 3 = formatterNumeratorVariable3 / formatterDenominatorVariable3 * formatterFactorVariable3
Keep in mind the whitespace created when defining these variables on new lines.
Note: the #ask must also use the | link = none
parameter.
Examples
Example 1 - Basic
<div><li style="display: inline-table;"> {| {{STDT| sortable c_08 text-center}} ! Insectoid !! Meat Amount |- {{#ask: [[Category:Insectoid]] | ?Meat Yield | format = template | template = Ask Table Formatter | link = none }} </li></div>
Produces:
Insectoid | Meat Amount | |
---|---|---|
Megascarab | 31 | Expression error: Unexpected / operator. |
Megascarab cocoon | Expression error: Unexpected / operator. | |
Megaspider | 168 | Expression error: Unexpected / operator. |
Megaspider cocoon | Expression error: Unexpected / operator. | |
Spelopede | 112 | Expression error: Unexpected / operator. |
Spelopede cocoon | Expression error: Unexpected / operator. |
Example 2 - Ratios
<div><li style="display: inline-table;">{{#vardefine:formatterNumeratorVariable1|Daily Milk Average}}{{#vardefine:formatterDenominatorVariable1|Real Hunger Rate}}{{#vardefine:formatterNumeratorVariable2|Daily Milk Average}}{{#vardefine:formatterDenominatorVariable2|Real Hunger Rate}}{{#vardefine:formatterFactorVariable2|0.05}} {| {{STDT| sortable c_08 text-center}} ! Animal !! Milk Amount !! Milking<br/>Interval !! Milk/Day<br/>(Average) !! Milk / food consumed<br/>per day !! Nutrition / food consumed<br/>per day |- {{#ask: [[Concept:Production Animals]] [[Milk Amount::+]] [[Milk Name::Milk]] | ?Milk Amount | ?Milking Interval Days | ?Daily Milk Average | format = template | template = Ask Table Formatter | link = none}} |} </li></div>
Produces:
The above documentation is transcluded from Template:Ask Table Formatter/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |