@drghaliasri/butex 5.5.4 → 5.6.0
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.
- package/README.md +2 -2
- package/dist/document.js +36 -0
- package/dist/document.js.map +1 -1
- package/dist/document.mjs +36 -0
- package/dist/document.mjs.map +1 -1
- package/dist/document2.d.mts +10 -4
- package/dist/document2.d.ts +10 -4
- package/dist/document2.js +193 -25
- package/dist/document2.js.map +1 -1
- package/dist/document2.mjs +191 -25
- package/dist/document2.mjs.map +1 -1
- package/dist/index.d.mts +39 -1
- package/dist/index.d.ts +39 -1
- package/dist/index.global.js +79 -14
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +79 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +79 -14
- package/dist/index.mjs.map +1 -1
- package/dist/react-document.js +254 -7
- package/dist/react-document.js.map +1 -1
- package/dist/react-document.mjs +254 -7
- package/dist/react-document.mjs.map +1 -1
- package/dist/react-document2.d.mts +5 -3
- package/dist/react-document2.d.ts +5 -3
- package/dist/react-document2.js +386 -41
- package/dist/react-document2.js.map +1 -1
- package/dist/react-document2.mjs +386 -41
- package/dist/react-document2.mjs.map +1 -1
- package/dist/react.d.mts +35 -0
- package/dist/react.d.ts +35 -0
- package/dist/react.js +1277 -7
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +1277 -7
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/document2.mjs
CHANGED
|
@@ -45,21 +45,34 @@ var BUTEX_CLOSING_HAMDALA = "\u0627\u0644\u0652\u062D\u064E\u0645\u0652\u062F\u0
|
|
|
45
45
|
function escapeButexTextArg(text) {
|
|
46
46
|
return text.replace(/\\/g, "\\textbackslash{}").replace(/[{}]/g, "\\$&");
|
|
47
47
|
}
|
|
48
|
+
function butexFontDisplayTex(macro, text) {
|
|
49
|
+
return `${macro}{${escapeButexTextArg(text)}}`;
|
|
50
|
+
}
|
|
48
51
|
function butexDiwaniDisplayTex(text) {
|
|
49
|
-
return
|
|
52
|
+
return butexFontDisplayTex("\\butexdiwani", text);
|
|
50
53
|
}
|
|
51
54
|
function butexDiwaniDisplayLatex(text) {
|
|
52
55
|
return `\\[
|
|
53
56
|
${butexDiwaniDisplayTex(text)}
|
|
54
57
|
\\]`;
|
|
55
58
|
}
|
|
59
|
+
function butexMaghribiDisplayTex(text) {
|
|
60
|
+
return butexFontDisplayTex("\\butexmaghribi", text);
|
|
61
|
+
}
|
|
62
|
+
function butexMaghribiDisplayLatex(text) {
|
|
63
|
+
return `\\[
|
|
64
|
+
${butexMaghribiDisplayTex(text)}
|
|
65
|
+
\\]`;
|
|
66
|
+
}
|
|
56
67
|
var BASMALA_LINES = [BUTEX_BASMALA_LINE1, BUTEX_BASMALA_LINE2, BUTEX_BASMALA_SALAWAT];
|
|
57
68
|
function butexBasmalaDisplayTex() {
|
|
58
|
-
return BASMALA_LINES.map((line) =>
|
|
69
|
+
return BASMALA_LINES.map((line) => butexMaghribiDisplayTex(line)).join(" \\\\ ");
|
|
59
70
|
}
|
|
60
71
|
function butexBasmalaDisplayLatex() {
|
|
61
72
|
return `\\[
|
|
62
|
-
|
|
73
|
+
\\begin{gathered}
|
|
74
|
+
${BASMALA_LINES.map((line) => butexMaghribiDisplayTex(line)).join(" \\\\\n")}
|
|
75
|
+
\\end{gathered}
|
|
63
76
|
\\]`;
|
|
64
77
|
}
|
|
65
78
|
function butexInColumnMaketitleHook() {
|
|
@@ -96,7 +109,7 @@ function butexBasmalaTitlingPreamble(options = {}) {
|
|
|
96
109
|
" \\begin{center}",
|
|
97
110
|
...BASMALA_LINES.map((line, index) => {
|
|
98
111
|
const suffix = index < BASMALA_LINES.length - 1 ? "\\\\" : "";
|
|
99
|
-
return ` ${
|
|
112
|
+
return ` ${butexMaghribiDisplayTex(line)}${suffix}`;
|
|
100
113
|
}),
|
|
101
114
|
" \\par\\vspace{1.5em}",
|
|
102
115
|
" \\LARGE",
|
|
@@ -2055,6 +2068,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2055
2068
|
category: "operators1",
|
|
2056
2069
|
Tex: "\\neq",
|
|
2057
2070
|
mirror: true,
|
|
2071
|
+
compileMirror: true,
|
|
2058
2072
|
Label: "\u2260",
|
|
2059
2073
|
title: "\u0644\u0627 \u064A\u0633\u0627\u0648\u064A",
|
|
2060
2074
|
svg_path: null
|
|
@@ -2094,6 +2108,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2094
2108
|
Tex: "\\leq",
|
|
2095
2109
|
mirror: true,
|
|
2096
2110
|
displayMirror: false,
|
|
2111
|
+
compileMirror: true,
|
|
2097
2112
|
Label: "\u2264",
|
|
2098
2113
|
title: "\u0623\u0635\u063A\u0631 \u0645\u0646 \u0623\u0648 \u064A\u0633\u0627\u0648\u064A",
|
|
2099
2114
|
svg_path: null
|
|
@@ -2104,6 +2119,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2104
2119
|
Tex: "\\geq",
|
|
2105
2120
|
mirror: true,
|
|
2106
2121
|
displayMirror: false,
|
|
2122
|
+
compileMirror: true,
|
|
2107
2123
|
Label: "\u2265",
|
|
2108
2124
|
title: "\u0623\u0643\u0628\u0631 \u0645\u0646 \u0623\u0648 \u064A\u0633\u0627\u0648\u064A",
|
|
2109
2125
|
svg_path: null
|
|
@@ -2114,6 +2130,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2114
2130
|
Tex: "\\coloneqq",
|
|
2115
2131
|
mirror: true,
|
|
2116
2132
|
displayMirror: false,
|
|
2133
|
+
compileMirror: true,
|
|
2117
2134
|
Label: "\u2254",
|
|
2118
2135
|
title: "\u064A\u0639\u0631\u0641 \u0628\u0623\u0646\u0647 \u064A\u0633\u0627\u0648\u064A",
|
|
2119
2136
|
svg_path: null
|
|
@@ -2124,6 +2141,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2124
2141
|
Tex: "\\eqqcolon",
|
|
2125
2142
|
mirror: true,
|
|
2126
2143
|
displayMirror: false,
|
|
2144
|
+
compileMirror: true,
|
|
2127
2145
|
Label: "\u2255",
|
|
2128
2146
|
title: "\u064A\u0633\u0627\u0648\u064A \u0628\u0627\u0644\u062A\u0639\u0631\u064A\u0641",
|
|
2129
2147
|
svg_path: null
|
|
@@ -2135,6 +2153,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2135
2153
|
Tex: "\\propto",
|
|
2136
2154
|
mirror: true,
|
|
2137
2155
|
displayMirror: false,
|
|
2156
|
+
compileMirror: true,
|
|
2138
2157
|
Label: "\u221D",
|
|
2139
2158
|
title: "\u064A\u062A\u0646\u0627\u0633\u0628 \u0645\u0639",
|
|
2140
2159
|
svg_path: null
|
|
@@ -2145,6 +2164,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2145
2164
|
Tex: "\\in",
|
|
2146
2165
|
mirror: true,
|
|
2147
2166
|
displayMirror: false,
|
|
2167
|
+
compileMirror: true,
|
|
2148
2168
|
Label: "\u2208",
|
|
2149
2169
|
title: "\u064A\u0646\u062A\u0645\u064A \u0625\u0644\u0649",
|
|
2150
2170
|
svg_path: null
|
|
@@ -2165,6 +2185,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2165
2185
|
Tex: "\\subset",
|
|
2166
2186
|
mirror: true,
|
|
2167
2187
|
displayMirror: false,
|
|
2188
|
+
compileMirror: true,
|
|
2168
2189
|
Label: "\u2282",
|
|
2169
2190
|
title: "\u0645\u062C\u0645\u0648\u0639\u0629 \u062C\u0632\u0626\u064A\u0629 \u0645\u0646",
|
|
2170
2191
|
svg_path: null
|
|
@@ -2175,6 +2196,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2175
2196
|
Tex: "\\supset",
|
|
2176
2197
|
mirror: true,
|
|
2177
2198
|
displayMirror: false,
|
|
2199
|
+
compileMirror: true,
|
|
2178
2200
|
Label: "\u2283",
|
|
2179
2201
|
title: "\u0645\u062C\u0645\u0648\u0639\u0629 \u0634\u0627\u0645\u0644\u0629 \u0644\u0640",
|
|
2180
2202
|
svg_path: null
|
|
@@ -2185,6 +2207,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2185
2207
|
Tex: "\\subseteq",
|
|
2186
2208
|
mirror: true,
|
|
2187
2209
|
displayMirror: false,
|
|
2210
|
+
compileMirror: true,
|
|
2188
2211
|
Label: "\u2286",
|
|
2189
2212
|
title: "\u0645\u062C\u0645\u0648\u0639\u0629 \u062C\u0632\u0626\u064A\u0629 \u0623\u0648 \u062A\u0633\u0627\u0648\u064A",
|
|
2190
2213
|
svg_path: null
|
|
@@ -2195,6 +2218,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2195
2218
|
Tex: "\\supseteq",
|
|
2196
2219
|
mirror: true,
|
|
2197
2220
|
displayMirror: false,
|
|
2221
|
+
compileMirror: true,
|
|
2198
2222
|
Label: "\u2287",
|
|
2199
2223
|
title: "\u0645\u062C\u0645\u0648\u0639\u0629 \u0634\u0627\u0645\u0644\u0629 \u0623\u0648 \u062A\u0633\u0627\u0648\u064A",
|
|
2200
2224
|
svg_path: null
|
|
@@ -2235,6 +2259,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2235
2259
|
Tex: "\\nsubseteq",
|
|
2236
2260
|
mirror: true,
|
|
2237
2261
|
displayMirror: false,
|
|
2262
|
+
compileMirror: true,
|
|
2238
2263
|
Label: "\u2288",
|
|
2239
2264
|
title: "\u0644\u064A\u0633\u062A \u0645\u062C\u0645\u0648\u0639\u0629 \u062C\u0632\u0626\u064A\u0629 \u0623\u0648 \u062A\u0633\u0627\u0648\u064A",
|
|
2240
2265
|
svg_path: null
|
|
@@ -2245,6 +2270,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2245
2270
|
Tex: "\\nsupseteq",
|
|
2246
2271
|
mirror: true,
|
|
2247
2272
|
displayMirror: false,
|
|
2273
|
+
compileMirror: true,
|
|
2248
2274
|
Label: "\u2289",
|
|
2249
2275
|
title: "\u0644\u064A\u0633\u062A \u0645\u062C\u0645\u0648\u0639\u0629 \u0634\u0627\u0645\u0644\u0629 \u0623\u0648 \u062A\u0633\u0627\u0648\u064A",
|
|
2250
2276
|
svg_path: null
|
|
@@ -2292,6 +2318,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2292
2318
|
Tex: "\\ddots",
|
|
2293
2319
|
mirror: true,
|
|
2294
2320
|
displayMirror: false,
|
|
2321
|
+
compileMirror: true,
|
|
2295
2322
|
Label: "\u22F1",
|
|
2296
2323
|
title: "\u0646\u0642\u0627\u0637 \u0642\u0637\u0631\u064A\u0629",
|
|
2297
2324
|
svg_path: null
|
|
@@ -2311,6 +2338,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2311
2338
|
category: "operators3",
|
|
2312
2339
|
Tex: "\\implies",
|
|
2313
2340
|
mirror: true,
|
|
2341
|
+
compileMirror: true,
|
|
2314
2342
|
Label: "\u21D2",
|
|
2315
2343
|
title: "\u064A\u0633\u062A\u0644\u0632\u0645",
|
|
2316
2344
|
svg_path: null
|
|
@@ -2320,6 +2348,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2320
2348
|
category: "operators3",
|
|
2321
2349
|
Tex: "\\impliedby",
|
|
2322
2350
|
mirror: true,
|
|
2351
|
+
compileMirror: true,
|
|
2323
2352
|
Label: "\u21D0",
|
|
2324
2353
|
title: "\u0645\u0633\u062A\u0644\u0632\u0645 \u0645\u0646",
|
|
2325
2354
|
svg_path: null
|
|
@@ -2338,6 +2367,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2338
2367
|
category: "operators3",
|
|
2339
2368
|
Tex: "\\Longrightarrow",
|
|
2340
2369
|
mirror: true,
|
|
2370
|
+
compileMirror: true,
|
|
2341
2371
|
Label: "\u27F9",
|
|
2342
2372
|
title: "\u0633\u0647\u0645 \u0645\u0632\u062F\u0648\u062C \u0637\u0648\u064A\u0644 \u0625\u0644\u0649 \u0627\u0644\u064A\u0645\u064A\u0646",
|
|
2343
2373
|
svg_path: null
|
|
@@ -2347,6 +2377,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2347
2377
|
category: "operators3",
|
|
2348
2378
|
Tex: "\\Longleftarrow",
|
|
2349
2379
|
mirror: true,
|
|
2380
|
+
compileMirror: true,
|
|
2350
2381
|
Label: "\u27F8",
|
|
2351
2382
|
title: "\u0633\u0647\u0645 \u0645\u0632\u062F\u0648\u062C \u0637\u0648\u064A\u0644 \u0625\u0644\u0649 \u0627\u0644\u064A\u0633\u0627\u0631",
|
|
2352
2383
|
svg_path: null
|
|
@@ -2356,6 +2387,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2356
2387
|
category: "operators3",
|
|
2357
2388
|
Tex: "\\to",
|
|
2358
2389
|
mirror: true,
|
|
2390
|
+
compileMirror: true,
|
|
2359
2391
|
Label: "\u2192",
|
|
2360
2392
|
title: "\u064A\u0624\u0648\u0644 \u0625\u0644\u0649",
|
|
2361
2393
|
svg_path: null
|
|
@@ -2365,6 +2397,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2365
2397
|
category: "operators3",
|
|
2366
2398
|
Tex: "\\rightleftharpoons",
|
|
2367
2399
|
mirror: true,
|
|
2400
|
+
compileMirror: true,
|
|
2368
2401
|
Label: "\u21CC",
|
|
2369
2402
|
title: "\u0627\u062A\u0632\u0627\u0646",
|
|
2370
2403
|
svg_path: null
|
|
@@ -2374,6 +2407,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2374
2407
|
category: "operators3",
|
|
2375
2408
|
Tex: "\\leftarrow",
|
|
2376
2409
|
mirror: true,
|
|
2410
|
+
compileMirror: true,
|
|
2377
2411
|
Label: "\u2190",
|
|
2378
2412
|
title: "\u0633\u0647\u0645 \u0625\u0644\u0649 \u0627\u0644\u064A\u0633\u0627\u0631",
|
|
2379
2413
|
svg_path: null
|
|
@@ -2383,6 +2417,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2383
2417
|
category: "operators3",
|
|
2384
2418
|
Tex: "\\rightarrow",
|
|
2385
2419
|
mirror: true,
|
|
2420
|
+
compileMirror: true,
|
|
2386
2421
|
Label: "\u2192",
|
|
2387
2422
|
title: "\u0633\u0647\u0645 \u0625\u0644\u0649 \u0627\u0644\u064A\u0645\u064A\u0646",
|
|
2388
2423
|
svg_path: null
|
|
@@ -2392,6 +2427,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2392
2427
|
category: "operators3",
|
|
2393
2428
|
Tex: "\\Leftarrow",
|
|
2394
2429
|
mirror: true,
|
|
2430
|
+
compileMirror: true,
|
|
2395
2431
|
Label: "\u21D0",
|
|
2396
2432
|
title: "\u0633\u0647\u0645 \u0645\u0632\u062F\u0648\u062C \u0625\u0644\u0649 \u0627\u0644\u064A\u0633\u0627\u0631",
|
|
2397
2433
|
svg_path: null
|
|
@@ -2401,6 +2437,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2401
2437
|
category: "operators3",
|
|
2402
2438
|
Tex: "\\Rightarrow",
|
|
2403
2439
|
mirror: true,
|
|
2440
|
+
compileMirror: true,
|
|
2404
2441
|
Label: "\u21D2",
|
|
2405
2442
|
title: "\u0633\u0647\u0645 \u0645\u0632\u062F\u0648\u062C \u0625\u0644\u0649 \u0627\u0644\u064A\u0645\u064A\u0646",
|
|
2406
2443
|
svg_path: null
|
|
@@ -2410,6 +2447,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2410
2447
|
category: "operators3",
|
|
2411
2448
|
Tex: "\\leftharpoonup",
|
|
2412
2449
|
mirror: true,
|
|
2450
|
+
compileMirror: true,
|
|
2413
2451
|
Label: "\u21BC",
|
|
2414
2452
|
title: "\u0633\u0647\u0645 \u062E\u0637\u0627\u0641\u064A \u0639\u0644\u0648\u064A \u0625\u0644\u0649 \u0627\u0644\u064A\u0633\u0627\u0631",
|
|
2415
2453
|
svg_path: null
|
|
@@ -2419,6 +2457,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2419
2457
|
category: "operators3",
|
|
2420
2458
|
Tex: "\\rightharpoonup",
|
|
2421
2459
|
mirror: true,
|
|
2460
|
+
compileMirror: true,
|
|
2422
2461
|
Label: "\u21C0",
|
|
2423
2462
|
title: "\u0633\u0647\u0645 \u062E\u0637\u0627\u0641\u064A \u0639\u0644\u0648\u064A \u0625\u0644\u0649 \u0627\u0644\u064A\u0645\u064A\u0646",
|
|
2424
2463
|
svg_path: null
|
|
@@ -2428,6 +2467,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2428
2467
|
category: "operators3",
|
|
2429
2468
|
Tex: "\\leftharpoondown",
|
|
2430
2469
|
mirror: true,
|
|
2470
|
+
compileMirror: true,
|
|
2431
2471
|
Label: "\u21BD",
|
|
2432
2472
|
title: "\u0633\u0647\u0645 \u062E\u0637\u0627\u0641\u064A \u0633\u0641\u0644\u064A \u0625\u0644\u0649 \u0627\u0644\u064A\u0633\u0627\u0631",
|
|
2433
2473
|
svg_path: null
|
|
@@ -2437,6 +2477,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2437
2477
|
category: "operators3",
|
|
2438
2478
|
Tex: "\\rightharpoondown",
|
|
2439
2479
|
mirror: true,
|
|
2480
|
+
compileMirror: true,
|
|
2440
2481
|
Label: "\u21C1",
|
|
2441
2482
|
title: "\u0633\u0647\u0645 \u062E\u0637\u0627\u0641\u064A \u0633\u0641\u0644\u064A \u0625\u0644\u0649 \u0627\u0644\u064A\u0645\u064A\u0646",
|
|
2442
2483
|
svg_path: null
|
|
@@ -2447,6 +2488,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2447
2488
|
category: "integrals",
|
|
2448
2489
|
Tex: "\\int",
|
|
2449
2490
|
mirror: true,
|
|
2491
|
+
compileMirror: true,
|
|
2450
2492
|
Label: "\u222B",
|
|
2451
2493
|
title: "\u062A\u0643\u0627\u0645\u0644",
|
|
2452
2494
|
svg_path: null
|
|
@@ -2457,6 +2499,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2457
2499
|
Tex: "\\iint",
|
|
2458
2500
|
mirror: true,
|
|
2459
2501
|
displayMirror: false,
|
|
2502
|
+
compileMirror: true,
|
|
2460
2503
|
Label: "\u222C",
|
|
2461
2504
|
title: "\u062A\u0643\u0627\u0645\u0644 \u0645\u0632\u062F\u0648\u062C",
|
|
2462
2505
|
svg_path: null
|
|
@@ -2467,6 +2510,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2467
2510
|
Tex: "\\iiint",
|
|
2468
2511
|
mirror: true,
|
|
2469
2512
|
displayMirror: false,
|
|
2513
|
+
compileMirror: true,
|
|
2470
2514
|
Label: "\u222D",
|
|
2471
2515
|
title: "\u062A\u0643\u0627\u0645\u0644 \u062B\u0644\u0627\u062B\u064A",
|
|
2472
2516
|
svg_path: null
|
|
@@ -2477,6 +2521,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2477
2521
|
Tex: "\\iiiint",
|
|
2478
2522
|
mirror: true,
|
|
2479
2523
|
displayMirror: false,
|
|
2524
|
+
compileMirror: true,
|
|
2480
2525
|
Label: "\u2A0C",
|
|
2481
2526
|
title: "\u062A\u0643\u0627\u0645\u0644 \u0631\u0628\u0627\u0639\u064A",
|
|
2482
2527
|
svg_path: null
|
|
@@ -2487,6 +2532,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2487
2532
|
Tex: "\\oint",
|
|
2488
2533
|
mirror: true,
|
|
2489
2534
|
displayMirror: false,
|
|
2535
|
+
compileMirror: true,
|
|
2490
2536
|
Label: "\u222E",
|
|
2491
2537
|
title: "\u062A\u0643\u0627\u0645\u0644 \u0645\u063A\u0644\u0642",
|
|
2492
2538
|
svg_path: null
|
|
@@ -2497,6 +2543,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2497
2543
|
Tex: "\\oiint",
|
|
2498
2544
|
mirror: true,
|
|
2499
2545
|
displayMirror: false,
|
|
2546
|
+
compileMirror: true,
|
|
2500
2547
|
Label: "\u222F",
|
|
2501
2548
|
title: "\u062A\u0643\u0627\u0645\u0644 \u0633\u0637\u062D\u064A \u0645\u063A\u0644\u0642",
|
|
2502
2549
|
svg_path: null
|
|
@@ -2507,12 +2554,76 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2507
2554
|
Tex: "\\oiiint",
|
|
2508
2555
|
mirror: true,
|
|
2509
2556
|
displayMirror: false,
|
|
2557
|
+
compileMirror: true,
|
|
2510
2558
|
Label: "\u2230",
|
|
2511
2559
|
title: "\u062A\u0643\u0627\u0645\u0644 \u062D\u062C\u0645\u064A \u0645\u063A\u0644\u0642",
|
|
2512
2560
|
svg_path: null
|
|
2513
2561
|
}
|
|
2514
2562
|
};
|
|
2515
2563
|
var MIRRORED_OPERATOR_TEX = Object.values(ATOMIC_OPERATOR_COMMANDS).filter((command) => command.mirror).map((command) => command.Tex).sort((a, b) => b.length - a.length);
|
|
2564
|
+
var COMPILE_MIRRORED_OPERATOR_TEX = Object.values(ATOMIC_OPERATOR_COMMANDS).filter((command) => "compileMirror" in command && command.compileMirror).map((command) => command.Tex).sort((a, b) => b.length - a.length);
|
|
2565
|
+
function matchingMirroredOperatorFrom(tex, index, operatorTexList) {
|
|
2566
|
+
for (const operatorTex of operatorTexList) {
|
|
2567
|
+
if (!tex.startsWith(operatorTex, index)) {
|
|
2568
|
+
continue;
|
|
2569
|
+
}
|
|
2570
|
+
const next = tex[index + operatorTex.length];
|
|
2571
|
+
if (next != null && /[A-Za-z]/.test(next)) {
|
|
2572
|
+
continue;
|
|
2573
|
+
}
|
|
2574
|
+
return operatorTex;
|
|
2575
|
+
}
|
|
2576
|
+
return null;
|
|
2577
|
+
}
|
|
2578
|
+
function findMatchingBrace(tex, openIndex) {
|
|
2579
|
+
let depth = 0;
|
|
2580
|
+
for (let index = openIndex; index < tex.length; index += 1) {
|
|
2581
|
+
const char = tex[index];
|
|
2582
|
+
if (char === "\\") {
|
|
2583
|
+
index += 1;
|
|
2584
|
+
continue;
|
|
2585
|
+
}
|
|
2586
|
+
if (char === "{") {
|
|
2587
|
+
depth += 1;
|
|
2588
|
+
} else if (char === "}") {
|
|
2589
|
+
depth -= 1;
|
|
2590
|
+
if (depth === 0) {
|
|
2591
|
+
return index;
|
|
2592
|
+
}
|
|
2593
|
+
}
|
|
2594
|
+
}
|
|
2595
|
+
return -1;
|
|
2596
|
+
}
|
|
2597
|
+
function mirrorBuTeXOperatorsInTex(tex, options = {}) {
|
|
2598
|
+
const mirroredOperatorTex = options.target === "compile" ? COMPILE_MIRRORED_OPERATOR_TEX : MIRRORED_OPERATOR_TEX;
|
|
2599
|
+
let result = "";
|
|
2600
|
+
let index = 0;
|
|
2601
|
+
while (index < tex.length) {
|
|
2602
|
+
if (tex.startsWith("\\butexmirror{", index)) {
|
|
2603
|
+
const end = findMatchingBrace(tex, index + "\\butexmirror".length);
|
|
2604
|
+
if (end !== -1) {
|
|
2605
|
+
const bodyStart = index + "\\butexmirror{".length;
|
|
2606
|
+
const body = tex.slice(bodyStart, end);
|
|
2607
|
+
if (options.target === "compile" && MIRRORED_OPERATOR_TEX.includes(body) && !mirroredOperatorTex.includes(body)) {
|
|
2608
|
+
result += body;
|
|
2609
|
+
} else {
|
|
2610
|
+
result += tex.slice(index, end + 1);
|
|
2611
|
+
}
|
|
2612
|
+
index = end + 1;
|
|
2613
|
+
continue;
|
|
2614
|
+
}
|
|
2615
|
+
}
|
|
2616
|
+
const operatorTex = matchingMirroredOperatorFrom(tex, index, mirroredOperatorTex);
|
|
2617
|
+
if (operatorTex) {
|
|
2618
|
+
result += `\\butexmirror{${operatorTex}}`;
|
|
2619
|
+
index += operatorTex.length;
|
|
2620
|
+
continue;
|
|
2621
|
+
}
|
|
2622
|
+
result += tex[index];
|
|
2623
|
+
index += 1;
|
|
2624
|
+
}
|
|
2625
|
+
return result;
|
|
2626
|
+
}
|
|
2516
2627
|
function atomicOperatorCommandSpec(id) {
|
|
2517
2628
|
return Object.prototype.hasOwnProperty.call(ATOMIC_OPERATOR_COMMANDS, id) ? ATOMIC_OPERATOR_COMMANDS[id] : null;
|
|
2518
2629
|
}
|
|
@@ -2995,6 +3106,28 @@ function renderArabicLatexFromSession(session) {
|
|
|
2995
3106
|
return renderChainArabic(session.arabicTree, { digitForm: session.currentDigitForm ?? "western" });
|
|
2996
3107
|
}
|
|
2997
3108
|
|
|
3109
|
+
// src/editor/state.ts
|
|
3110
|
+
function appendDebug(session, command, note) {
|
|
3111
|
+
const entry = {
|
|
3112
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3113
|
+
command,
|
|
3114
|
+
activeSide: session.activeSide,
|
|
3115
|
+
englishLatex: renderEnglishLatexFromSession(session),
|
|
3116
|
+
arabicLatex: renderArabicLatexFromSession(session),
|
|
3117
|
+
renderOk: true,
|
|
3118
|
+
renderError: null,
|
|
3119
|
+
note
|
|
3120
|
+
};
|
|
3121
|
+
const nextLog = session.debugLog.concat(entry);
|
|
3122
|
+
session.debugLog = nextLog.slice(-120);
|
|
3123
|
+
}
|
|
3124
|
+
function setCurrentDigitForm(session, digitForm) {
|
|
3125
|
+
const next = cloneEditorSession(session);
|
|
3126
|
+
next.currentDigitForm = digitForm;
|
|
3127
|
+
appendDebug(next, "setCurrentDigitForm", digitForm);
|
|
3128
|
+
return next;
|
|
3129
|
+
}
|
|
3130
|
+
|
|
2998
3131
|
// src/editor/display/delimiter.ts
|
|
2999
3132
|
var DELIMITER_CSS = `
|
|
3000
3133
|
.delim-pair {
|
|
@@ -4314,18 +4447,19 @@ function mathNodeFromSession(session, opening = "$", closing = "$") {
|
|
|
4314
4447
|
function mathNodeFromArabicSession(session, opening = "$", closing = "$") {
|
|
4315
4448
|
return mathNodeFromSession(session, opening, closing);
|
|
4316
4449
|
}
|
|
4317
|
-
function mathTokenSourceForSide(token, side) {
|
|
4450
|
+
function mathTokenSourceForSide(token, side, digitForm) {
|
|
4318
4451
|
if (!token.math || token.sourceOwner === "raw") {
|
|
4319
4452
|
return token.source;
|
|
4320
4453
|
}
|
|
4321
|
-
if (token.sourceSide === side) {
|
|
4454
|
+
if (token.sourceSide === side && digitForm === void 0) {
|
|
4322
4455
|
return token.source;
|
|
4323
4456
|
}
|
|
4324
4457
|
const result = mathTokenToEditorSession(token.math, side);
|
|
4325
4458
|
if (!result.editable) {
|
|
4326
4459
|
return token.source;
|
|
4327
4460
|
}
|
|
4328
|
-
|
|
4461
|
+
const session = digitForm === void 0 ? result.session : setCurrentDigitForm(result.session, digitForm);
|
|
4462
|
+
return mathSourceFromSession(session, side, token.opening, token.closing);
|
|
4329
4463
|
}
|
|
4330
4464
|
|
|
4331
4465
|
// src/document2/commands.ts
|
|
@@ -5125,6 +5259,19 @@ function document2KeyError(key, namespace = {}) {
|
|
|
5125
5259
|
}
|
|
5126
5260
|
|
|
5127
5261
|
// src/document2/arabicPreamble.ts
|
|
5262
|
+
function fontOptions(digitsMapping, includeScript = true) {
|
|
5263
|
+
const parts = [];
|
|
5264
|
+
if (includeScript) {
|
|
5265
|
+
parts.push("Script=Arabic");
|
|
5266
|
+
}
|
|
5267
|
+
if (digitsMapping !== "digits") {
|
|
5268
|
+
parts.push(`Mapping=${digitsMapping}`);
|
|
5269
|
+
}
|
|
5270
|
+
if (parts.length === 0) {
|
|
5271
|
+
return "";
|
|
5272
|
+
}
|
|
5273
|
+
return `[${parts.join(",")}]`;
|
|
5274
|
+
}
|
|
5128
5275
|
function arabicXeLatexPreamblePkg(twocolumn = false) {
|
|
5129
5276
|
const classOptions = twocolumn ? "12pt,a4paper,notitlepage,twocolumn" : "12pt,a4paper,notitlepage";
|
|
5130
5277
|
return `
|
|
@@ -5153,25 +5300,27 @@ function arabicXeLatexPreamblePkg(twocolumn = false) {
|
|
|
5153
5300
|
% save back tick for use - copy paste -> ` + "`";
|
|
5154
5301
|
}
|
|
5155
5302
|
function arabicXeLatexPreambleFont(digitsMapping = "arabicdigits") {
|
|
5156
|
-
const customFonts = NON_DEFAULT_CHARACTER_FONT_SPECS.filter((font) => font.latexFontCommand && font.latexFontFamily).map((font) => `\\newfontfamily${font.latexFontCommand}
|
|
5303
|
+
const customFonts = NON_DEFAULT_CHARACTER_FONT_SPECS.filter((font) => font.latexFontCommand && font.latexFontFamily).map((font) => `\\newfontfamily${font.latexFontCommand}${fontOptions(digitsMapping)}{${font.latexFontFamily}}`).join("\n");
|
|
5304
|
+
const mathFontOptions = fontOptions(digitsMapping, false);
|
|
5157
5305
|
return `
|
|
5158
5306
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
5159
5307
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
5160
|
-
%
|
|
5308
|
+
% Persian digits: Mapping=farsidigits
|
|
5309
|
+
% Arabic-Indic digits: Mapping=arabicdigits
|
|
5310
|
+
% Western digits: omit Mapping entirely
|
|
5161
5311
|
\\setdefaultlanguage[calendar=gregorian]{arabic} % from polyglossia
|
|
5162
|
-
\\setmainfont
|
|
5312
|
+
\\setmainfont${fontOptions(digitsMapping)}{Amiri}
|
|
5163
5313
|
${customFonts}
|
|
5164
|
-
\\newfontfamily\\boldarabic
|
|
5165
|
-
\\newfontfamily\\italicarabic
|
|
5314
|
+
\\newfontfamily\\boldarabic${fontOptions(digitsMapping)}{Amiri Bold}
|
|
5315
|
+
\\newfontfamily\\italicarabic${fontOptions(digitsMapping)}{Amiri Italic}
|
|
5166
5316
|
|
|
5167
5317
|
% for polyglossia url I dont know, sugggested by cursor
|
|
5168
|
-
\\newfontfamily\\arabicfonttt
|
|
5169
|
-
\\newfontfamily\\arabicfontsf
|
|
5318
|
+
\\newfontfamily\\arabicfonttt${fontOptions(digitsMapping)}{Amiri}
|
|
5319
|
+
\\newfontfamily\\arabicfontsf${fontOptions(digitsMapping)}{Amiri}
|
|
5170
5320
|
|
|
5171
5321
|
|
|
5172
5322
|
% Explicitly set math font to XITS Math
|
|
5173
|
-
%
|
|
5174
|
-
\\setmathfont[Script=Arabic , Mapping=${digitsMapping}]{XITS Math} % Ensure XITS Math is correctly installed and available
|
|
5323
|
+
\\setmathfont${mathFontOptions}{XITS Math} % Ensure XITS Math is correctly installed and available
|
|
5175
5324
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
5176
5325
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
5177
5326
|
`;
|
|
@@ -5333,8 +5482,20 @@ function getArabicXeLatexPreamble(digitsMappingOrOptions = "arabicdigits") {
|
|
|
5333
5482
|
}
|
|
5334
5483
|
|
|
5335
5484
|
// src/document2/exportLatex.ts
|
|
5485
|
+
function digitsMappingFromDigitForm(digitForm) {
|
|
5486
|
+
if (digitForm === "western") {
|
|
5487
|
+
return "digits";
|
|
5488
|
+
}
|
|
5489
|
+
if (digitForm === "persianIndic") {
|
|
5490
|
+
return "farsidigits";
|
|
5491
|
+
}
|
|
5492
|
+
return "arabicdigits";
|
|
5493
|
+
}
|
|
5336
5494
|
function mathBodyLatex(token) {
|
|
5337
|
-
if (
|
|
5495
|
+
if (token.sourceOwner === "editor") {
|
|
5496
|
+
return stripDisplayMathDelimiters(mirrorBuTeXOperatorsInTex(token.source, { target: "compile" }));
|
|
5497
|
+
}
|
|
5498
|
+
if (!token.math || token.sourceOwner === "raw") {
|
|
5338
5499
|
return stripDisplayMathDelimiters(token.source);
|
|
5339
5500
|
}
|
|
5340
5501
|
const rendered = renderMathNodeLatex(token.math);
|
|
@@ -5370,7 +5531,10 @@ ${body}
|
|
|
5370
5531
|
\\label{${token.label.trim()}}
|
|
5371
5532
|
\\end{equation}`;
|
|
5372
5533
|
}
|
|
5373
|
-
if (
|
|
5534
|
+
if (token.sourceOwner === "editor") {
|
|
5535
|
+
return mirrorBuTeXOperatorsInTex(token.source, { target: "compile" });
|
|
5536
|
+
}
|
|
5537
|
+
if (!token.math || token.sourceOwner === "raw") {
|
|
5374
5538
|
return token.source;
|
|
5375
5539
|
}
|
|
5376
5540
|
return renderMathNodeLatex(token.math);
|
|
@@ -5488,7 +5652,7 @@ function articleMaketitlePreamble(meta, twocolumn = false) {
|
|
|
5488
5652
|
if (meta.authors.trim().length > 0) {
|
|
5489
5653
|
parts.push(`\\author{${authorLatex(meta.authors)}}`);
|
|
5490
5654
|
}
|
|
5491
|
-
parts.push(`\\date{${formatHijriDate(meta.date, { locale: "ar", digitForm: "
|
|
5655
|
+
parts.push(`\\date{${formatHijriDate(meta.date, { locale: "ar", digitForm: "western" })}}`);
|
|
5492
5656
|
return parts.join("\n");
|
|
5493
5657
|
}
|
|
5494
5658
|
function articleFrontMatterLatex(meta) {
|
|
@@ -5510,7 +5674,7 @@ function document2Latex(document2, options = {}) {
|
|
|
5510
5674
|
const twocolumn = options.twocolumn === true;
|
|
5511
5675
|
const front = articleFrontMatterLatex(meta);
|
|
5512
5676
|
const bodyBlocks = document2.blocks.map((block) => blockLatex(block, document2.references));
|
|
5513
|
-
const closing =
|
|
5677
|
+
const closing = butexMaghribiDisplayLatex(BUTEX_CLOSING_HAMDALA);
|
|
5514
5678
|
const body = [...front, ...bodyBlocks, closing].filter((part) => part.length > 0).join("\n\n");
|
|
5515
5679
|
const wrapDocument = options.wrapDocument !== false;
|
|
5516
5680
|
if (!wrapDocument) {
|
|
@@ -5520,7 +5684,7 @@ function document2Latex(document2, options = {}) {
|
|
|
5520
5684
|
${body}` : body;
|
|
5521
5685
|
}
|
|
5522
5686
|
const preamble = getArabicXeLatexPreamble({
|
|
5523
|
-
digitsMapping: options.digitsMapping ??
|
|
5687
|
+
digitsMapping: options.digitsMapping ?? digitsMappingFromDigitForm(options.digitForm),
|
|
5524
5688
|
twocolumn
|
|
5525
5689
|
}) + "\n" + articleMaketitlePreamble(meta, twocolumn);
|
|
5526
5690
|
return `${preamble}
|
|
@@ -5776,8 +5940,8 @@ function remapSelectionAfterRangeMove(selection, direction) {
|
|
|
5776
5940
|
}
|
|
5777
5941
|
|
|
5778
5942
|
// src/document2/previewModel.ts
|
|
5779
|
-
function mathTex(token, equationSide) {
|
|
5780
|
-
return mathTokenSourceForSide(token, equationSide);
|
|
5943
|
+
function mathTex(token, equationSide, digitForm) {
|
|
5944
|
+
return mathTokenSourceForSide(token, equationSide, digitForm);
|
|
5781
5945
|
}
|
|
5782
5946
|
function previewInlines(field, islands, output, equationSide, document2, previewOptions) {
|
|
5783
5947
|
return field.tokens.map((token) => {
|
|
@@ -5809,7 +5973,7 @@ function previewInlines(field, islands, output, equationSide, document2, preview
|
|
|
5809
5973
|
}
|
|
5810
5974
|
const island = {
|
|
5811
5975
|
id: token.id,
|
|
5812
|
-
tex: mathTex(token, equationSide),
|
|
5976
|
+
tex: mathTex(token, equationSide, previewOptions.digitForm),
|
|
5813
5977
|
display: token.display,
|
|
5814
5978
|
output,
|
|
5815
5979
|
editable: token.editable
|
|
@@ -5944,7 +6108,7 @@ function document2Preview(document2, output = "svg", equationSide = "arabic", pr
|
|
|
5944
6108
|
blocks: [
|
|
5945
6109
|
...articleChromePreview(document2, options.uiLocale ?? "ar", options),
|
|
5946
6110
|
...body,
|
|
5947
|
-
{ kind: "closing", id: "article-closing", text: BUTEX_CLOSING_HAMDALA, tex:
|
|
6111
|
+
{ kind: "closing", id: "article-closing", text: BUTEX_CLOSING_HAMDALA, tex: butexMaghribiDisplayTex(BUTEX_CLOSING_HAMDALA) }
|
|
5948
6112
|
],
|
|
5949
6113
|
mathIslands
|
|
5950
6114
|
};
|
|
@@ -5980,6 +6144,8 @@ export {
|
|
|
5980
6144
|
butexDiwaniDisplayLatex,
|
|
5981
6145
|
butexDiwaniDisplayTex,
|
|
5982
6146
|
butexInColumnMaketitleHook,
|
|
6147
|
+
butexMaghribiDisplayLatex,
|
|
6148
|
+
butexMaghribiDisplayTex,
|
|
5983
6149
|
citeTokenLatex,
|
|
5984
6150
|
cloneDocument2Meta,
|
|
5985
6151
|
cloneDocument2Node,
|