Difference between revisions of "Template:Ask Table Formatter/doc"

From RimWorld Wiki
Jump to navigation Jump to search
(close <div>)
 
(2 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
== Parameters ==
 
== 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
 
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
+
# Ratio 1 = formatterNumeratorVariable1 / formatterDenominatorVariable1 * formatterFactorVariable1
# Ratio 2 = formatterNumeratorVariable2/formatterDenominatorVariable2
+
# Ratio 2 = formatterNumeratorVariable2 / formatterDenominatorVariable2 * formatterFactorVariable2
# Ratio 3 = formatterNumeratorVariable3/formatterDenominatorVariable3
+
# Ratio 3 = formatterNumeratorVariable3 / formatterDenominatorVariable3 * formatterFactorVariable3
 
Keep in mind the whitespace created when defining these variables on new lines.
 
Keep in mind the whitespace created when defining these variables on new lines.
  
Line 41: Line 41:
 
=== Example 2 - Ratios ===
 
=== Example 2 - Ratios ===
 
<pre>
 
<pre>
<div><li style="display: inline-table;">{{#vardefine:formatterNumeratorVariable1|Daily Milk Average}}{{#vardefine:formatterDenominatorVariable1|Real Hunger Rate}}
+
<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}}
 
{| {{STDT| sortable c_08 text-center}}
! Animal !! Milk Amount !! Milking Interval !! Daily Milk Average !! Daily Milk/Nutrition
+
! 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]]
 
{{#ask: [[Concept:Production Animals]] [[Milk Amount::+]] [[Milk Name::Milk]]
| ?Milk Amount
+
| ?Milk Amount
| ?Milking Interval Days
+
| ?Milking Interval Days
| ?Daily Milk Average
+
| ?Daily Milk Average
| format = template
+
| format = template
| template = Ask Table Formatter
+
| template = Ask Table Formatter
| link = none
+
| link = none}}
}}
+
|}
 
</li></div>
 
</li></div>
 
</pre>
 
</pre>
 
Produces:
 
Produces:
  
<div><li style="display: inline-table;">{{#vardefine:formatterNumeratorVariable1|Daily Milk Average}}{{#vardefine:formatterDenominatorVariable1|Real Hunger Rate}}
+
<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}}
 
{| {{STDT| sortable c_08 text-center}}
! Animal !! Milk Amount !! Milking Interval !! Daily Milk Average !! Daily Milk/Nutrition
+
! 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]]
 
{{#ask: [[Concept:Production Animals]] [[Milk Amount::+]] [[Milk Name::Milk]]
| ?Milk Amount
+
| ?Milk Amount
| ?Milking Interval Days
+
| ?Milking Interval Days
| ?Daily Milk Average
+
| ?Daily Milk Average
| format = template
+
| format = template
| template = Ask Table Formatter
+
| template = Ask Table Formatter
| link = none
+
| link = none}}
}}
 
 
|}
 
|}
 
</li></div>
 
</li></div>
 
  
 
<noinclude>[[Category:Template documentation]]</noinclude>
 
<noinclude>[[Category:Template documentation]]</noinclude>
 
<includeonly>[[Category:Customized table templates|#Ask Table Formatter]]</includeonly>
 
<includeonly>[[Category:Customized table templates|#Ask Table Formatter]]</includeonly>

Latest revision as of 13:29, 20 December 2023

This template allows any table created by the "#ask" to use the Template: STDT formatting properly, including the shaded first cell.

Parameters[edit]

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

  1. Ratio 1 = formatterNumeratorVariable1 / formatterDenominatorVariable1 * formatterFactorVariable1
  2. Ratio 2 = formatterNumeratorVariable2 / formatterDenominatorVariable2 * formatterFactorVariable2
  3. 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[edit]

Example 1 - Basic[edit]

<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
    Megascarab cocoon Content added by the Biotech DLC
    Megaspider 168
    Megaspider cocoon Content added by the Biotech DLC
    Spelopede 112
    Spelopede cocoon Content added by the Biotech DLC
  • Example 2 - Ratios[edit]

    <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:

  • Animal Milk Amount Milking
    Interval
    Milk/Day
    (Average)
    Milk / food consumed
    per day
    Nutrition / food consumed
    per day
    Caribou 10 2 5 11.36 0.57
    Cow 14 1 14 16.28 0.81
    Dromedary 18 2 9 10.47 0.52
    Elk 11 1 11 12.79 0.64
    Goat 12 3 4 11.11 0.56
    Yak 11 1 11 12.79 0.64