Difference between revisions of "Template:Frac/output"

From blackwiki
Jump to navigation Jump to search
imported>Crissov
(link to old version of Sandbox)
imported>Jimp
(repurpose for number formatting)
Line 1: Line 1:
<onlyinclude><span class="frac nowrap" style="content: attr(data-sym); color: olive;"
+
{{#iferror:{{#expr:{{{1|A}}}+1}}
data-sym="{{{sym|{{#ifexpr: {{{int|0}}} = 0 |  | {{{int}}}&#x2064; }}{{#switch:
+
   |{{{1|}}}
  {{#iferror: {{#expr: {{{num|1}}}/{{{den|1}}} }} | string}}
+
   |{{#switch:{{{fmt|commas}}}
   |{{#expr:1/1}} = &#x2007;
+
    |gaps    ={{#invoke:String|replace|{{#invoke:gapnum|{{{1}}}}}|-|}}
   |{{#expr:1/2}} = ½
+
    |val
  |{{#expr:1/3}} = ⅓
+
    |gaps5   ={{val|{{{1}}}}}
  |{{#expr:2/3}} = ⅔
+
    |commas  ={{#invoke:String|replace|{{formatnum:{{{1}}}}}|-|−}}
  |{{#expr:1/4}} = ¼
+
    |commas5 ={{#invoke:String|replace|{{#ifexpr:(abs{{{1}}})<1E4|{{{1}}}|{{formatnum:{{{1}}}}}}}|-|}}
  |{{#expr:3/4}} = ¾
+
    |none    ={{{1}}}
  |{{#expr:1/5}} = ⅕
+
  }}
  |{{#expr:2/5}} = ⅖
+
}}
  |{{#expr:3/5}} = ⅗
 
  |{{#expr:4/5}} = ⅘
 
   |{{#expr:1/6}} = ⅙
 
  |{{#expr:1/7}} = ⅐
 
  |{{#expr:5/6}} = ⅚
 
  |{{#expr:1/8}} =
 
  |{{#expr:3/8}} = ⅜
 
  |{{#expr:5/8}} = ⅝
 
  |{{#expr:7/8}} = ⅞
 
  |{{#expr:1/9}} = ⅑
 
  |{{#expr:1/10}} = ⅒
 
  |string = {{{num|1}}}⁄{{{den|&infty;}}}
 
  |#default = {{#expr: ({{{num|1}}}) / {{gcd|{{{num|1}}}|{{{den|1}}}}} }}⁄{{#expr: ({{{den|1}}}) / {{gcd|{{{num|1}}}|{{{den|1}}}}} }}
 
}}}}}"
 
data-int="{{{int|0}}}">{{#ifexpr: {{{int|0}}} = 0 |  | {{{int}}}}}<span class="tion" style="color: navy;"
 
data-num="{{{num|1}}}"
 
data-den="{{{den|1}}}">{{{dec|}}}</span></span></onlyinclude><noinclude>
 
:See {{tl|frac/sandbox}} [http://en.wikipedia.org/wiki/Template:Frac/sandbox&oldid=527729326 old version]
 
</noinclude>
 

Revision as of 13:37, 26 November 2015