plurimath 0.8.8 → 0.8.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/gen_docs.yml +28 -0
- data/Gemfile +1 -0
- data/README.adoc +464 -76
- data/Rakefile +63 -1
- data/lib/plurimath/formatter/numbers/fraction.rb +5 -3
- data/lib/plurimath/version.rb +1 -1
- data/supported_parens_list.adoc +121 -366
- data/supported_symbols_list.adoc +7174 -20191
- metadata +3 -3
- data/tasks/symbols_documentation_list.rake +0 -54
data/Rakefile
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
require "erb"
|
2
2
|
require "bundler/gem_tasks"
|
3
3
|
require "rspec/core/rake_task"
|
4
|
-
require
|
4
|
+
require "opal/rspec/rake_task"
|
5
|
+
require_relative "lib/plurimath"
|
5
6
|
|
6
7
|
RSpec::Core::RakeTask.new(:spec)
|
7
8
|
|
@@ -14,4 +15,65 @@ rescue LoadError
|
|
14
15
|
# script.
|
15
16
|
end
|
16
17
|
|
18
|
+
DOC_FILES = {
|
19
|
+
"supported_parens_list.adoc" => :paren,
|
20
|
+
"supported_symbols_list.adoc" => :symbols,
|
21
|
+
}.freeze
|
22
|
+
|
23
|
+
DOC_FILES.each do |file_name, type|
|
24
|
+
file file_name => [] do
|
25
|
+
write_doc_file(file_name, type: type)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def write_doc_file(doc_file, type:)
|
30
|
+
File.open(doc_file, "a") do |file|
|
31
|
+
file.write(file_header)
|
32
|
+
|
33
|
+
Plurimath::Utility.send(:"#{type}_files").each do |symbol|
|
34
|
+
file_name = File.basename(symbol, ".rb")
|
35
|
+
klass = Plurimath::Utility.get_symbol_class(file_name)
|
36
|
+
next if klass::INPUT.empty?
|
37
|
+
|
38
|
+
file.write(documentation_content(file_name, klass))
|
39
|
+
end
|
40
|
+
|
41
|
+
file.write("|===")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def documentation_content(file_name, klass)
|
46
|
+
<<~DOCUMENTATION
|
47
|
+
| #{Plurimath::Utility.capitalize(file_name)}
|
48
|
+
| `#{Plurimath::Utility.hexcode_in_input(klass) || klass.input(:asciimath).first}`
|
49
|
+
#{input_for_formats(klass)}
|
50
|
+
DOCUMENTATION
|
51
|
+
end
|
52
|
+
|
53
|
+
def file_header
|
54
|
+
<<~HEADER
|
55
|
+
|===
|
56
|
+
| Math symbol name | Unicode character | AsciiMath | LaTeX | MathML | OMML | UnicodeMath
|
57
|
+
|
58
|
+
HEADER
|
59
|
+
end
|
60
|
+
|
61
|
+
def input_for_formats(klass)
|
62
|
+
%i[asciimath latex mathml omml unicodemath].map do |format|
|
63
|
+
<<~ROW
|
64
|
+
| #{format_input(format, klass)}
|
65
|
+
ROW
|
66
|
+
end.join("")
|
67
|
+
end
|
68
|
+
|
69
|
+
def format_input(format, klass)
|
70
|
+
klass.input(format).flatten.map do |s|
|
71
|
+
if [:latex, :unicodemath].include?(format)
|
72
|
+
"`\\#{s}`"
|
73
|
+
else
|
74
|
+
"`#{s}`"
|
75
|
+
end
|
76
|
+
end.join(", ").gsub(/\|/, "\\|")
|
77
|
+
end
|
78
|
+
|
17
79
|
task :default => :spec
|
@@ -40,14 +40,16 @@ module Plurimath
|
|
40
40
|
|
41
41
|
def digit_count_format(int, fraction, number)
|
42
42
|
integer = int + "." + fraction
|
43
|
-
float = integer
|
43
|
+
float = BigDecimal(integer)
|
44
44
|
int_length = integer.length - 1
|
45
45
|
@digit_count ||= int_length
|
46
46
|
if int_length > @digit_count
|
47
47
|
number_string = float.round(@digit_count - int.length)
|
48
|
-
|
48
|
+
@digit_count > int.length ? number_string.to_s("F").split(".").last : nil
|
49
49
|
elsif int_length < @digit_count
|
50
|
-
number
|
50
|
+
number + "0" * (@digit_count - int_length)
|
51
|
+
else
|
52
|
+
number
|
51
53
|
end
|
52
54
|
end
|
53
55
|
end
|
data/lib/plurimath/version.rb
CHANGED
data/supported_parens_list.adoc
CHANGED
@@ -1,441 +1,196 @@
|
|
1
1
|
|===
|
2
|
-
|
|
2
|
+
| Math symbol name | Unicode character | AsciiMath | LaTeX | MathML | OMML | UnicodeMath
|
3
3
|
|
4
4
|
| CloseParen
|
5
|
-
l|
|
6
|
-
:}
|
7
|
-
〗
|
8
|
-
__{end}
|
9
|
-
l|
|
10
|
-
〗
|
11
|
-
__{end}
|
12
|
-
__{:}}
|
13
|
-
l|
|
14
|
-
〗
|
15
|
-
l|
|
16
|
-
〗
|
17
|
-
l|
|
18
|
-
\\end
|
19
|
-
〗
|
20
|
-
__{:}}
|
21
5
|
| `〗`
|
6
|
+
| `:}`, `〗`, `__{end}`
|
7
|
+
| `\〗`, `\__{end}`, `\__{:}}`
|
8
|
+
| `〗`
|
9
|
+
| `〗`
|
10
|
+
| `\end`, `\〗`, `\__{:}}`
|
22
11
|
|
23
12
|
| Langle
|
24
|
-
l|
|
25
|
-
langle
|
26
|
-
(:
|
27
|
-
<<
|
28
|
-
〈
|
29
|
-
__{⟨}
|
30
|
-
__{bra}
|
31
|
-
l|
|
32
|
-
\langle
|
33
|
-
〈
|
34
|
-
__{(:}
|
35
|
-
__{<<}
|
36
|
-
__{⟨}
|
37
|
-
__{bra}
|
38
|
-
l|
|
39
|
-
〈
|
40
|
-
⟨
|
41
|
-
l|
|
42
|
-
〈
|
43
|
-
⟨
|
44
|
-
l|
|
45
|
-
〈
|
46
|
-
⟨
|
47
|
-
\\bra
|
48
|
-
__{langle}
|
49
|
-
__{(:}
|
50
|
-
__{<<}
|
51
13
|
| `〈`
|
14
|
+
| `langle`, `(:`, `<<`, `〈`, `__{⟨}`, `__{bra}`
|
15
|
+
| `\\langle`, `\〈`, `\__{(:}`, `\__{<<}`, `\__{⟨}`, `\__{bra}`
|
16
|
+
| `〈`, `⟨`
|
17
|
+
| `〈`, `⟨`
|
18
|
+
| `\〈`, `\⟨`, `\bra`, `\__{langle}`, `\__{(:}`, `\__{<<}`
|
52
19
|
|
53
20
|
| Lbbrack
|
54
|
-
l|
|
55
|
-
⟦
|
56
|
-
__{lbbrack}
|
57
|
-
__{Lbrack}
|
58
|
-
l|
|
59
|
-
⟦
|
60
|
-
__{lbbrack}
|
61
|
-
__{Lbrack}
|
62
|
-
l|
|
63
|
-
⟦
|
64
|
-
l|
|
65
|
-
⟦
|
66
|
-
l|
|
67
|
-
⟦
|
68
|
-
\\lbbrack
|
69
|
-
\\Lbrack
|
70
21
|
| `⟦`
|
22
|
+
| `⟦`, `__{lbbrack}`, `__{Lbrack}`
|
23
|
+
| `\⟦`, `\__{lbbrack}`, `\__{Lbrack}`
|
24
|
+
| `⟦`
|
25
|
+
| `⟦`
|
26
|
+
| `\⟦`, `\lbbrack`, `\Lbrack`
|
71
27
|
|
72
28
|
| Lbrace
|
73
|
-
l|
|
74
|
-
{
|
75
|
-
__{lbrace}
|
76
|
-
l|
|
77
|
-
\lbrace
|
78
|
-
{
|
79
|
-
l|
|
80
|
-
{
|
81
|
-
l|
|
82
|
-
{
|
83
|
-
l|
|
84
|
-
{
|
85
|
-
\\lbrace
|
86
29
|
| `{`
|
30
|
+
| `{`, `__{lbrace}`
|
31
|
+
| `\\lbrace`, `\{`
|
32
|
+
| `{`
|
33
|
+
| `{`
|
34
|
+
| `\{`, `\lbrace`
|
87
35
|
|
88
36
|
| Lbrack
|
89
|
-
l|
|
90
|
-
[
|
91
|
-
__{lbrack}
|
92
|
-
l|
|
93
|
-
\lbrack
|
94
|
-
[
|
95
|
-
l|
|
96
|
-
[
|
97
|
-
l|
|
98
|
-
[
|
99
|
-
l|
|
100
|
-
[
|
101
|
-
\\lbrack
|
102
37
|
| `[`
|
38
|
+
| `[`, `__{lbrack}`
|
39
|
+
| `\\lbrack`, `\[`
|
40
|
+
| `[`
|
41
|
+
| `[`
|
42
|
+
| `\[`, `\lbrack`
|
103
43
|
|
104
44
|
| Lceil
|
105
|
-
l|
|
106
|
-
lceiling
|
107
|
-
\|~
|
108
|
-
⌈
|
109
|
-
__{lceil}
|
110
|
-
l|
|
111
|
-
\lceil
|
112
|
-
⌈
|
113
|
-
__{lceiling}
|
114
|
-
__{\|~}
|
115
|
-
l|
|
116
|
-
⌈
|
117
|
-
l|
|
118
|
-
⌈
|
119
|
-
l|
|
120
|
-
⌈
|
121
|
-
\\lceil
|
122
|
-
__{lceiling}
|
123
|
-
__{\|~}
|
124
45
|
| `⌈`
|
46
|
+
| `lceiling`, `\|~`, `⌈`, `__{lceil}`
|
47
|
+
| `\\lceil`, `\⌈`, `\__{lceiling}`, `\__{\|~}`
|
48
|
+
| `⌈`
|
49
|
+
| `⌈`
|
50
|
+
| `\⌈`, `\lceil`, `\__{lceiling}`, `\__{\|~}`
|
125
51
|
|
126
52
|
| Lcurly
|
127
|
-
l|
|
128
|
-
{
|
129
|
-
l|
|
130
|
-
\{
|
131
|
-
l|
|
132
|
-
{
|
133
|
-
l|
|
134
|
-
{
|
135
|
-
l|
|
136
|
-
{
|
137
53
|
| `{`
|
54
|
+
| `{`
|
55
|
+
| `\\{`
|
56
|
+
| `{`
|
57
|
+
| `{`
|
58
|
+
| `\{`
|
138
59
|
|
139
60
|
| Lfloor
|
140
|
-
l|
|
141
|
-
lfloor
|
142
|
-
\|__
|
143
|
-
⌊
|
144
|
-
l|
|
145
|
-
\lfloor
|
146
|
-
⌊
|
147
|
-
__{\|__}
|
148
|
-
l|
|
149
|
-
⌊
|
150
|
-
l|
|
151
|
-
⌊
|
152
|
-
l|
|
153
|
-
⌊
|
154
|
-
\\lfloor
|
155
|
-
__{\|__}
|
156
61
|
| `⌊`
|
62
|
+
| `lfloor`, `\|__`, `⌊`
|
63
|
+
| `\\lfloor`, `\⌊`, `\__{\|__}`
|
64
|
+
| `⌊`
|
65
|
+
| `⌊`
|
66
|
+
| `\⌊`, `\lfloor`, `\__{\|__}`
|
157
67
|
|
158
68
|
| Lround
|
159
|
-
l|
|
160
|
-
(
|
161
|
-
l|
|
162
|
-
(
|
163
|
-
l|
|
164
|
-
(
|
165
|
-
l|
|
166
|
-
(
|
167
|
-
l|
|
168
|
-
(
|
169
69
|
| `(`
|
70
|
+
| `(`
|
71
|
+
| `\(`
|
72
|
+
| `(`
|
73
|
+
| `(`
|
74
|
+
| `\(`
|
170
75
|
|
171
76
|
| Lsquare
|
172
|
-
l|
|
173
|
-
[
|
174
|
-
l|
|
175
|
-
[
|
176
|
-
l|
|
177
|
-
[
|
178
|
-
l|
|
179
|
-
[
|
180
|
-
l|
|
181
|
-
[
|
182
77
|
| `[`
|
78
|
+
| `[`
|
79
|
+
| `\[`
|
80
|
+
| `[`
|
81
|
+
| `[`
|
82
|
+
| `\[`
|
183
83
|
|
184
84
|
| Norm
|
185
|
-
l|
|
186
|
-
‖
|
187
|
-
__{Vert}
|
188
|
-
__{norm}
|
189
|
-
l|
|
190
|
-
\Vert
|
191
|
-
‖
|
192
|
-
__{norm}
|
193
|
-
l|
|
194
|
-
‖
|
195
|
-
l|
|
196
|
-
‖
|
197
|
-
l|
|
198
|
-
\Vert
|
199
|
-
\\Vert
|
200
|
-
\\norm
|
201
|
-
‖
|
202
85
|
| `‖`
|
86
|
+
| `‖`, `__{Vert}`, `__{norm}`
|
87
|
+
| `\\Vert`, `\‖`, `\__{norm}`
|
88
|
+
| `‖`
|
89
|
+
| `‖`
|
90
|
+
| `\\Vert`, `\Vert`, `\norm`, `\‖`
|
203
91
|
|
204
92
|
| OpenParen
|
205
|
-
l|
|
206
|
-
{:
|
207
|
-
〖
|
208
|
-
__{begin}
|
209
|
-
l|
|
210
|
-
〖
|
211
|
-
__{begin}
|
212
|
-
__{{:}
|
213
|
-
l|
|
214
|
-
〖
|
215
|
-
l|
|
216
|
-
〖
|
217
|
-
l|
|
218
|
-
\\begin
|
219
|
-
〖
|
220
|
-
__{{:}
|
221
93
|
| `〖`
|
94
|
+
| `{:`, `〖`, `__{begin}`
|
95
|
+
| `\〖`, `\__{begin}`, `\__{{:}`
|
96
|
+
| `〖`
|
97
|
+
| `〖`
|
98
|
+
| `\begin`, `\〖`, `\__{{:}`
|
222
99
|
|
223
100
|
| Rangle
|
224
|
-
l|
|
225
|
-
rangle
|
226
|
-
:)
|
227
|
-
>>
|
228
|
-
〉
|
229
|
-
⟩
|
230
|
-
__{⟩}
|
231
|
-
__{ket}
|
232
|
-
l|
|
233
|
-
\rangle
|
234
|
-
〉
|
235
|
-
⟩
|
236
|
-
__{:)}
|
237
|
-
__{>>}
|
238
|
-
__{⟩}
|
239
|
-
__{ket}
|
240
|
-
l|
|
241
|
-
〉
|
242
|
-
⟩
|
243
|
-
l|
|
244
|
-
〉
|
245
|
-
⟩
|
246
|
-
l|
|
247
|
-
〉
|
248
|
-
⟩
|
249
|
-
\\ket
|
250
|
-
__{rangle}
|
251
|
-
__{:)}
|
252
|
-
__{>>}
|
253
|
-
__{⟩}
|
254
101
|
| `〉`
|
102
|
+
| `rangle`, `:)`, `>>`, `〉`, `⟩`, `__{⟩}`, `__{ket}`
|
103
|
+
| `\\rangle`, `\〉`, `\⟩`, `\__{:)}`, `\__{>>}`, `\__{⟩}`, `\__{ket}`
|
104
|
+
| `〉`, `⟩`
|
105
|
+
| `〉`, `⟩`
|
106
|
+
| `\〉`, `\⟩`, `\ket`, `\__{rangle}`, `\__{:)}`, `\__{>>}`, `\__{⟩}`
|
255
107
|
|
256
108
|
| Rbbrack
|
257
|
-
l|
|
258
|
-
⟧
|
259
|
-
__{rbbrack}
|
260
|
-
__{Rbrack}
|
261
|
-
l|
|
262
|
-
⟧
|
263
|
-
__{rbbrack}
|
264
|
-
__{Rbrack}
|
265
|
-
l|
|
266
|
-
⟧
|
267
|
-
l|
|
268
|
-
⟧
|
269
|
-
l|
|
270
|
-
⟧
|
271
|
-
\\rbbrack
|
272
|
-
\\Rbrack
|
273
109
|
| `⟧`
|
110
|
+
| `⟧`, `__{rbbrack}`, `__{Rbrack}`
|
111
|
+
| `\⟧`, `\__{rbbrack}`, `\__{Rbrack}`
|
112
|
+
| `⟧`
|
113
|
+
| `⟧`
|
114
|
+
| `\⟧`, `\rbbrack`, `\Rbrack`
|
274
115
|
|
275
116
|
| Rbrace
|
276
|
-
l|
|
277
|
-
}
|
278
|
-
__{rbrace}
|
279
|
-
l|
|
280
|
-
\rbrace
|
281
|
-
}
|
282
|
-
l|
|
283
|
-
}
|
284
|
-
l|
|
285
|
-
}
|
286
|
-
l|
|
287
|
-
}
|
288
|
-
__{rbrace}
|
289
117
|
| `}`
|
118
|
+
| `}`, `__{rbrace}`
|
119
|
+
| `\\rbrace`, `\}`
|
120
|
+
| `}`
|
121
|
+
| `}`
|
122
|
+
| `\}`, `\__{rbrace}`
|
290
123
|
|
291
124
|
| Rbrack
|
292
|
-
l|
|
293
|
-
]
|
294
|
-
__{rbrack}
|
295
|
-
l|
|
296
|
-
\rbrack
|
297
|
-
]
|
298
|
-
l|
|
299
|
-
]
|
300
|
-
l|
|
301
|
-
]
|
302
|
-
l|
|
303
|
-
]
|
304
|
-
__{rbrack}
|
305
125
|
| `]`
|
126
|
+
| `]`, `__{rbrack}`
|
127
|
+
| `\\rbrack`, `\]`
|
128
|
+
| `]`
|
129
|
+
| `]`
|
130
|
+
| `\]`, `\__{rbrack}`
|
306
131
|
|
307
132
|
| Rceil
|
308
|
-
l|
|
309
|
-
rceiling
|
310
|
-
~\|
|
311
|
-
⌉
|
312
|
-
__{rceil}
|
313
|
-
l|
|
314
|
-
\rceil
|
315
|
-
⌉
|
316
|
-
__{rceiling}
|
317
|
-
__{~\|}
|
318
|
-
l|
|
319
|
-
⌉
|
320
|
-
l|
|
321
|
-
⌉
|
322
|
-
l|
|
323
|
-
⌉
|
324
|
-
\\rceil
|
325
|
-
__{rceiling}
|
326
|
-
__{~\|}
|
327
133
|
| `⌉`
|
134
|
+
| `rceiling`, `~\|`, `⌉`, `__{rceil}`
|
135
|
+
| `\\rceil`, `\⌉`, `\__{rceiling}`, `\__{~\|}`
|
136
|
+
| `⌉`
|
137
|
+
| `⌉`
|
138
|
+
| `\⌉`, `\rceil`, `\__{rceiling}`, `\__{~\|}`
|
328
139
|
|
329
140
|
| Rcurly
|
330
|
-
l|
|
331
|
-
}
|
332
|
-
l|
|
333
|
-
\}
|
334
|
-
l|
|
335
|
-
}
|
336
|
-
l|
|
337
|
-
}
|
338
|
-
l|
|
339
|
-
}
|
340
141
|
| `}`
|
142
|
+
| `}`
|
143
|
+
| `\\}`
|
144
|
+
| `}`
|
145
|
+
| `}`
|
146
|
+
| `\}`
|
341
147
|
|
342
148
|
| Rfloor
|
343
|
-
l|
|
344
|
-
rfloor
|
345
|
-
__\|
|
346
|
-
⌋
|
347
|
-
l|
|
348
|
-
\rfloor
|
349
|
-
⌋
|
350
|
-
__{__\|}
|
351
|
-
l|
|
352
|
-
⌋
|
353
|
-
l|
|
354
|
-
⌋
|
355
|
-
l|
|
356
|
-
⌋
|
357
|
-
\\rfloor
|
358
|
-
__{__\|}
|
359
149
|
| `⌋`
|
150
|
+
| `rfloor`, `__\|`, `⌋`
|
151
|
+
| `\\rfloor`, `\⌋`, `\__{__\|}`
|
152
|
+
| `⌋`
|
153
|
+
| `⌋`
|
154
|
+
| `\⌋`, `\rfloor`, `\__{__\|}`
|
360
155
|
|
361
156
|
| Rround
|
362
|
-
l|
|
363
|
-
)
|
364
|
-
l|
|
365
|
-
)
|
366
|
-
l|
|
367
|
-
)
|
368
|
-
l|
|
369
|
-
)
|
370
|
-
l|
|
371
|
-
)
|
372
157
|
| `)`
|
158
|
+
| `)`
|
159
|
+
| `\)`
|
160
|
+
| `)`
|
161
|
+
| `)`
|
162
|
+
| `\)`
|
373
163
|
|
374
164
|
| Rsquare
|
375
|
-
l|
|
376
|
-
]
|
377
|
-
l|
|
378
|
-
]
|
379
|
-
l|
|
380
|
-
]
|
381
|
-
l|
|
382
|
-
]
|
383
|
-
l|
|
384
|
-
]
|
385
165
|
| `]`
|
166
|
+
| `]`
|
167
|
+
| `\]`
|
168
|
+
| `]`
|
169
|
+
| `]`
|
170
|
+
| `\]`
|
386
171
|
|
387
172
|
| UpcaseLangle
|
388
|
-
l|
|
389
|
-
⟪
|
390
|
-
__{Langle}
|
391
|
-
l|
|
392
|
-
⟪
|
393
|
-
__{Langle}
|
394
|
-
l|
|
395
|
-
⟪
|
396
|
-
l|
|
397
|
-
⟪
|
398
|
-
l|
|
399
|
-
⟪
|
400
|
-
\\Langle
|
401
173
|
| `⟪`
|
174
|
+
| `⟪`, `__{Langle}`
|
175
|
+
| `\⟪`, `\__{Langle}`
|
176
|
+
| `⟪`
|
177
|
+
| `⟪`
|
178
|
+
| `\⟪`, `\Langle`
|
402
179
|
|
403
180
|
| UpcaseRangle
|
404
|
-
l|
|
405
|
-
⟫
|
406
|
-
__{Langle}
|
407
|
-
l|
|
408
|
-
⟫
|
409
|
-
__{Langle}
|
410
|
-
l|
|
411
|
-
⟫
|
412
|
-
l|
|
413
|
-
⟫
|
414
|
-
l|
|
415
|
-
⟫
|
416
|
-
\\Langle
|
417
181
|
| `⟫`
|
182
|
+
| `⟫`, `__{Langle}`
|
183
|
+
| `\⟫`, `\__{Langle}`
|
184
|
+
| `⟫`
|
185
|
+
| `⟫`
|
186
|
+
| `\⟫`, `\Langle`
|
418
187
|
|
419
188
|
| Vert
|
420
|
-
l|
|
421
|
-
\|
|
422
|
-
|
|
423
|
-
__{vert}
|
424
|
-
l|
|
425
|
-
\vert
|
426
|
-
\|
|
427
|
-
|
|
428
|
-
l|
|
429
|
-
|
|
430
|
-
\|
|
431
|
-
l|
|
432
|
-
|
|
433
|
-
\|
|
434
|
-
l|
|
435
|
-
\vert
|
436
|
-
|
|
437
|
-
\|
|
438
|
-
__{\|}
|
439
189
|
| `|`
|
190
|
+
| `\|`, `|`, `__{vert}`
|
191
|
+
| `\\vert`, `\\|`, `\|`
|
192
|
+
| `|`, `\|`
|
193
|
+
| `|`, `\|`
|
194
|
+
| `\\vert`, `\|`, `\\|`, `\__{\|}`
|
440
195
|
|
441
196
|
|===
|