@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.
@@ -73,7 +73,10 @@ function formatDigits(value, digitForm = "western") {
73
73
  }
74
74
 
75
75
  // src/document2/articleMeta.ts
76
- var BUTEX_BASMALA = "\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 \u0648\u064E\u0627\u0644\u0635\u064E\u0651\u0644\u064E\u0627\u0629\u064F \u0648\u064E\u0627\u0644\u0633\u064E\u0651\u0644\u064E\u0627\u0645\u064F \u0639\u064E\u0644\u064E\u0649\u0670 \u0631\u064E\u0633\u064F\u0648\u0644\u0650 \u0627\u0644\u0644\u064E\u0651\u0647\u0650 \uFDFA";
76
+ 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";
77
+ 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";
78
+ var BUTEX_BASMALA = `${BUTEX_BASMALA_LINE1}
79
+ ${BUTEX_BASMALA_SALAWAT}`;
77
80
  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";
78
81
  function escapeButexTextArg(text) {
79
82
  return text.replace(/\\/g, "\\textbackslash{}").replace(/[{}]/g, "\\$&");
@@ -86,6 +89,27 @@ function butexDiwaniDisplayLatex(text) {
86
89
  ${butexDiwaniDisplayTex(text)}
87
90
  \\]`;
88
91
  }
92
+ function butexBasmalaDisplayTex() {
93
+ return `${butexDiwaniDisplayTex(BUTEX_BASMALA_LINE1)} \\\\ ${butexDiwaniDisplayTex(BUTEX_BASMALA_SALAWAT)}`;
94
+ }
95
+ function butexBasmalaDisplayLatex() {
96
+ return `\\[
97
+ ${butexBasmalaDisplayTex()}
98
+ \\]`;
99
+ }
100
+ function butexBasmalaTitlingPreamble() {
101
+ return [
102
+ "\\usepackage{titling}",
103
+ "\\pretitle{%",
104
+ " \\begin{center}",
105
+ ` ${butexDiwaniDisplayTex(BUTEX_BASMALA_LINE1)}\\\\`,
106
+ ` ${butexDiwaniDisplayTex(BUTEX_BASMALA_SALAWAT)}`,
107
+ " \\par\\vspace{1.5em}",
108
+ " \\LARGE",
109
+ "}",
110
+ "\\posttitle{\\par\\end{center}}"
111
+ ].join("\n");
112
+ }
89
113
  var HIJRI_YEAR_MIN = 1400;
90
114
  var HIJRI_YEAR_MAX = 1500;
91
115
  var HIJRI_MONTH_IDS = [
@@ -7528,7 +7552,7 @@ function updateDocument2Meta(document2, patch) {
7528
7552
 
7529
7553
  // src/document2/arabicPreamble.ts
7530
7554
  function arabicXeLatexPreamblePkg(twocolumn = false) {
7531
- const classOptions = twocolumn ? "12pt,a4paper,twocolumn" : "12pt,a4paper";
7555
+ const classOptions = twocolumn ? "12pt,a4paper,notitlepage,twocolumn" : "12pt,a4paper,notitlepage";
7532
7556
  return `
7533
7557
  \\documentclass[${classOptions}]{article}
7534
7558
  ` + String.raw`\usepackage{amsmath,amsfonts,amssymb,mathrsfs,tikz,fancyhdr, mathtools}
@@ -7850,17 +7874,26 @@ ${block.closing}`;
7850
7874
  function authorLatex(authors) {
7851
7875
  return authors.split(/\n+/).map((line) => line.trim()).filter((line) => line.length > 0).join(" \\\\ ");
7852
7876
  }
7877
+ function articleMaketitlePreamble(meta) {
7878
+ if (!document2HasMaketitle(meta)) {
7879
+ return "";
7880
+ }
7881
+ const parts = [butexBasmalaTitlingPreamble()];
7882
+ if (meta.title.trim().length > 0) {
7883
+ parts.push(`\\title{${meta.title.trim()}}`);
7884
+ }
7885
+ if (meta.authors.trim().length > 0) {
7886
+ parts.push(`\\author{${authorLatex(meta.authors)}}`);
7887
+ }
7888
+ parts.push(`\\date{${formatHijriDate(meta.date, { locale: "ar", digitForm: "arabicIndic" })}}`);
7889
+ return parts.join("\n");
7890
+ }
7853
7891
  function articleFrontMatterLatex(meta) {
7854
- const parts = [butexDiwaniDisplayLatex(BUTEX_BASMALA)];
7892
+ const parts = [];
7855
7893
  if (document2HasMaketitle(meta)) {
7856
- if (meta.title.trim().length > 0) {
7857
- parts.push(`\\title{${meta.title.trim()}}`);
7858
- }
7859
- if (meta.authors.trim().length > 0) {
7860
- parts.push(`\\author{${authorLatex(meta.authors)}}`);
7861
- }
7862
- parts.push(`\\date{${formatHijriDate(meta.date, { locale: "ar", digitForm: "arabicIndic" })}}`);
7863
7894
  parts.push("\\maketitle");
7895
+ } else {
7896
+ parts.push(butexBasmalaDisplayLatex());
7864
7897
  }
7865
7898
  if (document2HasAbstract(meta)) {
7866
7899
  parts.push(`\\begin{abstract}
@@ -7877,12 +7910,15 @@ function document2Latex(document2, options = {}) {
7877
7910
  const body = [...front, ...bodyBlocks, closing].filter((part) => part.length > 0).join("\n\n");
7878
7911
  const wrapDocument = options.wrapDocument !== false;
7879
7912
  if (!wrapDocument) {
7880
- return body;
7913
+ const metaPreamble = articleMaketitlePreamble(meta);
7914
+ return metaPreamble.length > 0 ? `${metaPreamble}
7915
+
7916
+ ${body}` : body;
7881
7917
  }
7882
7918
  const preamble = getArabicXeLatexPreamble({
7883
7919
  digitsMapping: options.digitsMapping ?? "arabicdigits",
7884
7920
  twocolumn: options.twocolumn === true
7885
- });
7921
+ }) + "\n" + articleMaketitlePreamble(meta);
7886
7922
  return `${preamble}
7887
7923
  \\begin{document}
7888
7924
 
@@ -8125,7 +8161,7 @@ function blockPreview(block, islands, output, equationSide, document2, previewOp
8125
8161
  function articleChromePreview(document2, uiLocale, previewOptions) {
8126
8162
  const meta = document2.meta ?? emptyDocument2Meta();
8127
8163
  const blocks = [
8128
- { kind: "basmala", id: "article-basmala", text: BUTEX_BASMALA, tex: butexDiwaniDisplayTex(BUTEX_BASMALA) }
8164
+ { kind: "basmala", id: "article-basmala", text: BUTEX_BASMALA, tex: butexBasmalaDisplayTex() }
8129
8165
  ];
8130
8166
  if (document2HasMaketitle(meta)) {
8131
8167
  blocks.push({
@@ -8524,7 +8560,11 @@ function ArticleMetaPanel({
8524
8560
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: messages.articleMetaTitle }),
8525
8561
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "butex-document2-widget__article-meta-badge", children: messages.articleMetaBadge })
8526
8562
  ] }),
8527
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "butex-document2-widget__article-meta-fixed", dir: "rtl", children: BUTEX_BASMALA }),
8563
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "butex-document2-widget__article-meta-fixed", dir: "rtl", children: [
8564
+ BUTEX_BASMALA_LINE1,
8565
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {}),
8566
+ BUTEX_BASMALA_SALAWAT
8567
+ ] }),
8528
8568
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "butex-document2-widget__article-meta-grid", children: [
8529
8569
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "butex-document2-widget__article-meta-field", children: [
8530
8570
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: messages.articleTitle }),