Difference between revisions of "Template:Change/doc"

From Ava Zinn Wiki
Jump to: navigation, search
[unchecked revision][unchecked revision]
m (29 revisions from wikipedia:Template:Change/doc)
 
(6 intermediate revisions by 3 users not shown)
Line 5: Line 5:
 
The syntax for this template is as follows.
 
The syntax for this template is as follows.
  
<code><nowiki>{{</nowiki>change|''1st No.''|''2nd No.''|dec=''rounding''|pre=''prefix''|suf=''suffix''|italics=''on/off''|bold=''on/off''|invert=''on/off''|disp=''row/out''|rowspan=''rowspan''|align=''alignment''|bgcolour=''background colour''}}</code>
+
<code><nowiki>{{</nowiki>change|''1st No.''|''2nd No.''|dec=''rounding''|pre=''prefix''|suf=''suffix''|sort=''on/off''|italics=''on/off''|bold=''on/off''|invert=''on/off''|disp=''row/out''|rowspan=''rowspan''|align=''alignment''|bgcolour=''background colour''}}</code>
  
 
{|class=wikitable
 
{|class=wikitable
Line 21: Line 21:
 
|-
 
|-
 
|<code>suf</code>||This adds a suffix to the first and second numbers.
 
|<code>suf</code>||This adds a suffix to the first and second numbers.
 +
|-
 +
|<code>sort</code>||This adds or removes the {{tl|nts}}-compatible sort key from the first two cells.  The default is only to add this if a prefix or suffix is used (i.e. only if needed).
 
|-
 
|-
 
|<code>italics</code>||This can either have the value of <code>on</code> or <code>off</code>.  <code>italics=on</code> makes the output italic.  The default is <code>italics=off</code>.
 
|<code>italics</code>||This can either have the value of <code>on</code> or <code>off</code>.  <code>italics=on</code> makes the output italic.  The default is <code>italics=off</code>.
Line 32: Line 34:
 
|<code>rowspan</code>||This adjust the row span of cells.  The default is  <code>rowspan=1</code>.
 
|<code>rowspan</code>||This adjust the row span of cells.  The default is  <code>rowspan=1</code>.
 
|-
 
|-
|<code>bgcolour</code>||This adjusts the background colour of cells.  The default is <code>bgcolour=white</code>.
+
|<code>bgcolour</code>||This adjusts the background colour of cells.  The default is <code>bgcolour=#F9F9F9</code> (light grey).
 
|-
 
|-
 
|<code>disp</code>||This controls what is output.  <code>disp=out</code> produces the percentage change only (and thus <code>align</code>, <code>rowspan</code> and <code>bgcolour</code> do not work with <code>disp=out</code>).  The default is <code>disp=row</code> which produces three cells in a table row.
 
|<code>disp</code>||This controls what is output.  <code>disp=out</code> produces the percentage change only (and thus <code>align</code>, <code>rowspan</code> and <code>bgcolour</code> do not work with <code>disp=out</code>).  The default is <code>disp=row</code> which produces three cells in a table row.
Line 81: Line 83:
 
|{{change|2250000|2236005.56|align=center}}
 
|{{change|2250000|2236005.56|align=center}}
 
|-
 
|-
|bgcolor=lightblue|Fox Hollow
+
| style="background-color:lightblue" |Fox Hollow
 
|{{change|1180000|1190345.32|bgcolour=lightblue}}
 
|{{change|1180000|1190345.32|bgcolour=lightblue}}
 
|-
 
|-
Line 137: Line 139:
 
|{{change|2250000|2236005.56|align=center}}
 
|{{change|2250000|2236005.56|align=center}}
 
|-
 
|-
|bgcolor=lightblue|Fox Hollow
+
| style="background-color:lightblue" |Fox Hollow
 
|{{change|1180000|1190345.32|bgcolour=lightblue}}
 
|{{change|1180000|1190345.32|bgcolour=lightblue}}
 
|-
 
|-
Line 187: Line 189:
 
|-
 
|-
 
|Lakewood
 
|Lakewood
|{{change|2250000|2236005.56|align=center|disp=out}}
+
|{{change|2250000|2236005.56| style="text-align:center;" |disp=out}}
 
|-
 
|-
|bgcolor=lightblue|Fox Hollow
+
| style="background-color:lightblue" |Fox Hollow
 
|{{change|1180000|1190345.32|bgcolour=lightblue|disp=out}}
 
|{{change|1180000|1190345.32|bgcolour=lightblue|disp=out}}
 
|-
 
|-
Line 202: Line 204:
 
|-
 
|-
 
|Upstart
 
|Upstart
|{{change|0|26250.50|align=left|disp=out}}
+
|{{change|0|26250.50| style="text-align:left;" |disp=out}}
 
|}
 
|}
 
