Difference between revisions of "Template:Ask Table Formatter"

From RimWorld Wiki
Jump to navigation Jump to search
m
Line 1: Line 1:
<noinclude>
+
<includeonly>
This row template is used in the [[Animals]] page
 
</noinclude>
 
<noinclude>{| {{STDT}}
 
|-
 
! Animal !! Amount !! Interval !! Daily Average
 
</noinclude>
 
 
|-
 
|-
 
! {{{1|Alpaca}}}
 
! {{{1|Alpaca}}}
| {{{2|-}}}
+
{{#if: {{{2|}}} | {{!}}{{!}} {{{2|}}}}}<!--
| {{{3|-}}}
+
-->{{#if: {{{3|}}} | {{!}}{{!}} {{{3|}}}}}<!--
| {{{4|-}}}
+
-->{{#if: {{{4|}}} | {{!}}{{!}} {{{4|}}}}}<!--
{{#if: {{{5|}}} | {{!}} {{{5|}}}}}
+
-->{{#if: {{{5|}}} | {{!}}{{!}} {{{5|}}}}}<!--
 +
-->{{#if: {{{6|}}} | {{!}}{{!}} {{{6|}}}}}<!--
 +
-->{{#if: {{{7|}}} | {{!}}{{!}} {{{7|}}}}}<!--
 +
-->{{#if: {{{8|}}} | {{!}}{{!}} {{{8|}}}}}<!--
 +
-->{{#if: {{{9|}}} | {{!}}{{!}} {{{9|}}}}}<!--
 +
-->{{#if: {{{10|}}} | {{!}}{{!}} {{{10|}}}}}
 +
</includeonly><noinclude>{{Move|reason=Not anything animal exlcusive, just useful for formatting tables in #asks. Move to a generic name}}{{Documentation wanted}}
 +
 
 +
This row template is used in the [[Animals]] page
 +
 
 +
<div><li style="display: inline-table;">
 +
{| {{STDT| sortable c_08 text-center}}
 +
! Animal !! Milk Amount !! Milking Interval !! Daily Milk Average
 
|-
 
|-
<noinclude>|}</noinclude>
+
{{#ask: [[Concept:Production Animals]] [[Milk Amount::+]] [[Milk Name::Milk]]
<noinclude>[[Category:Customized table templates]]
+
| ?Milk Amount
{{Delete|reason = Is this template necessary given you can do the below, with much more flexibility in adding and removing columns, without it? Is the darker animals column worth keeping the template?}}
+
| ?Milking Interval Days
<div><li style="display: inline-table;">
+
| ?Daily Milk Average
{{#ask: [[Concept:Production Animals]] [[Egg Laying Interval::+]]
+
| format = template
| ?Can Lay Unfertilized Eggs = Lays Unfert. Eggs
+
| template = Animals/ProductsRow
| ?Egg Laying Interval = Laying interval
+
| link = subject}}
| ?Real Hunger Rate = Hunger rate
+
|}
| mainlabel = Animal
+
</li><div>
| class = sortable c_08 text-center table
 
| link = subject
 
}}
 
</li></div>
 
  
  
</noinclude>
+
{{Documentation}} [[Category:Customized table templates]]</noinclude>

Revision as of 02:41, 1 May 2022

This row template is used in the Animals page

  • Animal Milk Amount Milking Interval Daily Milk Average
    Caribou 10 2 5
    Cow 14 1 14
    Dromedary 18 2 9
    Elk 11 1 11
    Goat 12 3 4
    Yak 11 1 11

  • Documentation icon Template documentation[view] [edit] [history] [purge]

    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

    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

    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
    Megascarab cocoon


    Megaspider 168
    Megaspider cocoon


    Spelopede 112
    Spelopede cocoon


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

  • Animal Milk Amount Milking
    Interval
    Milk/Day
    (Average)
    Milk / food consumed
    per day
    Nutrition / food consumed
    per day
    Caribou 10 2 5
    Cow 14 1 14
    Dromedary 18 2 9
    Elk 11 1 11
    Goat 12 3 4
    Yak 11 1 11