Difference between revisions of "Template:Temperature"

From RimWorld Wiki
Jump to navigation Jump to search
(made sure input expressions are handled correctly)
(Nonbreaking space makes formatting messy and instead splits it between the terms)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
<onlyinclude>{{#if:{{{1|}}}|{{formatnum:{{#expr:{{{1|}}}}}}}&nbsp;<abbr title="Celsius">°C</abbr>{{#if:{{{2|}}}|&nbsp;–&nbsp;{{formatnum:{{#expr:{{{2|}}}}}}}&nbsp;<abbr title="Celsius">°C</abbr>}}&nbsp;({{formatnum:{{#expr:(((({{{1|}}})*9)/5)+{{#ifeq:{{{3|}}}|delta|0|32}})round 1}} }}&nbsp;<abbr title="Fahrenheit">°F</abbr>{{#if:{{{2|}}}|&nbsp;–&nbsp;{{formatnum:{{#expr:(((({{{2|}}})*9)/5)+{{#ifeq:{{{3|}}}|delta|0|32}})round 1}}}}&nbsp;<abbr title="Fahrenheit">°F</abbr>}})}}<nowiki /></onlyinclude>
+
<onlyinclude>{{#if:{{{1|}}}|{{formatnum:{{#expr:{{{1|}}}}}}}&nbsp;<abbr title="Celsius">°C</abbr>{{#if:{{{2|}}}|&nbsp;– {{formatnum:{{#expr:{{{2|}}}}}}}&nbsp;<abbr title="Celsius">°C</abbr>}} ({{formatnum:{{#expr:(((({{{1|}}})*9)/5)+{{#ifeq:{{{3|}}}|delta|0|32}})round 1}}}}&nbsp;<abbr title="Fahrenheit">°F</abbr>{{#if:{{{2|}}}|&nbsp;– {{formatnum:{{#expr:(((({{{2|}}})*9)/5)+{{#ifeq:{{{3|}}}|delta|0|32}})round 1}}}}&nbsp;<abbr title="Fahrenheit">°F</abbr>}})}}</onlyinclude>
 
<noinclude>{{documentation}}</noinclude>
 
<noinclude>{{documentation}}</noinclude>

Latest revision as of 02:28, 13 July 2022

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

Description[edit]

This template is used to take a temperature value in Celsius, so it can then display both Celsius and Fahrenheit.

The template accepts both numbers and expressions as inputs.

Syntax[edit]

Type {{Temperature|<X>}} on the page to be marked, where X is your temperature value in Celsius.

To display a range of temperatures, type {{Temperature|<X>|<Y>}} on the page to be marked, where X and Y are the bounds of your temperature range in Celsius.

To display a temperature difference rather than an absolute temperature type {{Temperature|X||delta}} or {{Temperature|<X>|<Y>|<delta>}}.

Example 1[edit]

Absolute temperature: {{Temperature|20}}

20 °C (68 °F)

Example 2[edit]

Absolute temperature: {{Temperature|32}}

32 °C (89.6 °F)

Example 3[edit]

Absolute temperature range: {{Temperature|20|32}}

20 °C – 32 °C (68 °F – 89.6 °F)

Example 4[edit]

Temperature difference: {{Temperature|20||delta}}

20 °C (36 °F)

Example 5[edit]

Temperature difference range: {{Temperature|20|32|delta}}

20 °C – 32 °C (36 °F – 57.6 °F)