|-
 
|-
Line 241: Line 243:
 
|-
 
|-
 
|Lakewood
 
|Lakewood
|{{change|2250000|2236005.56|align=center|invert=on}}
+
|{{change|2250000|2236005.56| style="text-align:center;" |invert=on}}
 
|-
 
|-
|bgcolor=lightblue|Fox Hollow
+
| style="background-color:lightblue" |Fox Hollow
 
|{{change|1180000|1190345.32|bgcolour=lightblue|invert=on}}
 
|{{change|1180000|1190345.32|bgcolour=lightblue|invert=on}}
 
|-
 
|-
Line 256: Line 258:
 
|-
 
|-
 
|Upstart
 
|Upstart
|{{change|0|26250.50|align=left|invert=on}}
+
|{{change|0|26250.50| style="text-align:left;" |invert=on}}
 
|}
 
|}
 
|||
 
|||
Line 291: Line 293:
 
|-
 
|-
 
|Lakewood
 
|Lakewood
|{{change|2250000|2236005.56|align=center|disp=out|invert=on}}
+
|{{change|2250000|2236005.56| style="text-align:center;" |disp=out|invert=on}}
 
|-
 
|-
|bgcolor=lightblue|Fox Hollow
+
| style="background-color:lightblue" |Fox Hollow
 
|{{change|1180000|1190345.32|bgcolour=lightblue|disp=out|invert=on}}
 
|{{change|1180000|1190345.32|bgcolour=lightblue|disp=out|invert=on}}
 
|-
 
|-
Line 306: Line 308:
 
|-
 
|-
 
|Upstart
 
|Upstart
|{{change|0|26250.50|align=left|disp=out|invert=on}}
+
|{{change|0|26250.50| style="text-align:left;" |disp=out|invert=on}}
 
|}
 
|}
 
|}
 
|}
 +
 +
This template uses [[Module:Math]] and [[Template:ntsh]], and produces a sort compatible with [[Template:nts]] and [[Template:ntsh]].
  
 
<includeonly>
 
<includeonly>
 
[[Category:Mathematical formatting templates]]
 
[[Category:Mathematical formatting templates]]
[[Category:Mathematical function templates]]
+
[[Category:Templates based on the Math Lua module]]
 
[[Category:Sorting templates]]
 
[[Category:Sorting templates]]
 
</includeonly>
 
</includeonly>

Latest revision as of 08:32, 15 March 2016

Use[edit]

This template calculates the percent change between two real number values and displays the result in a sortable format.

The syntax for this template is as follows.

{{change|1st No.|2nd No.|dec=rounding|pre=prefix|suf=suffix|sort=on/off|italics=on/off|bold=on/off|invert=on/off|disp=row/out|rowspan=rowspan|align=alignment|bgcolour=background colour}}

