mathra 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mathra-1.0.0/Cargo.lock +571 -0
- mathra-1.0.0/Cargo.toml +14 -0
- mathra-1.0.0/PKG-INFO +88 -0
- mathra-1.0.0/README.md +59 -0
- mathra-1.0.0/crates/core/Cargo.toml +21 -0
- mathra-1.0.0/crates/core/README.md +215 -0
- mathra-1.0.0/crates/core/fonts/OFL-STIXTwoMath.txt +92 -0
- mathra-1.0.0/crates/core/fonts/STIXTwoMath-Regular.otf +0 -0
- mathra-1.0.0/crates/core/src/font.rs +176 -0
- mathra-1.0.0/crates/core/src/input/latex.rs +2739 -0
- mathra-1.0.0/crates/core/src/input/mod.rs +2 -0
- mathra-1.0.0/crates/core/src/input/symbols.rs +665 -0
- mathra-1.0.0/crates/core/src/layout/alphabet.rs +65 -0
- mathra-1.0.0/crates/core/src/layout/arithmetic.rs +211 -0
- mathra-1.0.0/crates/core/src/layout/math_box.rs +184 -0
- mathra-1.0.0/crates/core/src/layout/mod.rs +935 -0
- mathra-1.0.0/crates/core/src/layout/stretch.rs +108 -0
- mathra-1.0.0/crates/core/src/layout/table.rs +325 -0
- mathra-1.0.0/crates/core/src/lib.rs +127 -0
- mathra-1.0.0/crates/core/src/locale.rs +243 -0
- mathra-1.0.0/crates/core/src/locales/ar.json +163 -0
- mathra-1.0.0/crates/core/src/locales/de.json +209 -0
- mathra-1.0.0/crates/core/src/locales/en.json +163 -0
- mathra-1.0.0/crates/core/src/locales/es.json +212 -0
- mathra-1.0.0/crates/core/src/locales/fr.json +213 -0
- mathra-1.0.0/crates/core/src/locales/hi.json +163 -0
- mathra-1.0.0/crates/core/src/locales/id.json +163 -0
- mathra-1.0.0/crates/core/src/locales/it.json +215 -0
- mathra-1.0.0/crates/core/src/locales/ja.json +163 -0
- mathra-1.0.0/crates/core/src/locales/ko.json +163 -0
- mathra-1.0.0/crates/core/src/locales/nl.json +168 -0
- mathra-1.0.0/crates/core/src/locales/pl.json +171 -0
- mathra-1.0.0/crates/core/src/locales/pt-BR.json +216 -0
- mathra-1.0.0/crates/core/src/locales/ru.json +171 -0
- mathra-1.0.0/crates/core/src/locales/tr.json +168 -0
- mathra-1.0.0/crates/core/src/locales/zh.json +163 -0
- mathra-1.0.0/crates/core/src/output/mod.rs +25 -0
- mathra-1.0.0/crates/core/src/output/speech.rs +450 -0
- mathra-1.0.0/crates/core/src/output/svg.rs +172 -0
- mathra-1.0.0/crates/core/src/output/text.rs +248 -0
- mathra-1.0.0/crates/core/src/rules.rs +62 -0
- mathra-1.0.0/crates/core/src/tree.rs +368 -0
- mathra-1.0.0/crates/python/Cargo.toml +18 -0
- mathra-1.0.0/crates/python/README.md +59 -0
- mathra-1.0.0/crates/python/licenses/LICENSE-APACHE +202 -0
- mathra-1.0.0/crates/python/licenses/LICENSE-MIT +21 -0
- mathra-1.0.0/crates/python/licenses/OFL-STIXTwoMath.txt +92 -0
- mathra-1.0.0/crates/python/src/lib.rs +47 -0
- mathra-1.0.0/crates/python/tests/test_mathra.py +77 -0
- mathra-1.0.0/licenses/LICENSE-APACHE +202 -0
- mathra-1.0.0/licenses/LICENSE-MIT +21 -0
- mathra-1.0.0/licenses/OFL-STIXTwoMath.txt +92 -0
- mathra-1.0.0/pyproject.toml +40 -0
- mathra-1.0.0/python/mathra/__init__.py +72 -0
- mathra-1.0.0/python/mathra/py.typed +0 -0
mathra-1.0.0/Cargo.lock
ADDED
|
@@ -0,0 +1,571 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 4
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "async-trait"
|
|
7
|
+
version = "0.1.92"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667"
|
|
10
|
+
dependencies = [
|
|
11
|
+
"proc-macro2",
|
|
12
|
+
"quote",
|
|
13
|
+
"syn 3.0.9",
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
[[package]]
|
|
17
|
+
name = "autocfg"
|
|
18
|
+
version = "1.5.1"
|
|
19
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
20
|
+
checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
|
|
21
|
+
|
|
22
|
+
[[package]]
|
|
23
|
+
name = "bumpalo"
|
|
24
|
+
version = "3.20.3"
|
|
25
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
26
|
+
checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"
|
|
27
|
+
|
|
28
|
+
[[package]]
|
|
29
|
+
name = "cast"
|
|
30
|
+
version = "0.3.0"
|
|
31
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
32
|
+
checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5"
|
|
33
|
+
|
|
34
|
+
[[package]]
|
|
35
|
+
name = "cc"
|
|
36
|
+
version = "1.8.0"
|
|
37
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
38
|
+
checksum = "6651c9ed80effdc7db0ff72512157f901af5e3549e341e24b1dd4887d836d838"
|
|
39
|
+
dependencies = [
|
|
40
|
+
"find-msvc-tools",
|
|
41
|
+
"shlex",
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
[[package]]
|
|
45
|
+
name = "cfg-if"
|
|
46
|
+
version = "1.0.5"
|
|
47
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
48
|
+
checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
|
|
49
|
+
|
|
50
|
+
[[package]]
|
|
51
|
+
name = "find-msvc-tools"
|
|
52
|
+
version = "0.1.14"
|
|
53
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
54
|
+
checksum = "aedcfb3409746eddb02b9e19ebda1c3394f759a152e48ee875a0844d1b955484"
|
|
55
|
+
|
|
56
|
+
[[package]]
|
|
57
|
+
name = "futures-core"
|
|
58
|
+
version = "0.3.34"
|
|
59
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
60
|
+
checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e"
|
|
61
|
+
|
|
62
|
+
[[package]]
|
|
63
|
+
name = "futures-task"
|
|
64
|
+
version = "0.3.34"
|
|
65
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
66
|
+
checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd"
|
|
67
|
+
|
|
68
|
+
[[package]]
|
|
69
|
+
name = "futures-util"
|
|
70
|
+
version = "0.3.34"
|
|
71
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
72
|
+
checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc"
|
|
73
|
+
dependencies = [
|
|
74
|
+
"futures-core",
|
|
75
|
+
"futures-task",
|
|
76
|
+
"pin-project-lite",
|
|
77
|
+
"slab",
|
|
78
|
+
]
|
|
79
|
+
|
|
80
|
+
[[package]]
|
|
81
|
+
name = "heck"
|
|
82
|
+
version = "0.5.0"
|
|
83
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
84
|
+
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
85
|
+
|
|
86
|
+
[[package]]
|
|
87
|
+
name = "indoc"
|
|
88
|
+
version = "2.0.8"
|
|
89
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
90
|
+
checksum = "a37b2691796cffeb8a8cd305ac66e65841559f147f4e63231d0eafa4db5384d1"
|
|
91
|
+
dependencies = [
|
|
92
|
+
"rustversion",
|
|
93
|
+
]
|
|
94
|
+
|
|
95
|
+
[[package]]
|
|
96
|
+
name = "itoa"
|
|
97
|
+
version = "1.0.18"
|
|
98
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
99
|
+
checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
|
|
100
|
+
|
|
101
|
+
[[package]]
|
|
102
|
+
name = "js-sys"
|
|
103
|
+
version = "0.3.106"
|
|
104
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
105
|
+
checksum = "7883d941dae510fb2d978fc3fe018c71c9e2892fd38854de3e8b92c2e5ad9cc5"
|
|
106
|
+
dependencies = [
|
|
107
|
+
"cfg-if",
|
|
108
|
+
"futures-util",
|
|
109
|
+
"wasm-bindgen",
|
|
110
|
+
]
|
|
111
|
+
|
|
112
|
+
[[package]]
|
|
113
|
+
name = "libc"
|
|
114
|
+
version = "0.2.191"
|
|
115
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
116
|
+
checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
|
|
117
|
+
|
|
118
|
+
[[package]]
|
|
119
|
+
name = "libm"
|
|
120
|
+
version = "0.2.16"
|
|
121
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
122
|
+
checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"
|
|
123
|
+
|
|
124
|
+
[[package]]
|
|
125
|
+
name = "mathra"
|
|
126
|
+
version = "1.0.0"
|
|
127
|
+
dependencies = [
|
|
128
|
+
"roxmltree",
|
|
129
|
+
"serde",
|
|
130
|
+
"serde_json",
|
|
131
|
+
"ttf-parser",
|
|
132
|
+
]
|
|
133
|
+
|
|
134
|
+
[[package]]
|
|
135
|
+
name = "mathra-cli"
|
|
136
|
+
version = "1.0.0"
|
|
137
|
+
dependencies = [
|
|
138
|
+
"mathra",
|
|
139
|
+
]
|
|
140
|
+
|
|
141
|
+
[[package]]
|
|
142
|
+
name = "mathra-python"
|
|
143
|
+
version = "1.0.0"
|
|
144
|
+
dependencies = [
|
|
145
|
+
"mathra",
|
|
146
|
+
"pyo3",
|
|
147
|
+
]
|
|
148
|
+
|
|
149
|
+
[[package]]
|
|
150
|
+
name = "mathra-wasm"
|
|
151
|
+
version = "1.0.0"
|
|
152
|
+
dependencies = [
|
|
153
|
+
"mathra",
|
|
154
|
+
"serde_json",
|
|
155
|
+
"wasm-bindgen",
|
|
156
|
+
"wasm-bindgen-test",
|
|
157
|
+
]
|
|
158
|
+
|
|
159
|
+
[[package]]
|
|
160
|
+
name = "memchr"
|
|
161
|
+
version = "2.8.3"
|
|
162
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
163
|
+
checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
|
|
164
|
+
|
|
165
|
+
[[package]]
|
|
166
|
+
name = "memoffset"
|
|
167
|
+
version = "0.9.1"
|
|
168
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
169
|
+
checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
|
|
170
|
+
dependencies = [
|
|
171
|
+
"autocfg",
|
|
172
|
+
]
|
|
173
|
+
|
|
174
|
+
[[package]]
|
|
175
|
+
name = "minicov"
|
|
176
|
+
version = "0.3.8"
|
|
177
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
178
|
+
checksum = "4869b6a491569605d66d3952bcdf03df789e5b536e5f0cf7758a7f08a55ae24d"
|
|
179
|
+
dependencies = [
|
|
180
|
+
"cc",
|
|
181
|
+
"walkdir",
|
|
182
|
+
]
|
|
183
|
+
|
|
184
|
+
[[package]]
|
|
185
|
+
name = "nu-ansi-term"
|
|
186
|
+
version = "0.50.3"
|
|
187
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
188
|
+
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
|
|
189
|
+
dependencies = [
|
|
190
|
+
"windows-sys",
|
|
191
|
+
]
|
|
192
|
+
|
|
193
|
+
[[package]]
|
|
194
|
+
name = "num-traits"
|
|
195
|
+
version = "0.2.19"
|
|
196
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
197
|
+
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
|
|
198
|
+
dependencies = [
|
|
199
|
+
"autocfg",
|
|
200
|
+
"libm",
|
|
201
|
+
]
|
|
202
|
+
|
|
203
|
+
[[package]]
|
|
204
|
+
name = "once_cell"
|
|
205
|
+
version = "1.21.4"
|
|
206
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
207
|
+
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
|
208
|
+
|
|
209
|
+
[[package]]
|
|
210
|
+
name = "oorandom"
|
|
211
|
+
version = "11.1.5"
|
|
212
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
213
|
+
checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e"
|
|
214
|
+
|
|
215
|
+
[[package]]
|
|
216
|
+
name = "pin-project-lite"
|
|
217
|
+
version = "0.2.17"
|
|
218
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
219
|
+
checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
|
|
220
|
+
|
|
221
|
+
[[package]]
|
|
222
|
+
name = "portable-atomic"
|
|
223
|
+
version = "1.15.0"
|
|
224
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
225
|
+
checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
|
|
226
|
+
|
|
227
|
+
[[package]]
|
|
228
|
+
name = "proc-macro2"
|
|
229
|
+
version = "1.0.107"
|
|
230
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
231
|
+
checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
|
|
232
|
+
dependencies = [
|
|
233
|
+
"unicode-ident",
|
|
234
|
+
]
|
|
235
|
+
|
|
236
|
+
[[package]]
|
|
237
|
+
name = "pyo3"
|
|
238
|
+
version = "0.25.1"
|
|
239
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
240
|
+
checksum = "8970a78afe0628a3e3430376fc5fd76b6b45c4d43360ffd6cdd40bdde72b682a"
|
|
241
|
+
dependencies = [
|
|
242
|
+
"indoc",
|
|
243
|
+
"libc",
|
|
244
|
+
"memoffset",
|
|
245
|
+
"once_cell",
|
|
246
|
+
"portable-atomic",
|
|
247
|
+
"pyo3-build-config",
|
|
248
|
+
"pyo3-ffi",
|
|
249
|
+
"pyo3-macros",
|
|
250
|
+
"unindent",
|
|
251
|
+
]
|
|
252
|
+
|
|
253
|
+
[[package]]
|
|
254
|
+
name = "pyo3-build-config"
|
|
255
|
+
version = "0.25.1"
|
|
256
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
257
|
+
checksum = "458eb0c55e7ece017adeba38f2248ff3ac615e53660d7c71a238d7d2a01c7598"
|
|
258
|
+
dependencies = [
|
|
259
|
+
"once_cell",
|
|
260
|
+
"target-lexicon",
|
|
261
|
+
]
|
|
262
|
+
|
|
263
|
+
[[package]]
|
|
264
|
+
name = "pyo3-ffi"
|
|
265
|
+
version = "0.25.1"
|
|
266
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
267
|
+
checksum = "7114fe5457c61b276ab77c5055f206295b812608083644a5c5b2640c3102565c"
|
|
268
|
+
dependencies = [
|
|
269
|
+
"libc",
|
|
270
|
+
"pyo3-build-config",
|
|
271
|
+
]
|
|
272
|
+
|
|
273
|
+
[[package]]
|
|
274
|
+
name = "pyo3-macros"
|
|
275
|
+
version = "0.25.1"
|
|
276
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
277
|
+
checksum = "a8725c0a622b374d6cb051d11a0983786448f7785336139c3c94f5aa6bef7e50"
|
|
278
|
+
dependencies = [
|
|
279
|
+
"proc-macro2",
|
|
280
|
+
"pyo3-macros-backend",
|
|
281
|
+
"quote",
|
|
282
|
+
"syn 2.0.119",
|
|
283
|
+
]
|
|
284
|
+
|
|
285
|
+
[[package]]
|
|
286
|
+
name = "pyo3-macros-backend"
|
|
287
|
+
version = "0.25.1"
|
|
288
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
289
|
+
checksum = "4109984c22491085343c05b0dbc54ddc405c3cf7b4374fc533f5c3313a572ccc"
|
|
290
|
+
dependencies = [
|
|
291
|
+
"heck",
|
|
292
|
+
"proc-macro2",
|
|
293
|
+
"pyo3-build-config",
|
|
294
|
+
"quote",
|
|
295
|
+
"syn 2.0.119",
|
|
296
|
+
]
|
|
297
|
+
|
|
298
|
+
[[package]]
|
|
299
|
+
name = "quote"
|
|
300
|
+
version = "1.0.47"
|
|
301
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
302
|
+
checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
|
|
303
|
+
dependencies = [
|
|
304
|
+
"proc-macro2",
|
|
305
|
+
]
|
|
306
|
+
|
|
307
|
+
[[package]]
|
|
308
|
+
name = "roxmltree"
|
|
309
|
+
version = "0.20.0"
|
|
310
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
311
|
+
checksum = "6c20b6793b5c2fa6553b250154b78d6d0db37e72700ae35fad9387a46f487c97"
|
|
312
|
+
|
|
313
|
+
[[package]]
|
|
314
|
+
name = "rustversion"
|
|
315
|
+
version = "1.0.23"
|
|
316
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
317
|
+
checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"
|
|
318
|
+
|
|
319
|
+
[[package]]
|
|
320
|
+
name = "same-file"
|
|
321
|
+
version = "1.0.6"
|
|
322
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
323
|
+
checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
|
|
324
|
+
dependencies = [
|
|
325
|
+
"winapi-util",
|
|
326
|
+
]
|
|
327
|
+
|
|
328
|
+
[[package]]
|
|
329
|
+
name = "serde"
|
|
330
|
+
version = "1.0.229"
|
|
331
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
332
|
+
checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
|
|
333
|
+
dependencies = [
|
|
334
|
+
"serde_core",
|
|
335
|
+
"serde_derive",
|
|
336
|
+
]
|
|
337
|
+
|
|
338
|
+
[[package]]
|
|
339
|
+
name = "serde_core"
|
|
340
|
+
version = "1.0.229"
|
|
341
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
342
|
+
checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"
|
|
343
|
+
dependencies = [
|
|
344
|
+
"serde_derive",
|
|
345
|
+
]
|
|
346
|
+
|
|
347
|
+
[[package]]
|
|
348
|
+
name = "serde_derive"
|
|
349
|
+
version = "1.0.229"
|
|
350
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
351
|
+
checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
|
|
352
|
+
dependencies = [
|
|
353
|
+
"proc-macro2",
|
|
354
|
+
"quote",
|
|
355
|
+
"syn 3.0.9",
|
|
356
|
+
]
|
|
357
|
+
|
|
358
|
+
[[package]]
|
|
359
|
+
name = "serde_json"
|
|
360
|
+
version = "1.0.154"
|
|
361
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
362
|
+
checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6"
|
|
363
|
+
dependencies = [
|
|
364
|
+
"itoa",
|
|
365
|
+
"memchr",
|
|
366
|
+
"serde",
|
|
367
|
+
"serde_core",
|
|
368
|
+
"zmij",
|
|
369
|
+
]
|
|
370
|
+
|
|
371
|
+
[[package]]
|
|
372
|
+
name = "shlex"
|
|
373
|
+
version = "2.0.1"
|
|
374
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
375
|
+
checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
|
|
376
|
+
|
|
377
|
+
[[package]]
|
|
378
|
+
name = "slab"
|
|
379
|
+
version = "0.4.12"
|
|
380
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
381
|
+
checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
|
|
382
|
+
|
|
383
|
+
[[package]]
|
|
384
|
+
name = "syn"
|
|
385
|
+
version = "2.0.119"
|
|
386
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
387
|
+
checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
|
|
388
|
+
dependencies = [
|
|
389
|
+
"proc-macro2",
|
|
390
|
+
"quote",
|
|
391
|
+
"unicode-ident",
|
|
392
|
+
]
|
|
393
|
+
|
|
394
|
+
[[package]]
|
|
395
|
+
name = "syn"
|
|
396
|
+
version = "3.0.9"
|
|
397
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
398
|
+
checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b"
|
|
399
|
+
dependencies = [
|
|
400
|
+
"proc-macro2",
|
|
401
|
+
"quote",
|
|
402
|
+
"unicode-ident",
|
|
403
|
+
]
|
|
404
|
+
|
|
405
|
+
[[package]]
|
|
406
|
+
name = "target-lexicon"
|
|
407
|
+
version = "0.13.5"
|
|
408
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
409
|
+
checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
|
|
410
|
+
|
|
411
|
+
[[package]]
|
|
412
|
+
name = "tokio"
|
|
413
|
+
version = "1.53.3"
|
|
414
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
415
|
+
checksum = "ce3335fa71841cda333a58d7615b03901380ecf09d59b3296d21f8bbac0dde4e"
|
|
416
|
+
dependencies = [
|
|
417
|
+
"pin-project-lite",
|
|
418
|
+
]
|
|
419
|
+
|
|
420
|
+
[[package]]
|
|
421
|
+
name = "ttf-parser"
|
|
422
|
+
version = "0.25.1"
|
|
423
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
424
|
+
checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31"
|
|
425
|
+
|
|
426
|
+
[[package]]
|
|
427
|
+
name = "unicode-ident"
|
|
428
|
+
version = "1.0.27"
|
|
429
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
430
|
+
checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
|
|
431
|
+
|
|
432
|
+
[[package]]
|
|
433
|
+
name = "unindent"
|
|
434
|
+
version = "0.2.4"
|
|
435
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
436
|
+
checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
|
|
437
|
+
|
|
438
|
+
[[package]]
|
|
439
|
+
name = "walkdir"
|
|
440
|
+
version = "2.5.0"
|
|
441
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
442
|
+
checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
|
|
443
|
+
dependencies = [
|
|
444
|
+
"same-file",
|
|
445
|
+
"winapi-util",
|
|
446
|
+
]
|
|
447
|
+
|
|
448
|
+
[[package]]
|
|
449
|
+
name = "wasm-bindgen"
|
|
450
|
+
version = "0.2.129"
|
|
451
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
452
|
+
checksum = "9bb54f33acc68fd454578d9820b0bde1a1a3d17aa17bb7b6595806d02886d409"
|
|
453
|
+
dependencies = [
|
|
454
|
+
"cfg-if",
|
|
455
|
+
"once_cell",
|
|
456
|
+
"rustversion",
|
|
457
|
+
"wasm-bindgen-macro",
|
|
458
|
+
"wasm-bindgen-shared",
|
|
459
|
+
]
|
|
460
|
+
|
|
461
|
+
[[package]]
|
|
462
|
+
name = "wasm-bindgen-futures"
|
|
463
|
+
version = "0.4.79"
|
|
464
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
465
|
+
checksum = "3cbab34de2d982e9b48e18d216d04c4a6f641066ff19ffb699980f591ee3610e"
|
|
466
|
+
dependencies = [
|
|
467
|
+
"js-sys",
|
|
468
|
+
"tokio",
|
|
469
|
+
"wasm-bindgen",
|
|
470
|
+
]
|
|
471
|
+
|
|
472
|
+
[[package]]
|
|
473
|
+
name = "wasm-bindgen-macro"
|
|
474
|
+
version = "0.2.129"
|
|
475
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
476
|
+
checksum = "2e29d0c35b16e224a7eeb5cd2d25e3e1968fbd65604117b44d3b789d00ee8535"
|
|
477
|
+
dependencies = [
|
|
478
|
+
"quote",
|
|
479
|
+
"wasm-bindgen-macro-support",
|
|
480
|
+
]
|
|
481
|
+
|
|
482
|
+
[[package]]
|
|
483
|
+
name = "wasm-bindgen-macro-support"
|
|
484
|
+
version = "0.2.129"
|
|
485
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
486
|
+
checksum = "6f501a8bc3719dba86ef8ae4728879c08001bea749eb1333ac5b91e040e2a6b7"
|
|
487
|
+
dependencies = [
|
|
488
|
+
"bumpalo",
|
|
489
|
+
"proc-macro2",
|
|
490
|
+
"quote",
|
|
491
|
+
"syn 3.0.9",
|
|
492
|
+
"wasm-bindgen-shared",
|
|
493
|
+
]
|
|
494
|
+
|
|
495
|
+
[[package]]
|
|
496
|
+
name = "wasm-bindgen-shared"
|
|
497
|
+
version = "0.2.129"
|
|
498
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
499
|
+
checksum = "23f0c9c52aa7cd7d77769a4cfe2a9adb1b331f489a41d912ce14513d5ab995c6"
|
|
500
|
+
dependencies = [
|
|
501
|
+
"unicode-ident",
|
|
502
|
+
]
|
|
503
|
+
|
|
504
|
+
[[package]]
|
|
505
|
+
name = "wasm-bindgen-test"
|
|
506
|
+
version = "0.3.79"
|
|
507
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
508
|
+
checksum = "ae7499dfd45780a0a91d7ee6bb9ac51970a4479a41a89da443fdda5a39547d42"
|
|
509
|
+
dependencies = [
|
|
510
|
+
"async-trait",
|
|
511
|
+
"cast",
|
|
512
|
+
"js-sys",
|
|
513
|
+
"libm",
|
|
514
|
+
"minicov",
|
|
515
|
+
"nu-ansi-term",
|
|
516
|
+
"num-traits",
|
|
517
|
+
"oorandom",
|
|
518
|
+
"serde",
|
|
519
|
+
"serde_json",
|
|
520
|
+
"wasm-bindgen",
|
|
521
|
+
"wasm-bindgen-futures",
|
|
522
|
+
"wasm-bindgen-test-macro",
|
|
523
|
+
"wasm-bindgen-test-shared",
|
|
524
|
+
]
|
|
525
|
+
|
|
526
|
+
[[package]]
|
|
527
|
+
name = "wasm-bindgen-test-macro"
|
|
528
|
+
version = "0.3.79"
|
|
529
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
530
|
+
checksum = "3b84b5ac638bfb168196a1a461fcc8f46a294a18b1b6be52133b4e0db122cc9f"
|
|
531
|
+
dependencies = [
|
|
532
|
+
"proc-macro2",
|
|
533
|
+
"quote",
|
|
534
|
+
"syn 3.0.9",
|
|
535
|
+
]
|
|
536
|
+
|
|
537
|
+
[[package]]
|
|
538
|
+
name = "wasm-bindgen-test-shared"
|
|
539
|
+
version = "0.2.129"
|
|
540
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
541
|
+
checksum = "4f692aa943ccd88363733b77063f32cfed5bc6cbea8e6e8b251b302f881606fe"
|
|
542
|
+
|
|
543
|
+
[[package]]
|
|
544
|
+
name = "winapi-util"
|
|
545
|
+
version = "0.1.11"
|
|
546
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
547
|
+
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
|
|
548
|
+
dependencies = [
|
|
549
|
+
"windows-sys",
|
|
550
|
+
]
|
|
551
|
+
|
|
552
|
+
[[package]]
|
|
553
|
+
name = "windows-link"
|
|
554
|
+
version = "0.2.1"
|
|
555
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
556
|
+
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
|
557
|
+
|
|
558
|
+
[[package]]
|
|
559
|
+
name = "windows-sys"
|
|
560
|
+
version = "0.61.2"
|
|
561
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
562
|
+
checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
|
|
563
|
+
dependencies = [
|
|
564
|
+
"windows-link",
|
|
565
|
+
]
|
|
566
|
+
|
|
567
|
+
[[package]]
|
|
568
|
+
name = "zmij"
|
|
569
|
+
version = "1.0.23"
|
|
570
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
571
|
+
checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"
|
mathra-1.0.0/Cargo.toml
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
[workspace]
|
|
2
|
+
resolver = "2"
|
|
3
|
+
members = ["crates/core", "crates/python"]
|
|
4
|
+
|
|
5
|
+
[workspace.package]
|
|
6
|
+
version = "1.0.0"
|
|
7
|
+
edition = "2021"
|
|
8
|
+
license = "MIT OR Apache-2.0"
|
|
9
|
+
repository = "https://github.com/matheusmota-dev-br/mathra"
|
|
10
|
+
homepage = "https://github.com/matheusmota-dev-br/mathra"
|
|
11
|
+
|
|
12
|
+
[workspace.dependencies]
|
|
13
|
+
# the published name of the core lives only here and in crates/core/Cargo.toml
|
|
14
|
+
mathra = { path = "crates/core", version = "1.0.0" }
|
mathra-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mathra
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
5
|
+
Classifier: Intended Audience :: Developers
|
|
6
|
+
Classifier: Intended Audience :: Education
|
|
7
|
+
Classifier: Intended Audience :: Science/Research
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Rust
|
|
11
|
+
Classifier: Topic :: Multimedia :: Graphics :: Graphics Conversion
|
|
12
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
13
|
+
Classifier: Topic :: Text Processing :: Markup :: LaTeX
|
|
14
|
+
Classifier: Typing :: Typed
|
|
15
|
+
License-File: licenses/LICENSE-APACHE
|
|
16
|
+
License-File: licenses/LICENSE-MIT
|
|
17
|
+
License-File: licenses/OFL-STIXTwoMath.txt
|
|
18
|
+
Summary: Math LaTeX to accessible SVG, without a TeX install. Speech for screen readers in 16 languages.
|
|
19
|
+
Keywords: latex,math,equations,svg,accessibility,screen-reader,typesetting,webassembly,i18n,localization,katex-alternative,mathjax-alternative,rust,python,cli,javascript,typescript
|
|
20
|
+
Author: Matheus Mota
|
|
21
|
+
License-Expression: (MIT OR Apache-2.0) AND OFL-1.1
|
|
22
|
+
Requires-Python: >=3.9
|
|
23
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
24
|
+
Project-URL: Documentation, https://github.com/matheusmota-dev-br/mathra#install-and-use
|
|
25
|
+
Project-URL: Homepage, https://matheusmota-dev-br.github.io/mathra/
|
|
26
|
+
Project-URL: Issues, https://github.com/matheusmota-dev-br/mathra/issues
|
|
27
|
+
Project-URL: Repository, https://github.com/matheusmota-dev-br/mathra
|
|
28
|
+
|
|
29
|
+
<p align="center"><img src="https://raw.githubusercontent.com/matheusmota-dev-br/mathra/main/docs/banner.svg" alt="mathra" width="100%"></p>
|
|
30
|
+
|
|
31
|
+
# mathra
|
|
32
|
+
|
|
33
|
+
Math LaTeX to accessible SVG, without a TeX install. Every SVG carries the phrase a screen reader says, in 16 languages, and draws with the STIX Two Math font embedded, so it looks the same everywhere. **[Try it in the browser](https://matheusmota-dev-br.github.io/mathra/)**.
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
pip install mathra
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Wheels for Linux, macOS and Windows, for Python 3.9 and later; nothing else to install.
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
import mathra
|
|
45
|
+
|
|
46
|
+
svg = mathra.tex_to_svg(r"x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}")
|
|
47
|
+
open("quadratic.svg", "w").write(svg)
|
|
48
|
+
|
|
49
|
+
r = mathra.render(r"\frac{3}{4}", locale="fr")
|
|
50
|
+
r["speech"] # 'trois quarts'
|
|
51
|
+
r["warnings"] # [] — broken LaTeX is drawn anyway and reported here (E-REC-*)
|
|
52
|
+
|
|
53
|
+
mathra.tex_to_svg(r"\sum_{n=1}^{\infty} \frac{1}{n^2}", display=False) # inline style
|
|
54
|
+
mathra.tex_to_svg(r"\vertA\vert", strict=True) # ValueError, like TeX
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
| | |
|
|
58
|
+
|---|---|
|
|
59
|
+
| `tex_to_svg(tex, locale="en", *, display=True, strict=False)` | The SVG as a string. |
|
|
60
|
+
| `render(tex, locale="en", *, display=True, strict=False)` | A dict: `svg`, `speech`, `text`, `tree`, `applied`, `warnings`. |
|
|
61
|
+
| `tex_to_tree(tex, locale="en", *, display=True, strict=False)` | The tree of meaning as JSON. |
|
|
62
|
+
| `locales()` | `[{"code": "en", "name": "English"}, …]`: en, pt-BR, es, fr, de, it, ru, zh, ja, ko, hi, ar, id, tr, nl, pl. |
|
|
63
|
+
|
|
64
|
+
Errors are `ValueError`. Types are included (`py.typed`).
|
|
65
|
+
|
|
66
|
+
## What it draws
|
|
67
|
+
|
|
68
|
+
Every image below is an SVG written by mathra, on a white card so it reads well on dark pages.
|
|
69
|
+
|
|
70
|
+
<table>
|
|
71
|
+
<tr><td align="center"><img src="https://raw.githubusercontent.com/matheusmota-dev-br/mathra/main/docs/examples/quadratic.svg" alt="Quadratic formula"><br><sub>Quadratic formula</sub></td><td align="center"><img src="https://raw.githubusercontent.com/matheusmota-dev-br/mathra/main/docs/examples/gaussian.svg" alt="Gaussian integral"><br><sub>Gaussian integral</sub></td></tr>
|
|
72
|
+
<tr><td align="center"><img src="https://raw.githubusercontent.com/matheusmota-dev-br/mathra/main/docs/examples/matrix.svg" alt="m × n matrix with dots"><br><sub>Matrix with dots</sub></td><td align="center"><img src="https://raw.githubusercontent.com/matheusmota-dev-br/mathra/main/docs/examples/piecewise.svg" alt="Piecewise definition"><br><sub>Piecewise definition</sub></td></tr>
|
|
73
|
+
<tr><td align="center"><img src="https://raw.githubusercontent.com/matheusmota-dev-br/mathra/main/docs/examples/chemistry.svg" alt="Chemical equation (mhchem)"><br><sub>Chemistry (<code>\ce</code>)</sub></td><td align="center"><img src="https://raw.githubusercontent.com/matheusmota-dev-br/mathra/main/docs/examples/units.svg" alt="Quantity with units (siunitx)"><br><sub>Units (<code>\SI</code>)</sub></td></tr>
|
|
74
|
+
<tr><td align="center" colspan="2"><img src="https://raw.githubusercontent.com/matheusmota-dev-br/mathra/main/docs/examples/maxwell.svg" alt="Maxwell's equations"><br><sub>Maxwell's equations</sub></td></tr>
|
|
75
|
+
</table>
|
|
76
|
+
|
|
77
|
+
## What the SVG carries
|
|
78
|
+
|
|
79
|
+
Speech in `<title>` linked with `aria-labelledby`, the source LaTeX and the tree of meaning in `<metadata>`, color from the page (`currentColor`), size in `em`, a selectable text layer and ids unique to each equation. The same input always gives the same bytes, in Python and in every other package.
|
|
80
|
+
|
|
81
|
+
## Also for JavaScript, Rust and the terminal
|
|
82
|
+
|
|
83
|
+
The same core is an npm package (`@mathlabs/mathra`), a Rust crate and a command-line tool: [github.com/matheusmota-dev-br/mathra](https://github.com/matheusmota-dev-br/mathra#install-and-use). Rules, languages and the full list of supported commands are there too.
|
|
84
|
+
|
|
85
|
+
## License
|
|
86
|
+
|
|
87
|
+
The code is MIT or Apache-2.0; the embedded STIX Two Math font is under the SIL Open Font License 1.1.
|
|
88
|
+
|