@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.js
CHANGED
|
@@ -50,6 +50,8 @@ __export(document2_exports, {
|
|
|
50
50
|
butexDiwaniDisplayLatex: () => butexDiwaniDisplayLatex,
|
|
51
51
|
butexDiwaniDisplayTex: () => butexDiwaniDisplayTex,
|
|
52
52
|
butexInColumnMaketitleHook: () => butexInColumnMaketitleHook,
|
|
53
|
+
butexMaghribiDisplayLatex: () => butexMaghribiDisplayLatex,
|
|
54
|
+
butexMaghribiDisplayTex: () => butexMaghribiDisplayTex,
|
|
53
55
|
citeTokenLatex: () => citeTokenLatex,
|
|
54
56
|
cloneDocument2Meta: () => cloneDocument2Meta,
|
|
55
57
|
cloneDocument2Node: () => cloneDocument2Node,
|
|
@@ -195,21 +197,34 @@ var BUTEX_CLOSING_HAMDALA = "\u0627\u0644\u0652\u062D\u064E\u0645\u0652\u062F\u0
|
|
|
195
197
|
function escapeButexTextArg(text) {
|
|
196
198
|
return text.replace(/\\/g, "\\textbackslash{}").replace(/[{}]/g, "\\$&");
|
|
197
199
|
}
|
|
200
|
+
function butexFontDisplayTex(macro, text) {
|
|
201
|
+
return `${macro}{${escapeButexTextArg(text)}}`;
|
|
202
|
+
}
|
|
198
203
|
function butexDiwaniDisplayTex(text) {
|
|
199
|
-
return
|
|
204
|
+
return butexFontDisplayTex("\\butexdiwani", text);
|
|
200
205
|
}
|
|
201
206
|
function butexDiwaniDisplayLatex(text) {
|
|
202
207
|
return `\\[
|
|
203
208
|
${butexDiwaniDisplayTex(text)}
|
|
204
209
|
\\]`;
|
|
205
210
|
}
|
|
211
|
+
function butexMaghribiDisplayTex(text) {
|
|
212
|
+
return butexFontDisplayTex("\\butexmaghribi", text);
|
|
213
|
+
}
|
|
214
|
+
function butexMaghribiDisplayLatex(text) {
|
|
215
|
+
return `\\[
|
|
216
|
+
${butexMaghribiDisplayTex(text)}
|
|
217
|
+
\\]`;
|
|
218
|
+
}
|
|
206
219
|
var BASMALA_LINES = [BUTEX_BASMALA_LINE1, BUTEX_BASMALA_LINE2, BUTEX_BASMALA_SALAWAT];
|
|
207
220
|
function butexBasmalaDisplayTex() {
|
|
208
|
-
return BASMALA_LINES.map((line) =>
|
|
221
|
+
return BASMALA_LINES.map((line) => butexMaghribiDisplayTex(line)).join(" \\\\ ");
|
|
209
222
|
}
|
|
210
223
|
function butexBasmalaDisplayLatex() {
|
|
211
224
|
return `\\[
|
|
212
|
-
|
|
225
|
+
\\begin{gathered}
|
|
226
|
+
${BASMALA_LINES.map((line) => butexMaghribiDisplayTex(line)).join(" \\\\\n")}
|
|
227
|
+
\\end{gathered}
|
|
213
228
|
\\]`;
|
|
214
229
|
}
|
|
215
230
|
function butexInColumnMaketitleHook() {
|
|
@@ -246,7 +261,7 @@ function butexBasmalaTitlingPreamble(options = {}) {
|
|
|
246
261
|
" \\begin{center}",
|
|
247
262
|
...BASMALA_LINES.map((line, index) => {
|
|
248
263
|
const suffix = index < BASMALA_LINES.length - 1 ? "\\\\" : "";
|
|
249
|
-
return ` ${
|
|
264
|
+
return ` ${butexMaghribiDisplayTex(line)}${suffix}`;
|
|
250
265
|
}),
|
|
251
266
|
" \\par\\vspace{1.5em}",
|
|
252
267
|
" \\LARGE",
|
|
@@ -2205,6 +2220,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2205
2220
|
category: "operators1",
|
|
2206
2221
|
Tex: "\\neq",
|
|
2207
2222
|
mirror: true,
|
|
2223
|
+
compileMirror: true,
|
|
2208
2224
|
Label: "\u2260",
|
|
2209
2225
|
title: "\u0644\u0627 \u064A\u0633\u0627\u0648\u064A",
|
|
2210
2226
|
svg_path: null
|
|
@@ -2244,6 +2260,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2244
2260
|
Tex: "\\leq",
|
|
2245
2261
|
mirror: true,
|
|
2246
2262
|
displayMirror: false,
|
|
2263
|
+
compileMirror: true,
|
|
2247
2264
|
Label: "\u2264",
|
|
2248
2265
|
title: "\u0623\u0635\u063A\u0631 \u0645\u0646 \u0623\u0648 \u064A\u0633\u0627\u0648\u064A",
|
|
2249
2266
|
svg_path: null
|
|
@@ -2254,6 +2271,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2254
2271
|
Tex: "\\geq",
|
|
2255
2272
|
mirror: true,
|
|
2256
2273
|
displayMirror: false,
|
|
2274
|
+
compileMirror: true,
|
|
2257
2275
|
Label: "\u2265",
|
|
2258
2276
|
title: "\u0623\u0643\u0628\u0631 \u0645\u0646 \u0623\u0648 \u064A\u0633\u0627\u0648\u064A",
|
|
2259
2277
|
svg_path: null
|
|
@@ -2264,6 +2282,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2264
2282
|
Tex: "\\coloneqq",
|
|
2265
2283
|
mirror: true,
|
|
2266
2284
|
displayMirror: false,
|
|
2285
|
+
compileMirror: true,
|
|
2267
2286
|
Label: "\u2254",
|
|
2268
2287
|
title: "\u064A\u0639\u0631\u0641 \u0628\u0623\u0646\u0647 \u064A\u0633\u0627\u0648\u064A",
|
|
2269
2288
|
svg_path: null
|
|
@@ -2274,6 +2293,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2274
2293
|
Tex: "\\eqqcolon",
|
|
2275
2294
|
mirror: true,
|
|
2276
2295
|
displayMirror: false,
|
|
2296
|
+
compileMirror: true,
|
|
2277
2297
|
Label: "\u2255",
|
|
2278
2298
|
title: "\u064A\u0633\u0627\u0648\u064A \u0628\u0627\u0644\u062A\u0639\u0631\u064A\u0641",
|
|
2279
2299
|
svg_path: null
|
|
@@ -2285,6 +2305,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2285
2305
|
Tex: "\\propto",
|
|
2286
2306
|
mirror: true,
|
|
2287
2307
|
displayMirror: false,
|
|
2308
|
+
compileMirror: true,
|
|
2288
2309
|
Label: "\u221D",
|
|
2289
2310
|
title: "\u064A\u062A\u0646\u0627\u0633\u0628 \u0645\u0639",
|
|
2290
2311
|
svg_path: null
|
|
@@ -2295,6 +2316,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2295
2316
|
Tex: "\\in",
|
|
2296
2317
|
mirror: true,
|
|
2297
2318
|
displayMirror: false,
|
|
2319
|
+
compileMirror: true,
|
|
2298
2320
|
Label: "\u2208",
|
|
2299
2321
|
title: "\u064A\u0646\u062A\u0645\u064A \u0625\u0644\u0649",
|
|
2300
2322
|
svg_path: null
|
|
@@ -2315,6 +2337,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2315
2337
|
Tex: "\\subset",
|
|
2316
2338
|
mirror: true,
|
|
2317
2339
|
displayMirror: false,
|
|
2340
|
+
compileMirror: true,
|
|
2318
2341
|
Label: "\u2282",
|
|
2319
2342
|
title: "\u0645\u062C\u0645\u0648\u0639\u0629 \u062C\u0632\u0626\u064A\u0629 \u0645\u0646",
|
|
2320
2343
|
svg_path: null
|
|
@@ -2325,6 +2348,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2325
2348
|
Tex: "\\supset",
|
|
2326
2349
|
mirror: true,
|
|
2327
2350
|
displayMirror: false,
|
|
2351
|
+
compileMirror: true,
|
|
2328
2352
|
Label: "\u2283",
|
|
2329
2353
|
title: "\u0645\u062C\u0645\u0648\u0639\u0629 \u0634\u0627\u0645\u0644\u0629 \u0644\u0640",
|
|
2330
2354
|
svg_path: null
|
|
@@ -2335,6 +2359,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2335
2359
|
Tex: "\\subseteq",
|
|
2336
2360
|
mirror: true,
|
|
2337
2361
|
displayMirror: false,
|
|
2362
|
+
compileMirror: true,
|
|
2338
2363
|
Label: "\u2286",
|
|
2339
2364
|
title: "\u0645\u062C\u0645\u0648\u0639\u0629 \u062C\u0632\u0626\u064A\u0629 \u0623\u0648 \u062A\u0633\u0627\u0648\u064A",
|
|
2340
2365
|
svg_path: null
|
|
@@ -2345,6 +2370,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2345
2370
|
Tex: "\\supseteq",
|
|
2346
2371
|
mirror: true,
|
|
2347
2372
|
displayMirror: false,
|
|
2373
|
+
compileMirror: true,
|
|
2348
2374
|
Label: "\u2287",
|
|
2349
2375
|
title: "\u0645\u062C\u0645\u0648\u0639\u0629 \u0634\u0627\u0645\u0644\u0629 \u0623\u0648 \u062A\u0633\u0627\u0648\u064A",
|
|
2350
2376
|
svg_path: null
|
|
@@ -2385,6 +2411,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2385
2411
|
Tex: "\\nsubseteq",
|
|
2386
2412
|
mirror: true,
|
|
2387
2413
|
displayMirror: false,
|
|
2414
|
+
compileMirror: true,
|
|
2388
2415
|
Label: "\u2288",
|
|
2389
2416
|
title: "\u0644\u064A\u0633\u062A \u0645\u062C\u0645\u0648\u0639\u0629 \u062C\u0632\u0626\u064A\u0629 \u0623\u0648 \u062A\u0633\u0627\u0648\u064A",
|
|
2390
2417
|
svg_path: null
|
|
@@ -2395,6 +2422,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2395
2422
|
Tex: "\\nsupseteq",
|
|
2396
2423
|
mirror: true,
|
|
2397
2424
|
displayMirror: false,
|
|
2425
|
+
compileMirror: true,
|
|
2398
2426
|
Label: "\u2289",
|
|
2399
2427
|
title: "\u0644\u064A\u0633\u062A \u0645\u062C\u0645\u0648\u0639\u0629 \u0634\u0627\u0645\u0644\u0629 \u0623\u0648 \u062A\u0633\u0627\u0648\u064A",
|
|
2400
2428
|
svg_path: null
|
|
@@ -2442,6 +2470,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2442
2470
|
Tex: "\\ddots",
|
|
2443
2471
|
mirror: true,
|
|
2444
2472
|
displayMirror: false,
|
|
2473
|
+
compileMirror: true,
|
|
2445
2474
|
Label: "\u22F1",
|
|
2446
2475
|
title: "\u0646\u0642\u0627\u0637 \u0642\u0637\u0631\u064A\u0629",
|
|
2447
2476
|
svg_path: null
|
|
@@ -2461,6 +2490,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2461
2490
|
category: "operators3",
|
|
2462
2491
|
Tex: "\\implies",
|
|
2463
2492
|
mirror: true,
|
|
2493
|
+
compileMirror: true,
|
|
2464
2494
|
Label: "\u21D2",
|
|
2465
2495
|
title: "\u064A\u0633\u062A\u0644\u0632\u0645",
|
|
2466
2496
|
svg_path: null
|
|
@@ -2470,6 +2500,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2470
2500
|
category: "operators3",
|
|
2471
2501
|
Tex: "\\impliedby",
|
|
2472
2502
|
mirror: true,
|
|
2503
|
+
compileMirror: true,
|
|
2473
2504
|
Label: "\u21D0",
|
|
2474
2505
|
title: "\u0645\u0633\u062A\u0644\u0632\u0645 \u0645\u0646",
|
|
2475
2506
|
svg_path: null
|
|
@@ -2488,6 +2519,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2488
2519
|
category: "operators3",
|
|
2489
2520
|
Tex: "\\Longrightarrow",
|
|
2490
2521
|
mirror: true,
|
|
2522
|
+
compileMirror: true,
|
|
2491
2523
|
Label: "\u27F9",
|
|
2492
2524
|
title: "\u0633\u0647\u0645 \u0645\u0632\u062F\u0648\u062C \u0637\u0648\u064A\u0644 \u0625\u0644\u0649 \u0627\u0644\u064A\u0645\u064A\u0646",
|
|
2493
2525
|
svg_path: null
|
|
@@ -2497,6 +2529,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2497
2529
|
category: "operators3",
|
|
2498
2530
|
Tex: "\\Longleftarrow",
|
|
2499
2531
|
mirror: true,
|
|
2532
|
+
compileMirror: true,
|
|
2500
2533
|
Label: "\u27F8",
|
|
2501
2534
|
title: "\u0633\u0647\u0645 \u0645\u0632\u062F\u0648\u062C \u0637\u0648\u064A\u0644 \u0625\u0644\u0649 \u0627\u0644\u064A\u0633\u0627\u0631",
|
|
2502
2535
|
svg_path: null
|
|
@@ -2506,6 +2539,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2506
2539
|
category: "operators3",
|
|
2507
2540
|
Tex: "\\to",
|
|
2508
2541
|
mirror: true,
|
|
2542
|
+
compileMirror: true,
|
|
2509
2543
|
Label: "\u2192",
|
|
2510
2544
|
title: "\u064A\u0624\u0648\u0644 \u0625\u0644\u0649",
|
|
2511
2545
|
svg_path: null
|
|
@@ -2515,6 +2549,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2515
2549
|
category: "operators3",
|
|
2516
2550
|
Tex: "\\rightleftharpoons",
|
|
2517
2551
|
mirror: true,
|
|
2552
|
+
compileMirror: true,
|
|
2518
2553
|
Label: "\u21CC",
|
|
2519
2554
|
title: "\u0627\u062A\u0632\u0627\u0646",
|
|
2520
2555
|
svg_path: null
|
|
@@ -2524,6 +2559,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2524
2559
|
category: "operators3",
|
|
2525
2560
|
Tex: "\\leftarrow",
|
|
2526
2561
|
mirror: true,
|
|
2562
|
+
compileMirror: true,
|
|
2527
2563
|
Label: "\u2190",
|
|
2528
2564
|
title: "\u0633\u0647\u0645 \u0625\u0644\u0649 \u0627\u0644\u064A\u0633\u0627\u0631",
|
|
2529
2565
|
svg_path: null
|
|
@@ -2533,6 +2569,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2533
2569
|
category: "operators3",
|
|
2534
2570
|
Tex: "\\rightarrow",
|
|
2535
2571
|
mirror: true,
|
|
2572
|
+
compileMirror: true,
|
|
2536
2573
|
Label: "\u2192",
|
|
2537
2574
|
title: "\u0633\u0647\u0645 \u0625\u0644\u0649 \u0627\u0644\u064A\u0645\u064A\u0646",
|
|
2538
2575
|
svg_path: null
|
|
@@ -2542,6 +2579,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2542
2579
|
category: "operators3",
|
|
2543
2580
|
Tex: "\\Leftarrow",
|
|
2544
2581
|
mirror: true,
|
|
2582
|
+
compileMirror: true,
|
|
2545
2583
|
Label: "\u21D0",
|
|
2546
2584
|
title: "\u0633\u0647\u0645 \u0645\u0632\u062F\u0648\u062C \u0625\u0644\u0649 \u0627\u0644\u064A\u0633\u0627\u0631",
|
|
2547
2585
|
svg_path: null
|
|
@@ -2551,6 +2589,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2551
2589
|
category: "operators3",
|
|
2552
2590
|
Tex: "\\Rightarrow",
|
|
2553
2591
|
mirror: true,
|
|
2592
|
+
compileMirror: true,
|
|
2554
2593
|
Label: "\u21D2",
|
|
2555
2594
|
title: "\u0633\u0647\u0645 \u0645\u0632\u062F\u0648\u062C \u0625\u0644\u0649 \u0627\u0644\u064A\u0645\u064A\u0646",
|
|
2556
2595
|
svg_path: null
|
|
@@ -2560,6 +2599,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2560
2599
|
category: "operators3",
|
|
2561
2600
|
Tex: "\\leftharpoonup",
|
|
2562
2601
|
mirror: true,
|
|
2602
|
+
compileMirror: true,
|
|
2563
2603
|
Label: "\u21BC",
|
|
2564
2604
|
title: "\u0633\u0647\u0645 \u062E\u0637\u0627\u0641\u064A \u0639\u0644\u0648\u064A \u0625\u0644\u0649 \u0627\u0644\u064A\u0633\u0627\u0631",
|
|
2565
2605
|
svg_path: null
|
|
@@ -2569,6 +2609,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2569
2609
|
category: "operators3",
|
|
2570
2610
|
Tex: "\\rightharpoonup",
|
|
2571
2611
|
mirror: true,
|
|
2612
|
+
compileMirror: true,
|
|
2572
2613
|
Label: "\u21C0",
|
|
2573
2614
|
title: "\u0633\u0647\u0645 \u062E\u0637\u0627\u0641\u064A \u0639\u0644\u0648\u064A \u0625\u0644\u0649 \u0627\u0644\u064A\u0645\u064A\u0646",
|
|
2574
2615
|
svg_path: null
|
|
@@ -2578,6 +2619,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2578
2619
|
category: "operators3",
|
|
2579
2620
|
Tex: "\\leftharpoondown",
|
|
2580
2621
|
mirror: true,
|
|
2622
|
+
compileMirror: true,
|
|
2581
2623
|
Label: "\u21BD",
|
|
2582
2624
|
title: "\u0633\u0647\u0645 \u062E\u0637\u0627\u0641\u064A \u0633\u0641\u0644\u064A \u0625\u0644\u0649 \u0627\u0644\u064A\u0633\u0627\u0631",
|
|
2583
2625
|
svg_path: null
|
|
@@ -2587,6 +2629,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2587
2629
|
category: "operators3",
|
|
2588
2630
|
Tex: "\\rightharpoondown",
|
|
2589
2631
|
mirror: true,
|
|
2632
|
+
compileMirror: true,
|
|
2590
2633
|
Label: "\u21C1",
|
|
2591
2634
|
title: "\u0633\u0647\u0645 \u062E\u0637\u0627\u0641\u064A \u0633\u0641\u0644\u064A \u0625\u0644\u0649 \u0627\u0644\u064A\u0645\u064A\u0646",
|
|
2592
2635
|
svg_path: null
|
|
@@ -2597,6 +2640,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2597
2640
|
category: "integrals",
|
|
2598
2641
|
Tex: "\\int",
|
|
2599
2642
|
mirror: true,
|
|
2643
|
+
compileMirror: true,
|
|
2600
2644
|
Label: "\u222B",
|
|
2601
2645
|
title: "\u062A\u0643\u0627\u0645\u0644",
|
|
2602
2646
|
svg_path: null
|
|
@@ -2607,6 +2651,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2607
2651
|
Tex: "\\iint",
|
|
2608
2652
|
mirror: true,
|
|
2609
2653
|
displayMirror: false,
|
|
2654
|
+
compileMirror: true,
|
|
2610
2655
|
Label: "\u222C",
|
|
2611
2656
|
title: "\u062A\u0643\u0627\u0645\u0644 \u0645\u0632\u062F\u0648\u062C",
|
|
2612
2657
|
svg_path: null
|
|
@@ -2617,6 +2662,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2617
2662
|
Tex: "\\iiint",
|
|
2618
2663
|
mirror: true,
|
|
2619
2664
|
displayMirror: false,
|
|
2665
|
+
compileMirror: true,
|
|
2620
2666
|
Label: "\u222D",
|
|
2621
2667
|
title: "\u062A\u0643\u0627\u0645\u0644 \u062B\u0644\u0627\u062B\u064A",
|
|
2622
2668
|
svg_path: null
|
|
@@ -2627,6 +2673,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2627
2673
|
Tex: "\\iiiint",
|
|
2628
2674
|
mirror: true,
|
|
2629
2675
|
displayMirror: false,
|
|
2676
|
+
compileMirror: true,
|
|
2630
2677
|
Label: "\u2A0C",
|
|
2631
2678
|
title: "\u062A\u0643\u0627\u0645\u0644 \u0631\u0628\u0627\u0639\u064A",
|
|
2632
2679
|
svg_path: null
|
|
@@ -2637,6 +2684,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2637
2684
|
Tex: "\\oint",
|
|
2638
2685
|
mirror: true,
|
|
2639
2686
|
displayMirror: false,
|
|
2687
|
+
compileMirror: true,
|
|
2640
2688
|
Label: "\u222E",
|
|
2641
2689
|
title: "\u062A\u0643\u0627\u0645\u0644 \u0645\u063A\u0644\u0642",
|
|
2642
2690
|
svg_path: null
|
|
@@ -2647,6 +2695,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2647
2695
|
Tex: "\\oiint",
|
|
2648
2696
|
mirror: true,
|
|
2649
2697
|
displayMirror: false,
|
|
2698
|
+
compileMirror: true,
|
|
2650
2699
|
Label: "\u222F",
|
|
2651
2700
|
title: "\u062A\u0643\u0627\u0645\u0644 \u0633\u0637\u062D\u064A \u0645\u063A\u0644\u0642",
|
|
2652
2701
|
svg_path: null
|
|
@@ -2657,12 +2706,76 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2657
2706
|
Tex: "\\oiiint",
|
|
2658
2707
|
mirror: true,
|
|
2659
2708
|
displayMirror: false,
|
|
2709
|
+
compileMirror: true,
|
|
2660
2710
|
Label: "\u2230",
|
|
2661
2711
|
title: "\u062A\u0643\u0627\u0645\u0644 \u062D\u062C\u0645\u064A \u0645\u063A\u0644\u0642",
|
|
2662
2712
|
svg_path: null
|
|
2663
2713
|
}
|
|
2664
2714
|
};
|
|
2665
2715
|
var MIRRORED_OPERATOR_TEX = Object.values(ATOMIC_OPERATOR_COMMANDS).filter((command) => command.mirror).map((command) => command.Tex).sort((a, b) => b.length - a.length);
|
|
2716
|
+
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);
|
|
2717
|
+
function matchingMirroredOperatorFrom(tex, index, operatorTexList) {
|
|
2718
|
+
for (const operatorTex of operatorTexList) {
|
|
2719
|
+
if (!tex.startsWith(operatorTex, index)) {
|
|
2720
|
+
continue;
|
|
2721
|
+
}
|
|
2722
|
+
const next = tex[index + operatorTex.length];
|
|
2723
|
+
if (next != null && /[A-Za-z]/.test(next)) {
|
|
2724
|
+
continue;
|
|
2725
|
+
}
|
|
2726
|
+
return operatorTex;
|
|
2727
|
+
}
|
|
2728
|
+
return null;
|
|
2729
|
+
}
|
|
2730
|
+
function findMatchingBrace(tex, openIndex) {
|
|
2731
|
+
let depth = 0;
|
|
2732
|
+
for (let index = openIndex; index < tex.length; index += 1) {
|
|
2733
|
+
const char = tex[index];
|
|
2734
|
+
if (char === "\\") {
|
|
2735
|
+
index += 1;
|
|
2736
|
+
continue;
|
|
2737
|
+
}
|
|
2738
|
+
if (char === "{") {
|
|
2739
|
+
depth += 1;
|
|
2740
|
+
} else if (char === "}") {
|
|
2741
|
+
depth -= 1;
|
|
2742
|
+
if (depth === 0) {
|
|
2743
|
+
return index;
|
|
2744
|
+
}
|
|
2745
|
+
}
|
|
2746
|
+
}
|
|
2747
|
+
return -1;
|
|
2748
|
+
}
|
|
2749
|
+
function mirrorBuTeXOperatorsInTex(tex, options = {}) {
|
|
2750
|
+
const mirroredOperatorTex = options.target === "compile" ? COMPILE_MIRRORED_OPERATOR_TEX : MIRRORED_OPERATOR_TEX;
|
|
2751
|
+
let result = "";
|
|
2752
|
+
let index = 0;
|
|
2753
|
+
while (index < tex.length) {
|
|
2754
|
+
if (tex.startsWith("\\butexmirror{", index)) {
|
|
2755
|
+
const end = findMatchingBrace(tex, index + "\\butexmirror".length);
|
|
2756
|
+
if (end !== -1) {
|
|
2757
|
+
const bodyStart = index + "\\butexmirror{".length;
|
|
2758
|
+
const body = tex.slice(bodyStart, end);
|
|
2759
|
+
if (options.target === "compile" && MIRRORED_OPERATOR_TEX.includes(body) && !mirroredOperatorTex.includes(body)) {
|
|
2760
|
+
result += body;
|
|
2761
|
+
} else {
|
|
2762
|
+
result += tex.slice(index, end + 1);
|
|
2763
|
+
}
|
|
2764
|
+
index = end + 1;
|
|
2765
|
+
continue;
|
|
2766
|
+
}
|
|
2767
|
+
}
|
|
2768
|
+
const operatorTex = matchingMirroredOperatorFrom(tex, index, mirroredOperatorTex);
|
|
2769
|
+
if (operatorTex) {
|
|
2770
|
+
result += `\\butexmirror{${operatorTex}}`;
|
|
2771
|
+
index += operatorTex.length;
|
|
2772
|
+
continue;
|
|
2773
|
+
}
|
|
2774
|
+
result += tex[index];
|
|
2775
|
+
index += 1;
|
|
2776
|
+
}
|
|
2777
|
+
return result;
|
|
2778
|
+
}
|
|
2666
2779
|
function atomicOperatorCommandSpec(id) {
|
|
2667
2780
|
return Object.prototype.hasOwnProperty.call(ATOMIC_OPERATOR_COMMANDS, id) ? ATOMIC_OPERATOR_COMMANDS[id] : null;
|
|
2668
2781
|
}
|
|
@@ -3145,6 +3258,28 @@ function renderArabicLatexFromSession(session) {
|
|
|
3145
3258
|
return renderChainArabic(session.arabicTree, { digitForm: session.currentDigitForm ?? "western" });
|
|
3146
3259
|
}
|
|
3147
3260
|
|
|
3261
|
+
// src/editor/state.ts
|
|
3262
|
+
function appendDebug(session, command, note) {
|
|
3263
|
+
const entry = {
|
|
3264
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3265
|
+
command,
|
|
3266
|
+
activeSide: session.activeSide,
|
|
3267
|
+
englishLatex: renderEnglishLatexFromSession(session),
|
|
3268
|
+
arabicLatex: renderArabicLatexFromSession(session),
|
|
3269
|
+
renderOk: true,
|
|
3270
|
+
renderError: null,
|
|
3271
|
+
note
|
|
3272
|
+
};
|
|
3273
|
+
const nextLog = session.debugLog.concat(entry);
|
|
3274
|
+
session.debugLog = nextLog.slice(-120);
|
|
3275
|
+
}
|
|
3276
|
+
function setCurrentDigitForm(session, digitForm) {
|
|
3277
|
+
const next = cloneEditorSession(session);
|
|
3278
|
+
next.currentDigitForm = digitForm;
|
|
3279
|
+
appendDebug(next, "setCurrentDigitForm", digitForm);
|
|
3280
|
+
return next;
|
|
3281
|
+
}
|
|
3282
|
+
|
|
3148
3283
|
// src/editor/display/delimiter.ts
|
|
3149
3284
|
var DELIMITER_CSS = `
|
|
3150
3285
|
.delim-pair {
|
|
@@ -4464,18 +4599,19 @@ function mathNodeFromSession(session, opening = "$", closing = "$") {
|
|
|
4464
4599
|
function mathNodeFromArabicSession(session, opening = "$", closing = "$") {
|
|
4465
4600
|
return mathNodeFromSession(session, opening, closing);
|
|
4466
4601
|
}
|
|
4467
|
-
function mathTokenSourceForSide(token, side) {
|
|
4602
|
+
function mathTokenSourceForSide(token, side, digitForm) {
|
|
4468
4603
|
if (!token.math || token.sourceOwner === "raw") {
|
|
4469
4604
|
return token.source;
|
|
4470
4605
|
}
|
|
4471
|
-
if (token.sourceSide === side) {
|
|
4606
|
+
if (token.sourceSide === side && digitForm === void 0) {
|
|
4472
4607
|
return token.source;
|
|
4473
4608
|
}
|
|
4474
4609
|
const result = mathTokenToEditorSession(token.math, side);
|
|
4475
4610
|
if (!result.editable) {
|
|
4476
4611
|
return token.source;
|
|
4477
4612
|
}
|
|
4478
|
-
|
|
4613
|
+
const session = digitForm === void 0 ? result.session : setCurrentDigitForm(result.session, digitForm);
|
|
4614
|
+
return mathSourceFromSession(session, side, token.opening, token.closing);
|
|
4479
4615
|
}
|
|
4480
4616
|
|
|
4481
4617
|
// src/document2/commands.ts
|
|
@@ -5275,6 +5411,19 @@ function document2KeyError(key, namespace = {}) {
|
|
|
5275
5411
|
}
|
|
5276
5412
|
|
|
5277
5413
|
// src/document2/arabicPreamble.ts
|
|
5414
|
+
function fontOptions(digitsMapping, includeScript = true) {
|
|
5415
|
+
const parts = [];
|
|
5416
|
+
if (includeScript) {
|
|
5417
|
+
parts.push("Script=Arabic");
|
|
5418
|
+
}
|
|
5419
|
+
if (digitsMapping !== "digits") {
|
|
5420
|
+
parts.push(`Mapping=${digitsMapping}`);
|
|
5421
|
+
}
|
|
5422
|
+
if (parts.length === 0) {
|
|
5423
|
+
return "";
|
|
5424
|
+
}
|
|
5425
|
+
return `[${parts.join(",")}]`;
|
|
5426
|
+
}
|
|
5278
5427
|
function arabicXeLatexPreamblePkg(twocolumn = false) {
|
|
5279
5428
|
const classOptions = twocolumn ? "12pt,a4paper,notitlepage,twocolumn" : "12pt,a4paper,notitlepage";
|
|
5280
5429
|
return `
|
|
@@ -5303,25 +5452,27 @@ function arabicXeLatexPreamblePkg(twocolumn = false) {
|
|
|
5303
5452
|
% save back tick for use - copy paste -> ` + "`";
|
|
5304
5453
|
}
|
|
5305
5454
|
function arabicXeLatexPreambleFont(digitsMapping = "arabicdigits") {
|
|
5306
|
-
const customFonts = NON_DEFAULT_CHARACTER_FONT_SPECS.filter((font) => font.latexFontCommand && font.latexFontFamily).map((font) => `\\newfontfamily${font.latexFontCommand}
|
|
5455
|
+
const customFonts = NON_DEFAULT_CHARACTER_FONT_SPECS.filter((font) => font.latexFontCommand && font.latexFontFamily).map((font) => `\\newfontfamily${font.latexFontCommand}${fontOptions(digitsMapping)}{${font.latexFontFamily}}`).join("\n");
|
|
5456
|
+
const mathFontOptions = fontOptions(digitsMapping, false);
|
|
5307
5457
|
return `
|
|
5308
5458
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
5309
5459
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
5310
|
-
%
|
|
5460
|
+
% Persian digits: Mapping=farsidigits
|
|
5461
|
+
% Arabic-Indic digits: Mapping=arabicdigits
|
|
5462
|
+
% Western digits: omit Mapping entirely
|
|
5311
5463
|
\\setdefaultlanguage[calendar=gregorian]{arabic} % from polyglossia
|
|
5312
|
-
\\setmainfont
|
|
5464
|
+
\\setmainfont${fontOptions(digitsMapping)}{Amiri}
|
|
5313
5465
|
${customFonts}
|
|
5314
|
-
\\newfontfamily\\boldarabic
|
|
5315
|
-
\\newfontfamily\\italicarabic
|
|
5466
|
+
\\newfontfamily\\boldarabic${fontOptions(digitsMapping)}{Amiri Bold}
|
|
5467
|
+
\\newfontfamily\\italicarabic${fontOptions(digitsMapping)}{Amiri Italic}
|
|
5316
5468
|
|
|
5317
5469
|
% for polyglossia url I dont know, sugggested by cursor
|
|
5318
|
-
\\newfontfamily\\arabicfonttt
|
|
5319
|
-
\\newfontfamily\\arabicfontsf
|
|
5470
|
+
\\newfontfamily\\arabicfonttt${fontOptions(digitsMapping)}{Amiri}
|
|
5471
|
+
\\newfontfamily\\arabicfontsf${fontOptions(digitsMapping)}{Amiri}
|
|
5320
5472
|
|
|
5321
5473
|
|
|
5322
5474
|
% Explicitly set math font to XITS Math
|
|
5323
|
-
%
|
|
5324
|
-
\\setmathfont[Script=Arabic , Mapping=${digitsMapping}]{XITS Math} % Ensure XITS Math is correctly installed and available
|
|
5475
|
+
\\setmathfont${mathFontOptions}{XITS Math} % Ensure XITS Math is correctly installed and available
|
|
5325
5476
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
5326
5477
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
5327
5478
|
`;
|
|
@@ -5483,8 +5634,20 @@ function getArabicXeLatexPreamble(digitsMappingOrOptions = "arabicdigits") {
|
|
|
5483
5634
|
}
|
|
5484
5635
|
|
|
5485
5636
|
// src/document2/exportLatex.ts
|
|
5637
|
+
function digitsMappingFromDigitForm(digitForm) {
|
|
5638
|
+
if (digitForm === "western") {
|
|
5639
|
+
return "digits";
|
|
5640
|
+
}
|
|
5641
|
+
if (digitForm === "persianIndic") {
|
|
5642
|
+
return "farsidigits";
|
|
5643
|
+
}
|
|
5644
|
+
return "arabicdigits";
|
|
5645
|
+
}
|
|
5486
5646
|
function mathBodyLatex(token) {
|
|
5487
|
-
if (
|
|
5647
|
+
if (token.sourceOwner === "editor") {
|
|
5648
|
+
return stripDisplayMathDelimiters(mirrorBuTeXOperatorsInTex(token.source, { target: "compile" }));
|
|
5649
|
+
}
|
|
5650
|
+
if (!token.math || token.sourceOwner === "raw") {
|
|
5488
5651
|
return stripDisplayMathDelimiters(token.source);
|
|
5489
5652
|
}
|
|
5490
5653
|
const rendered = renderMathNodeLatex(token.math);
|
|
@@ -5520,7 +5683,10 @@ ${body}
|
|
|
5520
5683
|
\\label{${token.label.trim()}}
|
|
5521
5684
|
\\end{equation}`;
|
|
5522
5685
|
}
|
|
5523
|
-
if (
|
|
5686
|
+
if (token.sourceOwner === "editor") {
|
|
5687
|
+
return mirrorBuTeXOperatorsInTex(token.source, { target: "compile" });
|
|
5688
|
+
}
|
|
5689
|
+
if (!token.math || token.sourceOwner === "raw") {
|
|
5524
5690
|
return token.source;
|
|
5525
5691
|
}
|
|
5526
5692
|
return renderMathNodeLatex(token.math);
|
|
@@ -5638,7 +5804,7 @@ function articleMaketitlePreamble(meta, twocolumn = false) {
|
|
|
5638
5804
|
if (meta.authors.trim().length > 0) {
|
|
5639
5805
|
parts.push(`\\author{${authorLatex(meta.authors)}}`);
|
|
5640
5806
|
}
|
|
5641
|
-
parts.push(`\\date{${formatHijriDate(meta.date, { locale: "ar", digitForm: "
|
|
5807
|
+
parts.push(`\\date{${formatHijriDate(meta.date, { locale: "ar", digitForm: "western" })}}`);
|
|
5642
5808
|
return parts.join("\n");
|
|
5643
5809
|
}
|
|
5644
5810
|
function articleFrontMatterLatex(meta) {
|
|
@@ -5660,7 +5826,7 @@ function document2Latex(document2, options = {}) {
|
|
|
5660
5826
|
const twocolumn = options.twocolumn === true;
|
|
5661
5827
|
const front = articleFrontMatterLatex(meta);
|
|
5662
5828
|
const bodyBlocks = document2.blocks.map((block) => blockLatex(block, document2.references));
|
|
5663
|
-
const closing =
|
|
5829
|
+
const closing = butexMaghribiDisplayLatex(BUTEX_CLOSING_HAMDALA);
|
|
5664
5830
|
const body = [...front, ...bodyBlocks, closing].filter((part) => part.length > 0).join("\n\n");
|
|
5665
5831
|
const wrapDocument = options.wrapDocument !== false;
|
|
5666
5832
|
if (!wrapDocument) {
|
|
@@ -5670,7 +5836,7 @@ function document2Latex(document2, options = {}) {
|
|
|
5670
5836
|
${body}` : body;
|
|
5671
5837
|
}
|
|
5672
5838
|
const preamble = getArabicXeLatexPreamble({
|
|
5673
|
-
digitsMapping: options.digitsMapping ??
|
|
5839
|
+
digitsMapping: options.digitsMapping ?? digitsMappingFromDigitForm(options.digitForm),
|
|
5674
5840
|
twocolumn
|
|
5675
5841
|
}) + "\n" + articleMaketitlePreamble(meta, twocolumn);
|
|
5676
5842
|
return `${preamble}
|
|
@@ -5926,8 +6092,8 @@ function remapSelectionAfterRangeMove(selection, direction) {
|
|
|
5926
6092
|
}
|
|
5927
6093
|
|
|
5928
6094
|
// src/document2/previewModel.ts
|
|
5929
|
-
function mathTex(token, equationSide) {
|
|
5930
|
-
return mathTokenSourceForSide(token, equationSide);
|
|
6095
|
+
function mathTex(token, equationSide, digitForm) {
|
|
6096
|
+
return mathTokenSourceForSide(token, equationSide, digitForm);
|
|
5931
6097
|
}
|
|
5932
6098
|
function previewInlines(field, islands, output, equationSide, document2, previewOptions) {
|
|
5933
6099
|
return field.tokens.map((token) => {
|
|
@@ -5959,7 +6125,7 @@ function previewInlines(field, islands, output, equationSide, document2, preview
|
|
|
5959
6125
|
}
|
|
5960
6126
|
const island = {
|
|
5961
6127
|
id: token.id,
|
|
5962
|
-
tex: mathTex(token, equationSide),
|
|
6128
|
+
tex: mathTex(token, equationSide, previewOptions.digitForm),
|
|
5963
6129
|
display: token.display,
|
|
5964
6130
|
output,
|
|
5965
6131
|
editable: token.editable
|
|
@@ -6094,7 +6260,7 @@ function document2Preview(document2, output = "svg", equationSide = "arabic", pr
|
|
|
6094
6260
|
blocks: [
|
|
6095
6261
|
...articleChromePreview(document2, options.uiLocale ?? "ar", options),
|
|
6096
6262
|
...body,
|
|
6097
|
-
{ kind: "closing", id: "article-closing", text: BUTEX_CLOSING_HAMDALA, tex:
|
|
6263
|
+
{ kind: "closing", id: "article-closing", text: BUTEX_CLOSING_HAMDALA, tex: butexMaghribiDisplayTex(BUTEX_CLOSING_HAMDALA) }
|
|
6098
6264
|
],
|
|
6099
6265
|
mathIslands
|
|
6100
6266
|
};
|
|
@@ -6131,6 +6297,8 @@ function document2Preview(document2, output = "svg", equationSide = "arabic", pr
|
|
|
6131
6297
|
butexDiwaniDisplayLatex,
|
|
6132
6298
|
butexDiwaniDisplayTex,
|
|
6133
6299
|
butexInColumnMaketitleHook,
|
|
6300
|
+
butexMaghribiDisplayLatex,
|
|
6301
|
+
butexMaghribiDisplayTex,
|
|
6134
6302
|
citeTokenLatex,
|
|
6135
6303
|
cloneDocument2Meta,
|
|
6136
6304
|
cloneDocument2Node,
|