@drghaliasri/butex 5.2.0 → 5.3.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/dist/document2.d.mts +11 -2
- package/dist/document2.d.ts +11 -2
- package/dist/document2.js +59 -13
- package/dist/document2.js.map +1 -1
- package/dist/document2.mjs +54 -13
- package/dist/document2.mjs.map +1 -1
- package/dist/react-document2.js +54 -14
- package/dist/react-document2.js.map +1 -1
- package/dist/react-document2.mjs +54 -14
- package/dist/react-document2.mjs.map +1 -1
- package/package.json +1 -1
package/dist/document2.mjs
CHANGED
|
@@ -35,7 +35,10 @@ function formatDigits(value, digitForm = "western") {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
// src/document2/articleMeta.ts
|
|
38
|
-
var
|
|
38
|
+
var BUTEX_BASMALA_LINE1 = "\u0628\u0650\u0633\u0652\u0645\u0650 \u0627\u0644\u0644\u064E\u0651\u0647\u0650 \u0627\u0644\u0631\u064E\u0651\u062D\u0652\u0645\u064E\u0670\u0646\u0650 \u0627\u0644\u0631\u064E\u0651\u062D\u0650\u064A\u0645\u0650";
|
|
39
|
+
var BUTEX_BASMALA_SALAWAT = "\u0635\u064E\u0644\u064E\u0651\u0649 \u0627\u0644\u0644\u064E\u0651\u0647\u064F \u0639\u064E\u0644\u064E\u064A\u0652\u0647\u0650 \u0648\u064E\u0633\u064E\u0644\u064E\u0651\u0645\u064E";
|
|
40
|
+
var BUTEX_BASMALA = `${BUTEX_BASMALA_LINE1}
|
|
41
|
+
${BUTEX_BASMALA_SALAWAT}`;
|
|
39
42
|
var BUTEX_CLOSING_HAMDALA = "\u0627\u0644\u0652\u062D\u064E\u0645\u0652\u062F\u064F \u0644\u0650\u0644\u064E\u0651\u0647\u0650 \u0646\u064E\u0641\u064E\u0639\u064E\u0646\u064E\u0627 \u0628\u0650\u0639\u0650\u0644\u0652\u0645\u0650\u0647\u0650";
|
|
40
43
|
function escapeButexTextArg(text) {
|
|
41
44
|
return text.replace(/\\/g, "\\textbackslash{}").replace(/[{}]/g, "\\$&");
|
|
@@ -48,6 +51,27 @@ function butexDiwaniDisplayLatex(text) {
|
|
|
48
51
|
${butexDiwaniDisplayTex(text)}
|
|
49
52
|
\\]`;
|
|
50
53
|
}
|
|
54
|
+
function butexBasmalaDisplayTex() {
|
|
55
|
+
return `${butexDiwaniDisplayTex(BUTEX_BASMALA_LINE1)} \\\\ ${butexDiwaniDisplayTex(BUTEX_BASMALA_SALAWAT)}`;
|
|
56
|
+
}
|
|
57
|
+
function butexBasmalaDisplayLatex() {
|
|
58
|
+
return `\\[
|
|
59
|
+
${butexBasmalaDisplayTex()}
|
|
60
|
+
\\]`;
|
|
61
|
+
}
|
|
62
|
+
function butexBasmalaTitlingPreamble() {
|
|
63
|
+
return [
|
|
64
|
+
"\\usepackage{titling}",
|
|
65
|
+
"\\pretitle{%",
|
|
66
|
+
" \\begin{center}",
|
|
67
|
+
` ${butexDiwaniDisplayTex(BUTEX_BASMALA_LINE1)}\\\\`,
|
|
68
|
+
` ${butexDiwaniDisplayTex(BUTEX_BASMALA_SALAWAT)}`,
|
|
69
|
+
" \\par\\vspace{1.5em}",
|
|
70
|
+
" \\LARGE",
|
|
71
|
+
"}",
|
|
72
|
+
"\\posttitle{\\par\\end{center}}"
|
|
73
|
+
].join("\n");
|
|
74
|
+
}
|
|
51
75
|
var HIJRI_YEAR_MIN = 1400;
|
|
52
76
|
var HIJRI_YEAR_MAX = 1500;
|
|
53
77
|
var HIJRI_MONTH_IDS = [
|
|
@@ -4248,7 +4272,7 @@ function updateDocument2Meta(document2, patch) {
|
|
|
4248
4272
|
|
|
4249
4273
|
// src/document2/arabicPreamble.ts
|
|
4250
4274
|
function arabicXeLatexPreamblePkg(twocolumn = false) {
|
|
4251
|
-
const classOptions = twocolumn ? "12pt,a4paper,twocolumn" : "12pt,a4paper";
|
|
4275
|
+
const classOptions = twocolumn ? "12pt,a4paper,notitlepage,twocolumn" : "12pt,a4paper,notitlepage";
|
|
4252
4276
|
return `
|
|
4253
4277
|
\\documentclass[${classOptions}]{article}
|
|
4254
4278
|
` + String.raw`\usepackage{amsmath,amsfonts,amssymb,mathrsfs,tikz,fancyhdr, mathtools}
|
|
@@ -4570,17 +4594,26 @@ ${block.closing}`;
|
|
|
4570
4594
|
function authorLatex(authors) {
|
|
4571
4595
|
return authors.split(/\n+/).map((line) => line.trim()).filter((line) => line.length > 0).join(" \\\\ ");
|
|
4572
4596
|
}
|
|
4597
|
+
function articleMaketitlePreamble(meta) {
|
|
4598
|
+
if (!document2HasMaketitle(meta)) {
|
|
4599
|
+
return "";
|
|
4600
|
+
}
|
|
4601
|
+
const parts = [butexBasmalaTitlingPreamble()];
|
|
4602
|
+
if (meta.title.trim().length > 0) {
|
|
4603
|
+
parts.push(`\\title{${meta.title.trim()}}`);
|
|
4604
|
+
}
|
|
4605
|
+
if (meta.authors.trim().length > 0) {
|
|
4606
|
+
parts.push(`\\author{${authorLatex(meta.authors)}}`);
|
|
4607
|
+
}
|
|
4608
|
+
parts.push(`\\date{${formatHijriDate(meta.date, { locale: "ar", digitForm: "arabicIndic" })}}`);
|
|
4609
|
+
return parts.join("\n");
|
|
4610
|
+
}
|
|
4573
4611
|
function articleFrontMatterLatex(meta) {
|
|
4574
|
-
const parts = [
|
|
4612
|
+
const parts = [];
|
|
4575
4613
|
if (document2HasMaketitle(meta)) {
|
|
4576
|
-
if (meta.title.trim().length > 0) {
|
|
4577
|
-
parts.push(`\\title{${meta.title.trim()}}`);
|
|
4578
|
-
}
|
|
4579
|
-
if (meta.authors.trim().length > 0) {
|
|
4580
|
-
parts.push(`\\author{${authorLatex(meta.authors)}}`);
|
|
4581
|
-
}
|
|
4582
|
-
parts.push(`\\date{${formatHijriDate(meta.date, { locale: "ar", digitForm: "arabicIndic" })}}`);
|
|
4583
4614
|
parts.push("\\maketitle");
|
|
4615
|
+
} else {
|
|
4616
|
+
parts.push(butexBasmalaDisplayLatex());
|
|
4584
4617
|
}
|
|
4585
4618
|
if (document2HasAbstract(meta)) {
|
|
4586
4619
|
parts.push(`\\begin{abstract}
|
|
@@ -4597,12 +4630,15 @@ function document2Latex(document2, options = {}) {
|
|
|
4597
4630
|
const body = [...front, ...bodyBlocks, closing].filter((part) => part.length > 0).join("\n\n");
|
|
4598
4631
|
const wrapDocument = options.wrapDocument !== false;
|
|
4599
4632
|
if (!wrapDocument) {
|
|
4600
|
-
|
|
4633
|
+
const metaPreamble = articleMaketitlePreamble(meta);
|
|
4634
|
+
return metaPreamble.length > 0 ? `${metaPreamble}
|
|
4635
|
+
|
|
4636
|
+
${body}` : body;
|
|
4601
4637
|
}
|
|
4602
4638
|
const preamble = getArabicXeLatexPreamble({
|
|
4603
4639
|
digitsMapping: options.digitsMapping ?? "arabicdigits",
|
|
4604
4640
|
twocolumn: options.twocolumn === true
|
|
4605
|
-
});
|
|
4641
|
+
}) + "\n" + articleMaketitlePreamble(meta);
|
|
4606
4642
|
return `${preamble}
|
|
4607
4643
|
\\begin{document}
|
|
4608
4644
|
|
|
@@ -4845,7 +4881,7 @@ function blockPreview(block, islands, output, equationSide, document2, previewOp
|
|
|
4845
4881
|
function articleChromePreview(document2, uiLocale, previewOptions) {
|
|
4846
4882
|
const meta = document2.meta ?? emptyDocument2Meta();
|
|
4847
4883
|
const blocks = [
|
|
4848
|
-
{ kind: "basmala", id: "article-basmala", text: BUTEX_BASMALA, tex:
|
|
4884
|
+
{ kind: "basmala", id: "article-basmala", text: BUTEX_BASMALA, tex: butexBasmalaDisplayTex() }
|
|
4849
4885
|
];
|
|
4850
4886
|
if (document2HasMaketitle(meta)) {
|
|
4851
4887
|
blocks.push({
|
|
@@ -4883,6 +4919,8 @@ function document2Preview(document2, output = "svg", equationSide = "arabic", pr
|
|
|
4883
4919
|
}
|
|
4884
4920
|
export {
|
|
4885
4921
|
BUTEX_BASMALA,
|
|
4922
|
+
BUTEX_BASMALA_LINE1,
|
|
4923
|
+
BUTEX_BASMALA_SALAWAT,
|
|
4886
4924
|
BUTEX_CLOSING_HAMDALA,
|
|
4887
4925
|
DEFAULT_DOCUMENT2_HISTORY_MAX_DEPTH,
|
|
4888
4926
|
DEFAULT_HIJRI_DATE,
|
|
@@ -4900,6 +4938,9 @@ export {
|
|
|
4900
4938
|
arabicXeLatexPreambleFont,
|
|
4901
4939
|
arabicXeLatexPreamblePkg,
|
|
4902
4940
|
bibliographyEntryLatex,
|
|
4941
|
+
butexBasmalaDisplayLatex,
|
|
4942
|
+
butexBasmalaDisplayTex,
|
|
4943
|
+
butexBasmalaTitlingPreamble,
|
|
4903
4944
|
butexDiwaniDisplayLatex,
|
|
4904
4945
|
butexDiwaniDisplayTex,
|
|
4905
4946
|
citeTokenLatex,
|