parameter function
1 1st No. is the first number displayed representing the base value.
2 2nd No. is the second number displayed representing the object value.
dec This is the number of decimal places to round the percentage change to.
pre This adds a prefix to the first and second numbers.
suf This adds a suffix to the first and second numbers.
sort This adds or removes the {{nts}}-compatible sort key from the first two cells. The default is only to add this if a prefix or suffix is used (i.e. only if needed).
italics This can either have the value of on or off. italics=on makes the output italic. The default is italics=off.
bold This can either have the value of on or off. bolds=on makes the output bold. The default is bold=off.
invert This can either have the value of on or off. invert=on switches the base and object values in the calculation of percentage change. The default is invert=off.
align This adjusts the alignment of text in cells. align=center and align=left aligns the text to the centre and left respectively. The default is align=right.
rowspan This adjust the row span of cells. The default is rowspan=1.
bgcolour This adjusts the background colour of cells. The default is bgcolour=#F9F9F9 (light grey).
disp This controls what is output. disp=out produces the percentage change only (and thus align, rowspan and bgcolour do not work with disp=out). The default is disp=row which produces three cells in a table row.

The following sortable tables illustrate the use of this template.

Wiki markup Tables
{|class="wikitable sortable"
!Region
!first
!second
!change
|-
|Big Meadow
|{{change|1830000|1900679.75}}
|-
|Little Meadow
|{{change|400000|500000}}
|-
|Mount Acme
|{{change|2450000|2205678.37}}
|-
|Acmevale North
|{{change|1250000|1000000|rowspan=2}}
|-
|Acmevale South
|-
|Homeport
|{{change|5120000|5589462.60|dec=0}}
|-
|Longwood
|{{change|930000|930027.92|dec=3}}
|-
|Meadowbrook
|{{change|2450000|2450000.00|pre=$}}
|-
|Johnstown
|{{change|3400000|3902340.05|suf= kg}}
|-
|Lakewood
|{{change|2250000|2236005.56|align=center}}
|-
| style="background-color:lightblue" |Fox Hollow
|{{change|1180000|1190345.32|bgcolour=lightblue}}
|-
|Riverton
|{{change|10550000|11236005.55|bold=on}}
|-
|Timber Creek
|{{change|1360000|1310948.30|italics=on}}
|-
|Terminated
|{{change|1500|0.00|bold=on|italics=on}}
|-
|Upstart
|{{change|0|26250.50|align=left}}
|-
|}
Without extra code
Region first second change
Big Meadow +3.86%
Little Meadow +25.00%
Mount Acme −9.97%
Acmevale North −20.00%
Acmevale South
Homeport +9%
Longwood +0.003%
Meadowbrook 0.00%
Johnstown +14.77%
Lakewood −0.62%
Fox Hollow +0.88%
Riverton +6.50%
Timber Creek −3.61%
Terminated −100.00%
Upstart NA
With |disp=out
Region change
Big Meadow +3.86%
Little Meadow +25.00%
Mount Acme −9.97%
Acmevale North −20.00%
Acmevale South
Homeport +9%
Longwood +0.003%
Meadowbrook 0.00%
Johnstown +14.77%
Lakewood −0.62%
Fox Hollow +0.88%
Riverton +6.50%
Timber Creek −3.61%
Terminated −100.00%
Upstart NA
With |invert=on
Region first second change
Big Meadow +3.86%
Little Meadow +25.00%
Mount Acme −9.97%
Acmevale North −20.00%
Acmevale South
Homeport +9%
Longwood +0.003%
Meadowbrook 0.00%
Johnstown +14.77%
Lakewood −0.62%
Fox Hollow +0.88%
Riverton +6.50%
Timber Creek −3.61%
Terminated −100.00%
Upstart NA
With |invert=on and |disp=out
Region change
Big Meadow +3.86%
Little Meadow +25.00%
Mount Acme −9.97%
Acmevale North −20.00%
Acmevale South
Homeport +9%
Longwood +0.003%
Meadowbrook 0.00%
Johnstown +14.77%
Lakewood −0.62%
Fox Hollow +0.88%
Riverton +6.50%
Timber Creek −3.61%
Terminated −100.00%
Upstart NA

This template uses Module:Math and Template:ntsh, and produces a sort compatible with Template:nts and Template:ntsh.