@drghaliasri/butex 5.3.1 → 5.3.3
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/dist/document.js +25 -1
- package/dist/document.js.map +1 -1
- package/dist/document.mjs +25 -1
- package/dist/document.mjs.map +1 -1
- package/dist/document2.d.mts +96 -51
- package/dist/document2.d.ts +96 -51
- package/dist/document2.js +144 -11
- package/dist/document2.js.map +1 -1
- package/dist/document2.mjs +134 -11
- package/dist/document2.mjs.map +1 -1
- package/dist/index.d.mts +25 -1
- package/dist/index.d.ts +25 -1
- package/dist/index.global.js +61 -9
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +61 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +61 -9
- package/dist/index.mjs.map +1 -1
- package/dist/react-document.js +57 -3
- package/dist/react-document.js.map +1 -1
- package/dist/react-document.mjs +57 -3
- package/dist/react-document.mjs.map +1 -1
- package/dist/react-document2.d.mts +72 -52
- package/dist/react-document2.d.ts +72 -52
- package/dist/react-document2.js +866 -282
- package/dist/react-document2.js.map +1 -1
- package/dist/react-document2.mjs +821 -237
- package/dist/react-document2.mjs.map +1 -1
- package/dist/react.d.mts +25 -1
- package/dist/react.d.ts +25 -1
- package/dist/react.js +57 -3
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +57 -3
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/document2.js
CHANGED
|
@@ -27,9 +27,11 @@ __export(document2_exports, {
|
|
|
27
27
|
BUTEX_CLOSING_HAMDALA: () => BUTEX_CLOSING_HAMDALA,
|
|
28
28
|
DEFAULT_DOCUMENT2_HISTORY_MAX_DEPTH: () => DEFAULT_DOCUMENT2_HISTORY_MAX_DEPTH,
|
|
29
29
|
DEFAULT_HIJRI_DATE: () => DEFAULT_HIJRI_DATE,
|
|
30
|
+
DEFAULT_REFERENCE_FIELD_SEPARATOR: () => DEFAULT_REFERENCE_FIELD_SEPARATOR,
|
|
30
31
|
HIJRI_MONTH_IDS: () => HIJRI_MONTH_IDS,
|
|
31
32
|
HIJRI_YEAR_MAX: () => HIJRI_YEAR_MAX,
|
|
32
33
|
HIJRI_YEAR_MIN: () => HIJRI_YEAR_MIN,
|
|
34
|
+
absoluteHttpHref: () => absoluteHttpHref,
|
|
33
35
|
addDocument2ImageBlock: () => addDocument2ImageBlock,
|
|
34
36
|
addDocument2ListBlock: () => addDocument2ListBlock,
|
|
35
37
|
addDocument2ListItem: () => addDocument2ListItem,
|
|
@@ -40,6 +42,7 @@ __export(document2_exports, {
|
|
|
40
42
|
arabicXeLatexPreambleCmd: () => arabicXeLatexPreambleCmd,
|
|
41
43
|
arabicXeLatexPreambleFont: () => arabicXeLatexPreambleFont,
|
|
42
44
|
arabicXeLatexPreamblePkg: () => arabicXeLatexPreamblePkg,
|
|
45
|
+
bibliographyEntryBody: () => bibliographyEntryBody,
|
|
43
46
|
bibliographyEntryLatex: () => bibliographyEntryLatex,
|
|
44
47
|
butexBasmalaDisplayLatex: () => butexBasmalaDisplayLatex,
|
|
45
48
|
butexBasmalaDisplayTex: () => butexBasmalaDisplayTex,
|
|
@@ -65,6 +68,7 @@ __export(document2_exports, {
|
|
|
65
68
|
document2HasTitleStack: () => document2HasTitleStack,
|
|
66
69
|
document2HistoryCanRedo: () => document2HistoryCanRedo,
|
|
67
70
|
document2HistoryCanUndo: () => document2HistoryCanUndo,
|
|
71
|
+
document2KeyError: () => document2KeyError,
|
|
68
72
|
document2Latex: () => document2Latex,
|
|
69
73
|
document2Preview: () => document2Preview,
|
|
70
74
|
emptyBlockSelection: () => emptyBlockSelection,
|
|
@@ -75,6 +79,8 @@ __export(document2_exports, {
|
|
|
75
79
|
findFirstInlineField: () => findFirstInlineField,
|
|
76
80
|
formatBibliographyNumber: () => formatBibliographyNumber,
|
|
77
81
|
formatCiteLabel: () => formatCiteLabel,
|
|
82
|
+
formatFloatCaptionPreview: () => formatFloatCaptionPreview,
|
|
83
|
+
formatFloatCaptionTitle: () => formatFloatCaptionTitle,
|
|
78
84
|
formatHijriDate: () => formatHijriDate,
|
|
79
85
|
formatRefLabel: () => formatRefLabel,
|
|
80
86
|
fromDocumentJson2: () => fromDocumentJson2,
|
|
@@ -86,6 +92,8 @@ __export(document2_exports, {
|
|
|
86
92
|
insertMathToken: () => insertMathToken,
|
|
87
93
|
insertMathTokenAtCaret: () => insertMathTokenAtCaret,
|
|
88
94
|
insertRefTokenAtCaret: () => insertRefTokenAtCaret,
|
|
95
|
+
isDuplicateDocument2Key: () => isDuplicateDocument2Key,
|
|
96
|
+
isValidDocument2Key: () => isValidDocument2Key,
|
|
89
97
|
labelNumberMap: () => labelNumberMap,
|
|
90
98
|
mathNodeFromArabicSession: () => mathNodeFromArabicSession,
|
|
91
99
|
mathNodeFromSession: () => mathNodeFromSession,
|
|
@@ -100,7 +108,9 @@ __export(document2_exports, {
|
|
|
100
108
|
moveDocument2Reference: () => moveDocument2Reference,
|
|
101
109
|
normalizeBlockSelection: () => normalizeBlockSelection,
|
|
102
110
|
normalizeDocument2HijriDate: () => normalizeDocument2HijriDate,
|
|
111
|
+
normalizeDocument2Key: () => normalizeDocument2Key,
|
|
103
112
|
normalizeDocument2Meta: () => normalizeDocument2Meta,
|
|
113
|
+
normalizeReferenceFieldSeparator: () => normalizeReferenceFieldSeparator,
|
|
104
114
|
parseCiteKeys: () => parseCiteKeys,
|
|
105
115
|
parseFloatMetaFromJson: () => parseFloatMetaFromJson,
|
|
106
116
|
parseRefKeys: () => parseRefKeys,
|
|
@@ -406,6 +416,10 @@ function cloneDocument2Meta(meta) {
|
|
|
406
416
|
}
|
|
407
417
|
|
|
408
418
|
// src/document2/citations.ts
|
|
419
|
+
var DEFAULT_REFERENCE_FIELD_SEPARATOR = "\u060C";
|
|
420
|
+
function normalizeReferenceFieldSeparator(value) {
|
|
421
|
+
return value === "," ? "," : DEFAULT_REFERENCE_FIELD_SEPARATOR;
|
|
422
|
+
}
|
|
409
423
|
function referenceNumberMap(references) {
|
|
410
424
|
const map = /* @__PURE__ */ new Map();
|
|
411
425
|
references.forEach((reference, index) => {
|
|
@@ -451,7 +465,8 @@ function referenceFromJson(json) {
|
|
|
451
465
|
title: typeof json.title === "string" ? json.title : "",
|
|
452
466
|
year: typeof json.year === "string" ? json.year : "",
|
|
453
467
|
url: typeof json.url === "string" ? json.url : "",
|
|
454
|
-
venue: typeof json.venue === "string" ? json.venue : ""
|
|
468
|
+
venue: typeof json.venue === "string" ? json.venue : "",
|
|
469
|
+
fieldSeparator: normalizeReferenceFieldSeparator(json.field_separator)
|
|
455
470
|
};
|
|
456
471
|
}
|
|
457
472
|
function createEmptyReference2(partial = {}) {
|
|
@@ -461,15 +476,33 @@ function createEmptyReference2(partial = {}) {
|
|
|
461
476
|
title: partial.title,
|
|
462
477
|
year: partial.year,
|
|
463
478
|
url: partial.url,
|
|
464
|
-
venue: partial.venue
|
|
479
|
+
venue: partial.venue,
|
|
480
|
+
field_separator: partial.field_separator
|
|
465
481
|
});
|
|
466
482
|
}
|
|
483
|
+
function bibliographyEntryBody(reference, separator = reference.fieldSeparator, options = {}) {
|
|
484
|
+
const year = options.digitForm !== void 0 ? formatDigits(reference.year, options.digitForm) : reference.year;
|
|
485
|
+
const parts = [reference.authors, reference.title, reference.venue, year].filter((part) => part.trim().length > 0);
|
|
486
|
+
return parts.join(`${separator} `);
|
|
487
|
+
}
|
|
467
488
|
function bibliographyEntryLatex(reference) {
|
|
468
|
-
const
|
|
469
|
-
const body = parts.join(", ");
|
|
489
|
+
const body = bibliographyEntryBody(reference);
|
|
470
490
|
const url = reference.url.trim().length > 0 ? ` \\url{${reference.url}}` : "";
|
|
471
491
|
return `\\bibitem{${reference.key}} ${body}${url}`.trim();
|
|
472
492
|
}
|
|
493
|
+
function absoluteHttpHref(url) {
|
|
494
|
+
const trimmed = url.trim();
|
|
495
|
+
if (trimmed.length === 0) {
|
|
496
|
+
return "";
|
|
497
|
+
}
|
|
498
|
+
if (/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(trimmed)) {
|
|
499
|
+
return trimmed;
|
|
500
|
+
}
|
|
501
|
+
if (trimmed.startsWith("//")) {
|
|
502
|
+
return `https:${trimmed}`;
|
|
503
|
+
}
|
|
504
|
+
return `https://${trimmed}`;
|
|
505
|
+
}
|
|
473
506
|
|
|
474
507
|
// src/ast/commands/index.ts
|
|
475
508
|
function renderCommandCore(context) {
|
|
@@ -954,6 +987,23 @@ function labelNumberMap(document2) {
|
|
|
954
987
|
}
|
|
955
988
|
return map;
|
|
956
989
|
}
|
|
990
|
+
function formatFloatCaptionTitle(kind, number, options = {}) {
|
|
991
|
+
const locale = options.uiLocale ?? "ar";
|
|
992
|
+
const kindWord = kind === "fig" ? locale === "ar" ? "\u0627\u0644\u0634\u0643\u0644" : "Figure" : kind === "tab" ? locale === "ar" ? "\u0627\u0644\u062C\u062F\u0648\u0644" : "Table" : locale === "ar" ? "\u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629" : "Equation";
|
|
993
|
+
const digits = formatBibliographyNumber(number, {
|
|
994
|
+
documentDirection: options.documentDirection ?? (locale === "ar" ? "rtl" : "ltr"),
|
|
995
|
+
digitForm: options.digitForm ?? (locale === "ar" ? "arabicIndic" : "western")
|
|
996
|
+
});
|
|
997
|
+
return `${kindWord} ${digits}`;
|
|
998
|
+
}
|
|
999
|
+
function formatFloatCaptionPreview(title, caption, uiLocale = "ar") {
|
|
1000
|
+
const trimmed = caption?.trim() ?? "";
|
|
1001
|
+
if (trimmed.length === 0) {
|
|
1002
|
+
return title;
|
|
1003
|
+
}
|
|
1004
|
+
const separator = uiLocale === "ar" ? ": " : ". ";
|
|
1005
|
+
return `${title}${separator}${trimmed}`;
|
|
1006
|
+
}
|
|
957
1007
|
function formatRefLabel(keys, document2, refCommand, options = {}) {
|
|
958
1008
|
const documentDirection = options.documentDirection ?? "rtl";
|
|
959
1009
|
const digitForm = options.digitForm ?? (documentDirection === "rtl" ? "arabicIndic" : "western");
|
|
@@ -1224,7 +1274,8 @@ function parseReferences(json) {
|
|
|
1224
1274
|
title: typeof entry.title === "string" ? entry.title : void 0,
|
|
1225
1275
|
year: typeof entry.year === "string" ? entry.year : void 0,
|
|
1226
1276
|
url: typeof entry.url === "string" ? entry.url : void 0,
|
|
1227
|
-
venue: typeof entry.venue === "string" ? entry.venue : void 0
|
|
1277
|
+
venue: typeof entry.venue === "string" ? entry.venue : void 0,
|
|
1278
|
+
field_separator: entry.field_separator === "," || entry.field_separator === "\u060C" ? entry.field_separator : void 0
|
|
1228
1279
|
})
|
|
1229
1280
|
);
|
|
1230
1281
|
}
|
|
@@ -1864,7 +1915,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1864
1915
|
id: "neq",
|
|
1865
1916
|
category: "operators1",
|
|
1866
1917
|
Tex: "\\neq",
|
|
1867
|
-
mirror:
|
|
1918
|
+
mirror: true,
|
|
1868
1919
|
Label: "\u2260",
|
|
1869
1920
|
title: "\u0644\u0627 \u064A\u0633\u0627\u0648\u064A",
|
|
1870
1921
|
svg_path: null
|
|
@@ -1874,6 +1925,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1874
1925
|
category: "operators1",
|
|
1875
1926
|
Tex: "\\approx",
|
|
1876
1927
|
mirror: false,
|
|
1928
|
+
displayMirror: true,
|
|
1877
1929
|
Label: "\u2248",
|
|
1878
1930
|
title: "\u062A\u0642\u0631\u064A\u0628\u0627 \u064A\u0633\u0627\u0648\u064A",
|
|
1879
1931
|
svg_path: null
|
|
@@ -1883,6 +1935,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1883
1935
|
category: "operators1",
|
|
1884
1936
|
Tex: "\\sim",
|
|
1885
1937
|
mirror: false,
|
|
1938
|
+
displayMirror: true,
|
|
1886
1939
|
Label: "\u223C",
|
|
1887
1940
|
title: "\u0645\u0634\u0627\u0628\u0647",
|
|
1888
1941
|
svg_path: null
|
|
@@ -1901,6 +1954,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1901
1954
|
category: "operators1",
|
|
1902
1955
|
Tex: "\\leq",
|
|
1903
1956
|
mirror: true,
|
|
1957
|
+
displayMirror: false,
|
|
1904
1958
|
Label: "\u2264",
|
|
1905
1959
|
title: "\u0623\u0635\u063A\u0631 \u0645\u0646 \u0623\u0648 \u064A\u0633\u0627\u0648\u064A",
|
|
1906
1960
|
svg_path: null
|
|
@@ -1910,6 +1964,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1910
1964
|
category: "operators1",
|
|
1911
1965
|
Tex: "\\geq",
|
|
1912
1966
|
mirror: true,
|
|
1967
|
+
displayMirror: false,
|
|
1913
1968
|
Label: "\u2265",
|
|
1914
1969
|
title: "\u0623\u0643\u0628\u0631 \u0645\u0646 \u0623\u0648 \u064A\u0633\u0627\u0648\u064A",
|
|
1915
1970
|
svg_path: null
|
|
@@ -1919,6 +1974,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1919
1974
|
category: "operators1",
|
|
1920
1975
|
Tex: "\\coloneqq",
|
|
1921
1976
|
mirror: true,
|
|
1977
|
+
displayMirror: false,
|
|
1922
1978
|
Label: "\u2254",
|
|
1923
1979
|
title: "\u064A\u0639\u0631\u0641 \u0628\u0623\u0646\u0647 \u064A\u0633\u0627\u0648\u064A",
|
|
1924
1980
|
svg_path: null
|
|
@@ -1928,6 +1984,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1928
1984
|
category: "operators1",
|
|
1929
1985
|
Tex: "\\eqqcolon",
|
|
1930
1986
|
mirror: true,
|
|
1987
|
+
displayMirror: false,
|
|
1931
1988
|
Label: "\u2255",
|
|
1932
1989
|
title: "\u064A\u0633\u0627\u0648\u064A \u0628\u0627\u0644\u062A\u0639\u0631\u064A\u0641",
|
|
1933
1990
|
svg_path: null
|
|
@@ -1938,6 +1995,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1938
1995
|
category: "operators2",
|
|
1939
1996
|
Tex: "\\propto",
|
|
1940
1997
|
mirror: true,
|
|
1998
|
+
displayMirror: false,
|
|
1941
1999
|
Label: "\u221D",
|
|
1942
2000
|
title: "\u064A\u062A\u0646\u0627\u0633\u0628 \u0645\u0639",
|
|
1943
2001
|
svg_path: null
|
|
@@ -1947,6 +2005,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1947
2005
|
category: "operators2",
|
|
1948
2006
|
Tex: "\\in",
|
|
1949
2007
|
mirror: true,
|
|
2008
|
+
displayMirror: false,
|
|
1950
2009
|
Label: "\u2208",
|
|
1951
2010
|
title: "\u064A\u0646\u062A\u0645\u064A \u0625\u0644\u0649",
|
|
1952
2011
|
svg_path: null
|
|
@@ -1956,6 +2015,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1956
2015
|
category: "operators2",
|
|
1957
2016
|
Tex: "\\notin",
|
|
1958
2017
|
mirror: false,
|
|
2018
|
+
displayMirror: true,
|
|
1959
2019
|
Label: "\u2209",
|
|
1960
2020
|
title: "\u0644\u0627 \u064A\u0646\u062A\u0645\u064A \u0625\u0644\u0649",
|
|
1961
2021
|
svg_path: null
|
|
@@ -1965,6 +2025,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1965
2025
|
category: "operators2",
|
|
1966
2026
|
Tex: "\\subset",
|
|
1967
2027
|
mirror: true,
|
|
2028
|
+
displayMirror: false,
|
|
1968
2029
|
Label: "\u2282",
|
|
1969
2030
|
title: "\u0645\u062C\u0645\u0648\u0639\u0629 \u062C\u0632\u0626\u064A\u0629 \u0645\u0646",
|
|
1970
2031
|
svg_path: null
|
|
@@ -1974,6 +2035,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1974
2035
|
category: "operators2",
|
|
1975
2036
|
Tex: "\\supset",
|
|
1976
2037
|
mirror: true,
|
|
2038
|
+
displayMirror: false,
|
|
1977
2039
|
Label: "\u2283",
|
|
1978
2040
|
title: "\u0645\u062C\u0645\u0648\u0639\u0629 \u0634\u0627\u0645\u0644\u0629 \u0644\u0640",
|
|
1979
2041
|
svg_path: null
|
|
@@ -1983,6 +2045,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1983
2045
|
category: "operators2",
|
|
1984
2046
|
Tex: "\\subseteq",
|
|
1985
2047
|
mirror: true,
|
|
2048
|
+
displayMirror: false,
|
|
1986
2049
|
Label: "\u2286",
|
|
1987
2050
|
title: "\u0645\u062C\u0645\u0648\u0639\u0629 \u062C\u0632\u0626\u064A\u0629 \u0623\u0648 \u062A\u0633\u0627\u0648\u064A",
|
|
1988
2051
|
svg_path: null
|
|
@@ -1992,6 +2055,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1992
2055
|
category: "operators2",
|
|
1993
2056
|
Tex: "\\supseteq",
|
|
1994
2057
|
mirror: true,
|
|
2058
|
+
displayMirror: false,
|
|
1995
2059
|
Label: "\u2287",
|
|
1996
2060
|
title: "\u0645\u062C\u0645\u0648\u0639\u0629 \u0634\u0627\u0645\u0644\u0629 \u0623\u0648 \u062A\u0633\u0627\u0648\u064A",
|
|
1997
2061
|
svg_path: null
|
|
@@ -2001,6 +2065,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2001
2065
|
category: "operators2",
|
|
2002
2066
|
Tex: "\\cap",
|
|
2003
2067
|
mirror: false,
|
|
2068
|
+
displayMirror: true,
|
|
2004
2069
|
Label: "\u2229",
|
|
2005
2070
|
title: "\u062A\u0642\u0627\u0637\u0639",
|
|
2006
2071
|
svg_path: null
|
|
@@ -2010,6 +2075,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2010
2075
|
category: "operators2",
|
|
2011
2076
|
Tex: "\\cup",
|
|
2012
2077
|
mirror: false,
|
|
2078
|
+
displayMirror: true,
|
|
2013
2079
|
Label: "\u222A",
|
|
2014
2080
|
title: "\u0627\u062A\u062D\u0627\u062F",
|
|
2015
2081
|
svg_path: null
|
|
@@ -2019,6 +2085,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2019
2085
|
category: "operators2",
|
|
2020
2086
|
Tex: "\\emptyset",
|
|
2021
2087
|
mirror: false,
|
|
2088
|
+
displayMirror: true,
|
|
2022
2089
|
Label: "\u2205",
|
|
2023
2090
|
title: "\u0627\u0644\u0645\u062C\u0645\u0648\u0639\u0629 \u0627\u0644\u062E\u0627\u0644\u064A\u0629",
|
|
2024
2091
|
svg_path: null
|
|
@@ -2028,6 +2095,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2028
2095
|
category: "operators2",
|
|
2029
2096
|
Tex: "\\nsubseteq",
|
|
2030
2097
|
mirror: true,
|
|
2098
|
+
displayMirror: false,
|
|
2031
2099
|
Label: "\u2288",
|
|
2032
2100
|
title: "\u0644\u064A\u0633\u062A \u0645\u062C\u0645\u0648\u0639\u0629 \u062C\u0632\u0626\u064A\u0629 \u0623\u0648 \u062A\u0633\u0627\u0648\u064A",
|
|
2033
2101
|
svg_path: null
|
|
@@ -2037,6 +2105,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2037
2105
|
category: "operators2",
|
|
2038
2106
|
Tex: "\\nsupseteq",
|
|
2039
2107
|
mirror: true,
|
|
2108
|
+
displayMirror: false,
|
|
2040
2109
|
Label: "\u2289",
|
|
2041
2110
|
title: "\u0644\u064A\u0633\u062A \u0645\u062C\u0645\u0648\u0639\u0629 \u0634\u0627\u0645\u0644\u0629 \u0623\u0648 \u062A\u0633\u0627\u0648\u064A",
|
|
2042
2111
|
svg_path: null
|
|
@@ -2248,6 +2317,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2248
2317
|
category: "integrals",
|
|
2249
2318
|
Tex: "\\iint",
|
|
2250
2319
|
mirror: true,
|
|
2320
|
+
displayMirror: false,
|
|
2251
2321
|
Label: "\u222C",
|
|
2252
2322
|
title: "\u062A\u0643\u0627\u0645\u0644 \u0645\u0632\u062F\u0648\u062C",
|
|
2253
2323
|
svg_path: null
|
|
@@ -2257,6 +2327,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2257
2327
|
category: "integrals",
|
|
2258
2328
|
Tex: "\\iiint",
|
|
2259
2329
|
mirror: true,
|
|
2330
|
+
displayMirror: false,
|
|
2260
2331
|
Label: "\u222D",
|
|
2261
2332
|
title: "\u062A\u0643\u0627\u0645\u0644 \u062B\u0644\u0627\u062B\u064A",
|
|
2262
2333
|
svg_path: null
|
|
@@ -2266,6 +2337,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2266
2337
|
category: "integrals",
|
|
2267
2338
|
Tex: "\\iiiint",
|
|
2268
2339
|
mirror: true,
|
|
2340
|
+
displayMirror: false,
|
|
2269
2341
|
Label: "\u2A0C",
|
|
2270
2342
|
title: "\u062A\u0643\u0627\u0645\u0644 \u0631\u0628\u0627\u0639\u064A",
|
|
2271
2343
|
svg_path: null
|
|
@@ -2275,6 +2347,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2275
2347
|
category: "integrals",
|
|
2276
2348
|
Tex: "\\oint",
|
|
2277
2349
|
mirror: true,
|
|
2350
|
+
displayMirror: false,
|
|
2278
2351
|
Label: "\u222E",
|
|
2279
2352
|
title: "\u062A\u0643\u0627\u0645\u0644 \u0645\u063A\u0644\u0642",
|
|
2280
2353
|
svg_path: null
|
|
@@ -2284,6 +2357,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2284
2357
|
category: "integrals",
|
|
2285
2358
|
Tex: "\\oiint",
|
|
2286
2359
|
mirror: true,
|
|
2360
|
+
displayMirror: false,
|
|
2287
2361
|
Label: "\u222F",
|
|
2288
2362
|
title: "\u062A\u0643\u0627\u0645\u0644 \u0633\u0637\u062D\u064A \u0645\u063A\u0644\u0642",
|
|
2289
2363
|
svg_path: null
|
|
@@ -2293,6 +2367,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
2293
2367
|
category: "integrals",
|
|
2294
2368
|
Tex: "\\oiiint",
|
|
2295
2369
|
mirror: true,
|
|
2370
|
+
displayMirror: false,
|
|
2296
2371
|
Label: "\u2230",
|
|
2297
2372
|
title: "\u062A\u0643\u0627\u0645\u0644 \u062D\u062C\u0645\u064A \u0645\u063A\u0644\u0642",
|
|
2298
2373
|
svg_path: null
|
|
@@ -4406,6 +4481,9 @@ function updateDocument2Reference(document2, referenceId, patch) {
|
|
|
4406
4481
|
if (typeof patch.venue === "string") {
|
|
4407
4482
|
reference.venue = patch.venue;
|
|
4408
4483
|
}
|
|
4484
|
+
if (patch.field_separator === "," || patch.field_separator === "\u060C") {
|
|
4485
|
+
reference.fieldSeparator = patch.field_separator;
|
|
4486
|
+
}
|
|
4409
4487
|
return next;
|
|
4410
4488
|
}
|
|
4411
4489
|
function removeDocument2Reference(document2, referenceId) {
|
|
@@ -4444,6 +4522,52 @@ function updateDocument2Meta(document2, patch) {
|
|
|
4444
4522
|
return next;
|
|
4445
4523
|
}
|
|
4446
4524
|
|
|
4525
|
+
// src/document2/keys.ts
|
|
4526
|
+
var DOCUMENT2_KEY_PATTERN = /^[\p{L}\p{M}0-9:._-]+$/u;
|
|
4527
|
+
function normalizeDocument2Key(key) {
|
|
4528
|
+
return key.normalize("NFC").trim();
|
|
4529
|
+
}
|
|
4530
|
+
function isValidDocument2Key(key) {
|
|
4531
|
+
const normalized = normalizeDocument2Key(key);
|
|
4532
|
+
return normalized.length > 0 && DOCUMENT2_KEY_PATTERN.test(normalized);
|
|
4533
|
+
}
|
|
4534
|
+
function isDuplicateDocument2Key(key, namespace) {
|
|
4535
|
+
const normalized = normalizeDocument2Key(key);
|
|
4536
|
+
if (normalized.length === 0) {
|
|
4537
|
+
return false;
|
|
4538
|
+
}
|
|
4539
|
+
for (const reference of namespace.references ?? []) {
|
|
4540
|
+
if (namespace.excludeReferenceId && reference.id === namespace.excludeReferenceId) {
|
|
4541
|
+
continue;
|
|
4542
|
+
}
|
|
4543
|
+
if (normalizeDocument2Key(reference.key) === normalized) {
|
|
4544
|
+
return true;
|
|
4545
|
+
}
|
|
4546
|
+
}
|
|
4547
|
+
for (const label of namespace.labels ?? []) {
|
|
4548
|
+
if (namespace.excludeOwnerId && label.ownerId === namespace.excludeOwnerId) {
|
|
4549
|
+
continue;
|
|
4550
|
+
}
|
|
4551
|
+
if (normalizeDocument2Key(label.key) === normalized) {
|
|
4552
|
+
return true;
|
|
4553
|
+
}
|
|
4554
|
+
}
|
|
4555
|
+
return false;
|
|
4556
|
+
}
|
|
4557
|
+
function document2KeyError(key, namespace = {}) {
|
|
4558
|
+
const normalized = normalizeDocument2Key(key);
|
|
4559
|
+
if (normalized.length === 0) {
|
|
4560
|
+
return "empty";
|
|
4561
|
+
}
|
|
4562
|
+
if (!DOCUMENT2_KEY_PATTERN.test(normalized)) {
|
|
4563
|
+
return "invalid";
|
|
4564
|
+
}
|
|
4565
|
+
if (isDuplicateDocument2Key(normalized, namespace)) {
|
|
4566
|
+
return "duplicate";
|
|
4567
|
+
}
|
|
4568
|
+
return null;
|
|
4569
|
+
}
|
|
4570
|
+
|
|
4447
4571
|
// src/document2/arabicPreamble.ts
|
|
4448
4572
|
function arabicXeLatexPreamblePkg(twocolumn = false) {
|
|
4449
4573
|
const classOptions = twocolumn ? "12pt,a4paper,notitlepage,twocolumn" : "12pt,a4paper,notitlepage";
|
|
@@ -4994,13 +5118,11 @@ function floatNumberLabel(document2, key, previewOptions) {
|
|
|
4994
5118
|
if (!hit || hit.kind !== "fig" && hit.kind !== "tab") {
|
|
4995
5119
|
return void 0;
|
|
4996
5120
|
}
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
const digits = formatBibliographyNumber(hit.number, {
|
|
5121
|
+
return formatFloatCaptionTitle(hit.kind, hit.number, {
|
|
5122
|
+
uiLocale: previewOptions.uiLocale ?? "ar",
|
|
5000
5123
|
documentDirection: previewOptions.documentDirection,
|
|
5001
5124
|
digitForm: previewOptions.digitForm
|
|
5002
5125
|
});
|
|
5003
|
-
return `${kindWord} ${digits}`;
|
|
5004
5126
|
}
|
|
5005
5127
|
function blockPreview(block, islands, output, equationSide, document2, previewOptions) {
|
|
5006
5128
|
if (block.kind === "textBlock") {
|
|
@@ -5055,7 +5177,8 @@ function blockPreview(block, islands, output, equationSide, document2, previewOp
|
|
|
5055
5177
|
title: reference.title,
|
|
5056
5178
|
year: reference.year,
|
|
5057
5179
|
url: reference.url,
|
|
5058
|
-
venue: reference.venue
|
|
5180
|
+
venue: reference.venue,
|
|
5181
|
+
fieldSeparator: reference.fieldSeparator
|
|
5059
5182
|
}))
|
|
5060
5183
|
};
|
|
5061
5184
|
}
|
|
@@ -5109,9 +5232,11 @@ function document2Preview(document2, output = "svg", equationSide = "arabic", pr
|
|
|
5109
5232
|
BUTEX_CLOSING_HAMDALA,
|
|
5110
5233
|
DEFAULT_DOCUMENT2_HISTORY_MAX_DEPTH,
|
|
5111
5234
|
DEFAULT_HIJRI_DATE,
|
|
5235
|
+
DEFAULT_REFERENCE_FIELD_SEPARATOR,
|
|
5112
5236
|
HIJRI_MONTH_IDS,
|
|
5113
5237
|
HIJRI_YEAR_MAX,
|
|
5114
5238
|
HIJRI_YEAR_MIN,
|
|
5239
|
+
absoluteHttpHref,
|
|
5115
5240
|
addDocument2ImageBlock,
|
|
5116
5241
|
addDocument2ListBlock,
|
|
5117
5242
|
addDocument2ListItem,
|
|
@@ -5122,6 +5247,7 @@ function document2Preview(document2, output = "svg", equationSide = "arabic", pr
|
|
|
5122
5247
|
arabicXeLatexPreambleCmd,
|
|
5123
5248
|
arabicXeLatexPreambleFont,
|
|
5124
5249
|
arabicXeLatexPreamblePkg,
|
|
5250
|
+
bibliographyEntryBody,
|
|
5125
5251
|
bibliographyEntryLatex,
|
|
5126
5252
|
butexBasmalaDisplayLatex,
|
|
5127
5253
|
butexBasmalaDisplayTex,
|
|
@@ -5147,6 +5273,7 @@ function document2Preview(document2, output = "svg", equationSide = "arabic", pr
|
|
|
5147
5273
|
document2HasTitleStack,
|
|
5148
5274
|
document2HistoryCanRedo,
|
|
5149
5275
|
document2HistoryCanUndo,
|
|
5276
|
+
document2KeyError,
|
|
5150
5277
|
document2Latex,
|
|
5151
5278
|
document2Preview,
|
|
5152
5279
|
emptyBlockSelection,
|
|
@@ -5157,6 +5284,8 @@ function document2Preview(document2, output = "svg", equationSide = "arabic", pr
|
|
|
5157
5284
|
findFirstInlineField,
|
|
5158
5285
|
formatBibliographyNumber,
|
|
5159
5286
|
formatCiteLabel,
|
|
5287
|
+
formatFloatCaptionPreview,
|
|
5288
|
+
formatFloatCaptionTitle,
|
|
5160
5289
|
formatHijriDate,
|
|
5161
5290
|
formatRefLabel,
|
|
5162
5291
|
fromDocumentJson2,
|
|
@@ -5168,6 +5297,8 @@ function document2Preview(document2, output = "svg", equationSide = "arabic", pr
|
|
|
5168
5297
|
insertMathToken,
|
|
5169
5298
|
insertMathTokenAtCaret,
|
|
5170
5299
|
insertRefTokenAtCaret,
|
|
5300
|
+
isDuplicateDocument2Key,
|
|
5301
|
+
isValidDocument2Key,
|
|
5171
5302
|
labelNumberMap,
|
|
5172
5303
|
mathNodeFromArabicSession,
|
|
5173
5304
|
mathNodeFromSession,
|
|
@@ -5182,7 +5313,9 @@ function document2Preview(document2, output = "svg", equationSide = "arabic", pr
|
|
|
5182
5313
|
moveDocument2Reference,
|
|
5183
5314
|
normalizeBlockSelection,
|
|
5184
5315
|
normalizeDocument2HijriDate,
|
|
5316
|
+
normalizeDocument2Key,
|
|
5185
5317
|
normalizeDocument2Meta,
|
|
5318
|
+
normalizeReferenceFieldSeparator,
|
|
5186
5319
|
parseCiteKeys,
|
|
5187
5320
|
parseFloatMetaFromJson,
|
|
5188
5321
|
parseRefKeys,
|