Difference between revisions of "Template:%/doc"

From RimWorld Wiki
Jump to navigation Jump to search
m
(documentation of rounding parameter)
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:
 
This template can be used to convert numbers into percentages.
 
This template can be used to convert numbers into percentages.
  
The template has only one parameter which can be any number or expression.
+
The template has two parameters:
 +
 
 +
* The first parameter is the '''value that will be converted into a percentage''' and can be any '''number''' or '''expression'''. This parameter is ''mandatory''.
 +
* The second parameter controls the '''number of digits after the decimal point''' and needs to be an '''integer'''. This parameter is ''optional''.
  
 
=== Examples ===
 
=== Examples ===
 
<code><nowiki>{{%|0.357}}</nowiki></code> would produce: {{%|0.357}}
 
<code><nowiki>{{%|0.357}}</nowiki></code> would produce: {{%|0.357}}
 +
 +
<code><nowiki>{{%|0.357|0}}</nowiki></code> would produce: {{%|0.357|0}}
  
 
<code><nowiki>{{%|{{Q|Barricade|Cover Effectiveness}}}}</nowiki></code> would produce: {{%|{{Q|Barricade|Cover Effectiveness}}}}
 
<code><nowiki>{{%|{{Q|Barricade|Cover Effectiveness}}}}</nowiki></code> would produce: {{%|{{Q|Barricade|Cover Effectiveness}}}}
Line 11: Line 16:
 
<code><nowiki>{{%|1-{{Q|Barricade|Cover Effectiveness}}}}</nowiki></code> would produce: {{%|1-{{Q|Barricade|Cover Effectiveness}}}}
 
<code><nowiki>{{%|1-{{Q|Barricade|Cover Effectiveness}}}}</nowiki></code> would produce: {{%|1-{{Q|Barricade|Cover Effectiveness}}}}
  
<includeonly>[[Category:Formatting templates| ]]</includeonly>
+
<includeonly>[[Category:Formatting templates]]</includeonly>
 
<noinclude>[[Category:Template documentation]]</noinclude>
 
<noinclude>[[Category:Template documentation]]</noinclude>

Latest revision as of 12:29, 24 April 2022

Usage[edit]

This template can be used to convert numbers into percentages.

The template has two parameters:

  • The first parameter is the value that will be converted into a percentage and can be any number or expression. This parameter is mandatory.
  • The second parameter controls the number of digits after the decimal point and needs to be an integer. This parameter is optional.

Examples[edit]

{{%|0.357}} would produce: 35.7%

{{%|0.357|0}} would produce: 36%

{{%|{{Q|Barricade|Cover Effectiveness}}}} would produce: 55%

{{%|1-{{Q|Barricade|Cover Effectiveness}}}} would produce: 45%