Skip to content

Commit 935c390

Browse files
committed
Format
1 parent 12738c8 commit 935c390

File tree

4 files changed

+84
-24
lines changed

4 files changed

+84
-24
lines changed

README.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -429,19 +429,20 @@ Format
429429
{1.23456:10.3%} # ' 123.456%'
430430
```
431431

432+
#### Comparison of float presentation types:
432433
```text
433-
+---------------+--------------+---------------+---------------+---------------+
434-
| | {<float>:.2} | {<float>:.2f} | {<float>:.2e} | {<float>:.2%} |
435-
+---------------+--------------+---------------+---------------+---------------+
436-
| 0.00056789 | '0.00057' | '0.00' | '5.68e-04' | '0.06%' |
437-
| 0.0056789 | '0.0057' | '0.01' | '5.68e-03' | '0.57%' |
438-
| 0.056789 | '0.057' | '0.06' | '5.68e-02' | '5.68%' |
439-
| 0.56789 | '0.57' | '0.57' | '5.68e-01' | '56.79%' |
440-
| 5.6789 | '5.7' | '5.68' | '5.68e+00' | '567.89%' |
441-
| 56.789 | '5.7e+01' | '56.79' | '5.68e+01' | '5678.90%' |
442-
| 567.89 | '5.7e+02' | '567.89' | '5.68e+02' | '56789.00%' |
443-
| 5678.9 | '5.7e+03' | '5678.90' | '5.68e+03' | '567890.00%' |
444-
+---------------+--------------+---------------+---------------+---------------+
434+
+----------------+--------------+---------------+---------------+---------------+
435+
| | {<float>:.2} | {<float>:.2f} | {<float>:.2e} | {<float>:.2%} |
436+
+----------------+--------------+---------------+---------------+---------------+
437+
| 0.000056789 | '5.7e-05' | '0.00' | '5.68e-05' | '0.01%' |
438+
| 0.00056789 | '0.00057' | '0.00' | '5.68e-04' | '0.06%' |
439+
| 0.0056789 | '0.0057' | '0.01' | '5.68e-03' | '0.57%' |
440+
| 0.056789 | '0.057' | '0.06' | '5.68e-02' | '5.68%' |
441+
| 0.56789 | '0.57' | '0.57' | '5.68e-01' | '56.79%' |
442+
| 5.6789 | '5.7' | '5.68' | '5.68e+00' | '567.89%' |
443+
| 56.789 | '5.7e+01' | '56.79' | '5.68e+01' | '5678.90%' |
444+
| 567.89 | '5.7e+02' | '567.89' | '5.68e+02' | '56789.00%' |
445+
+----------------+--------------+---------------+---------------+---------------+
445446
```
446447

447448
### Ints

index.html

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -500,18 +500,19 @@ <h3 id="floats">Floats</h3>
500500
{<span class="hljs-number">1.23456</span>:<span class="hljs-number">10.3</span>e} <span class="hljs-comment"># ' 1.235e+00'</span>
501501
{<span class="hljs-number">1.23456</span>:<span class="hljs-number">10.3</span>%} <span class="hljs-comment"># ' 123.456%'</span>
502502
</code></pre>
503-
<pre><code class="text language-text">+---------------+--------------+---------------+---------------+---------------+
504-
| | {&lt;float&gt;:.2} | {&lt;float&gt;:.2f} | {&lt;float&gt;:.2e} | {&lt;float&gt;:.2%} |
505-
+---------------+--------------+---------------+---------------+---------------+
506-
| 0.00056789 | '0.00057' | '0.00' | '5.68e-04' | '0.06%' |
507-
| 0.0056789 | '0.0057' | '0.01' | '5.68e-03' | '0.57%' |
508-
| 0.056789 | '0.057' | '0.06' | '5.68e-02' | '5.68%' |
509-
| 0.56789 | '0.57' | '0.57' | '5.68e-01' | '56.79%' |
510-
| 5.6789 | '5.7' | '5.68' | '5.68e+00' | '567.89%' |
511-
| 56.789 | '5.7e+01' | '56.79' | '5.68e+01' | '5678.90%' |
512-
| 567.89 | '5.7e+02' | '567.89' | '5.68e+02' | '56789.00%' |
513-
| 5678.9 | '5.7e+03' | '5678.90' | '5.68e+03' | '567890.00%' |
514-
+---------------+--------------+---------------+---------------+---------------+
503+
<h4 id="comparisonoffloatpresentationtypes">Comparison of float presentation types:</h4>
504+
<pre><code class="text language-text">┏━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓
505+
┃ │ {&lt;float&gt;:.2} │ {&lt;float&gt;:.2f} │ {&lt;float&gt;:.2e} │ {&lt;float&gt;:.2%} ┃
506+
┠────────────────┼──────────────┼───────────────┼───────────────┼───────────────┨
507+
┃ 0.000056789 │ '5.7e-05' │ '0.00' │ '5.68e-05' │ '0.01%' ┃
508+
┃ 0.00056789 │ '0.00057' │ '0.00' │ '5.68e-04' │ '0.06%' ┃
509+
┃ 0.0056789 │ '0.0057' │ '0.01' │ '5.68e-03' │ '0.57%' ┃
510+
┃ 0.056789 │ '0.057' │ '0.06' │ '5.68e-02' │ '5.68%' ┃
511+
┃ 0.56789 │ '0.57' │ '0.57' │ '5.68e-01' │ '56.79%' ┃
512+
┃ 5.6789 │ '5.7' │ '5.68' │ '5.68e+00' │ '567.89%' ┃
513+
┃ 56.789 │ '5.7e+01' │ '56.79' │ '5.68e+01' │ '5678.90%' ┃
514+
┃ 567.89 │ '5.7e+02' │ '567.89' │ '5.68e+02' │ '56789.00%' ┃
515+
┗━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛
515516
</code></pre>
516517
<h3 id="ints">Ints</h3>
517518
<pre><code class="python language-python hljs">{<span class="hljs-number">90</span>:c} <span class="hljs-comment"># 'Z'</span>

parse.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,34 @@ const DIAGRAM_4_B =
112112
'┃ complex │ │ │ │ ✓ │ ✓ ┃\n' +
113113
'┗━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━┷━━━━━━━━━┷━━━━━━━━┛\n';
114114

115+
const DIAGRAM_5_A =
116+
"+----------------+--------------+---------------+---------------+---------------+\n" +
117+
"| | {<float>:.2} | {<float>:.2f} | {<float>:.2e} | {<float>:.2%} |\n" +
118+
"+----------------+--------------+---------------+---------------+---------------+\n" +
119+
"| 0.000056789 | '5.7e-05' | '0.00' | '5.68e-05' | '0.01%' |\n" +
120+
"| 0.00056789 | '0.00057' | '0.00' | '5.68e-04' | '0.06%' |\n" +
121+
"| 0.0056789 | '0.0057' | '0.01' | '5.68e-03' | '0.57%' |\n" +
122+
"| 0.056789 | '0.057' | '0.06' | '5.68e-02' | '5.68%' |\n" +
123+
"| 0.56789 | '0.57' | '0.57' | '5.68e-01' | '56.79%' |\n" +
124+
"| 5.6789 | '5.7' | '5.68' | '5.68e+00' | '567.89%' |\n" +
125+
"| 56.789 | '5.7e+01' | '56.79' | '5.68e+01' | '5678.90%' |\n" +
126+
"| 567.89 | '5.7e+02' | '567.89' | '5.68e+02' | '56789.00%' |\n" +
127+
"+----------------+--------------+---------------+---------------+---------------+\n";
128+
129+
const DIAGRAM_5_B =
130+
"┏━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓\n" +
131+
"┃ │ {<float>:.2} │ {<float>:.2f} │ {<float>:.2e} │ {<float>:.2%} ┃\n" +
132+
"┠────────────────┼──────────────┼───────────────┼───────────────┼───────────────┨\n" +
133+
"┃ 0.000056789 │ '5.7e-05' │ '0.00' │ '5.68e-05' │ '0.01%' ┃\n" +
134+
"┃ 0.00056789 │ '0.00057' │ '0.00' │ '5.68e-04' │ '0.06%' ┃\n" +
135+
"┃ 0.0056789 │ '0.0057' │ '0.01' │ '5.68e-03' │ '0.57%' ┃\n" +
136+
"┃ 0.056789 │ '0.057' │ '0.06' │ '5.68e-02' │ '5.68%' ┃\n" +
137+
"┃ 0.56789 │ '0.57' │ '0.57' │ '5.68e-01' │ '56.79%' ┃\n" +
138+
"┃ 5.6789 │ '5.7' │ '5.68' │ '5.68e+00' │ '567.89%' ┃\n" +
139+
"┃ 56.789 │ '5.7e+01' │ '56.79' │ '5.68e+01' │ '5678.90%' ┃\n" +
140+
"┃ 567.89 │ '5.7e+02' │ '567.89' │ '5.68e+02' │ '56789.00%' ┃\n" +
141+
"┗━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛\n";
142+
115143

116144
function main() {
117145
const html = getMd();
@@ -143,6 +171,7 @@ function switchClassDiagrams(readme) {
143171
readme = readme.replace(DIAGRAM_2_A, DIAGRAM_2_B)
144172
readme = readme.replace(DIAGRAM_3_A, DIAGRAM_3_B)
145173
readme = readme.replace(DIAGRAM_4_A, DIAGRAM_4_B)
174+
readme = readme.replace(DIAGRAM_5_A, DIAGRAM_5_B)
146175
return readme
147176
}
148177

web/script_2.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,34 @@ const DIAGRAM_4_B =
8080
'┃ complex │ │ │ │ ✓ │ ✓ ┃\n' +
8181
'┗━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━┷━━━━━━━━━┷━━━━━━━━┛\n';
8282

83+
const DIAGRAM_5_A =
84+
"+----------------+--------------+---------------+---------------+---------------+\n" +
85+
"| | {<float>:.2} | {<float>:.2f} | {<float>:.2e} | {<float>:.2%} |\n" +
86+
"+----------------+--------------+---------------+---------------+---------------+\n" +
87+
"| 0.000056789 | '5.7e-05' | '0.00' | '5.68e-05' | '0.01%' |\n" +
88+
"| 0.00056789 | '0.00057' | '0.00' | '5.68e-04' | '0.06%' |\n" +
89+
"| 0.0056789 | '0.0057' | '0.01' | '5.68e-03' | '0.57%' |\n" +
90+
"| 0.056789 | '0.057' | '0.06' | '5.68e-02' | '5.68%' |\n" +
91+
"| 0.56789 | '0.57' | '0.57' | '5.68e-01' | '56.79%' |\n" +
92+
"| 5.6789 | '5.7' | '5.68' | '5.68e+00' | '567.89%' |\n" +
93+
"| 56.789 | '5.7e+01' | '56.79' | '5.68e+01' | '5678.90%' |\n" +
94+
"| 567.89 | '5.7e+02' | '567.89' | '5.68e+02' | '56789.00%' |\n" +
95+
"+----------------+--------------+---------------+---------------+---------------+\n";
96+
97+
const DIAGRAM_5_B =
98+
"┏━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┓\n" +
99+
"┃ │ {<float>:.2} │ {<float>:.2f} │ {<float>:.2e} │ {<float>:.2%} ┃\n" +
100+
"┠────────────────┼──────────────┼───────────────┼───────────────┼───────────────┨\n" +
101+
"┃ 0.000056789 │ '5.7e-05' │ '0.00' │ '5.68e-05' │ '0.01%' ┃\n" +
102+
"┃ 0.00056789 │ '0.00057' │ '0.00' │ '5.68e-04' │ '0.06%' ┃\n" +
103+
"┃ 0.0056789 │ '0.0057' │ '0.01' │ '5.68e-03' │ '0.57%' ┃\n" +
104+
"┃ 0.056789 │ '0.057' │ '0.06' │ '5.68e-02' │ '5.68%' ┃\n" +
105+
"┃ 0.56789 │ '0.57' │ '0.57' │ '5.68e-01' │ '56.79%' ┃\n" +
106+
"┃ 5.6789 │ '5.7' │ '5.68' │ '5.68e+00' │ '567.89%' ┃\n" +
107+
"┃ 56.789 │ '5.7e+01' │ '56.79' │ '5.68e+01' │ '5678.90%' ┃\n" +
108+
"┃ 567.89 │ '5.7e+02' │ '567.89' │ '5.68e+02' │ '56789.00%' ┃\n" +
109+
"┗━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┛\n";
110+
83111

84112
// isFontAvailable:
85113
(function(d){function c(c){b.style.fontFamily=c;e.appendChild(b);f=b.clientWidth;e.removeChild(b);return f}var f,e=d.body,b=d.createElement("span");b.innerHTML=Array(100).join("wi");b.style.cssText=["position:absolute","width:auto","font-size:128px","left:-99999px"].join(" !important;");var g=c("monospace"),h=c("serif"),k=c("sans-serif");window.isFontAvailable=function(b){return g!==c(b+",monospace")||k!==c(b+",sans-serif")||h!==c(b+",serif")}})(document);
@@ -89,6 +117,7 @@ if (!isFontAvailable('Menlo')) {
89117
$(`code:contains(${DIAGRAM_2_B})`).html(DIAGRAM_2_A);
90118
$(`code:contains(${DIAGRAM_3_B})`).html(DIAGRAM_3_A);
91119
$(`code:contains(${DIAGRAM_4_B})`).html(DIAGRAM_4_A);
120+
$(`code:contains(${DIAGRAM_5_B})`).html(DIAGRAM_5_A);
92121
// var htmlString = $('code:contains(ᴺᴱᵂ)').html().replace(/ᴺᴱᵂ/g, '');
93122
// $('code:contains(ᴺᴱᵂ)').html(htmlString);
94123
}

0 commit comments

Comments
 (0)