Template:GP: Difference between revisions

From Melvor Idle
(Use class in place of inline styles)
(Handle non-numeric parameters without generating expression errors)
Line 1: Line 1:
<includeonly><onlyinclude><span class="img-text" data-sort-value="{{{1|0}}}"><span {{#ifexpr:{{formatnum:{{{1|0}}}|R}}<0|style="color:red"}}>{{formatnum:{{{1|}}}}}</span>{{#if:{{{2|}}}|{{#ifeq:{{{1|}}}|{{{2|}}}||&nbsp;-&nbsp;<span {{#ifexpr:{{formatnum:{{{2}}}|R}}<0|style="color:red"}}>{{formatnum:{{{2}}}}}</span>}}}}&nbsp;[[File:Coins.svg|23x23px|link=Currency|alt=GP]]</span></onlyinclude></includeonly><noinclude>{{/doc}}</noinclude>
<includeonly><onlyinclude><span class="img-text" data-sort-value="{{{1|0}}}">{{IfNumber|{{{1|}}}|{{#ifexpr:{{formatnum:{{{1|0}}}|R}}<0|<span style="color:red>{{formatnum:{{{1|0}}}}}</span>|{{formatnum:{{{1|0}}}}}}}{{IfNumber|{{{2|}}}|&nbsp;-&nbsp;{{#ifexpr:{{formatnum:{{{2|0}}}|R}}<0|<span style="color:red>{{formatnum:{{{2|0}}}}}</span>|{{formatnum:{{{2|0}}}}}}}|}}|{{{1|}}}}}{{#ifeq:{{{1|}}}|||&nbsp;}}[[File:Coins.svg|23x23px|link=Currency|alt=GP]]</span></onlyinclude></includeonly><noinclude>{{/doc}}</noinclude>

Revision as of 23:33, 25 April 2024

A template for quickly inserting GP costs. For example, {{GP|5000}} becomes 5,000 GP and {{GP|-5000}} becomes −5,000 GP.

For a range of values, use two arguments. For example, {{GP|-100|5000}} becomes −100 - 5,000 GP. If both values are the same, no dash is used. For example {{GP|100|100}} becomes 100 - 100 GP