@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.
@@ -38,7 +38,10 @@ function formatDigits(value, digitForm = "western") {
38
38
  }
39
39
 
40
40
  // src/document2/articleMeta.ts
41
- 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";
41
+ 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";
42
+ 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";
43
+ var BUTEX_BASMALA = `${BUTEX_BASMALA_LINE1}
44
+ ${BUTEX_BASMALA_SALAWAT}`;
42
45
  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";
43
46
  function escapeButexTextArg(text) {
44
47
  return text.replace(/\\/g, "\\textbackslash{}").replace(/[{}]/g, "\\$&");
@@ -51,6 +54,27 @@ function butexDiwaniDisplayLatex(text) {
51
54
  ${butexDiwaniDisplayTex(text)}
52
55
  \\]`;
53
56
  }
57
+ function butexBasmalaDisplayTex() {
58
+ return `${butexDiwaniDisplayTex(BUTEX_BASMALA_LINE1)} \\\\ ${butexDiwaniDisplayTex(BUTEX_BASMALA_SALAWAT)}`;
59
+ }
60
+ function butexBasmalaDisplayLatex() {
61
+ return `\\[
62
+ ${butexBasmalaDisplayTex()}
63
+ \\]`;
64
+ }
65
+ function butexBasmalaTitlingPreamble() {
66
+ return [
67
+ "\\usepackage{titling}",
68
+ "\\pretitle{%",
69
+ " \\begin{center}",
70
+ ` ${butexDiwaniDisplayTex(BUTEX_BASMALA_LINE1)}\\\\`,
71
+ ` ${butexDiwaniDisplayTex(BUTEX_BASMALA_SALAWAT)}`,
72
+ " \\par\\vspace{1.5em}",
73
+ " \\LARGE",
74
+ "}",
75
+ "\\posttitle{\\par\\end{center}}"
76
+ ].join("\n");
77
+ }
54
78
  var HIJRI_YEAR_MIN = 1400;
55
79
  var HIJRI_YEAR_MAX = 1500;
56
80
  var HIJRI_MONTH_IDS = [
@@ -7493,7 +7517,7 @@ function updateDocument2Meta(document2, patch) {
7493
7517
 
7494
7518
  // src/document2/arabicPreamble.ts
7495
7519
  function arabicXeLatexPreamblePkg(twocolumn = false) {
7496
- const classOptions = twocolumn ? "12pt,a4paper,twocolumn" : "12pt,a4paper";
7520
+ const classOptions = twocolumn ? "12pt,a4paper,notitlepage,twocolumn" : "12pt,a4paper,notitlepage";
7497
7521
  return `
7498
7522
  \\documentclass[${classOptions}]{article}
7499
7523
  ` + String.raw`\usepackage{amsmath,amsfonts,amssymb,mathrsfs,tikz,fancyhdr, mathtools}
@@ -7815,17 +7839,26 @@ ${block.closing}`;
7815
7839
  function authorLatex(authors) {
7816
7840
  return authors.split(/\n+/).map((line) => line.trim()).filter((line) => line.length > 0).join(" \\\\ ");
7817
7841
  }
7842
+ function articleMaketitlePreamble(meta) {
7843
+ if (!document2HasMaketitle(meta)) {
7844
+ return "";
7845
+ }
7846
+ const parts = [butexBasmalaTitlingPreamble()];
7847
+ if (meta.title.trim().length > 0) {
7848
+ parts.push(`\\title{${meta.title.trim()}}`);
7849
+ }
7850
+ if (meta.authors.trim().length > 0) {
7851
+ parts.push(`\\author{${authorLatex(meta.authors)}}`);
7852
+ }
7853
+ parts.push(`\\date{${formatHijriDate(meta.date, { locale: "ar", digitForm: "arabicIndic" })}}`);
7854
+ return parts.join("\n");
7855
+ }
7818
7856
  function articleFrontMatterLatex(meta) {
7819
- const parts = [butexDiwaniDisplayLatex(BUTEX_BASMALA)];
7857
+ const parts = [];
7820
7858
  if (document2HasMaketitle(meta)) {
7821
- if (meta.title.trim().length > 0) {
7822
- parts.push(`\\title{${meta.title.trim()}}`);
7823
- }
7824
- if (meta.authors.trim().length > 0) {
7825
- parts.push(`\\author{${authorLatex(meta.authors)}}`);
7826
- }
7827
- parts.push(`\\date{${formatHijriDate(meta.date, { locale: "ar", digitForm: "arabicIndic" })}}`);
7828
7859
  parts.push("\\maketitle");
7860
+ } else {
7861
+ parts.push(butexBasmalaDisplayLatex());
7829
7862
  }
7830
7863
  if (document2HasAbstract(meta)) {
7831
7864
  parts.push(`\\begin{abstract}
@@ -7842,12 +7875,15 @@ function document2Latex(document2, options = {}) {
7842
7875
  const body = [...front, ...bodyBlocks, closing].filter((part) => part.length > 0).join("\n\n");
7843
7876
  const wrapDocument = options.wrapDocument !== false;
7844
7877
  if (!wrapDocument) {
7845
- return body;
7878
+ const metaPreamble = articleMaketitlePreamble(meta);
7879
+ return metaPreamble.length > 0 ? `${metaPreamble}
7880
+
7881
+ ${body}` : body;
7846
7882
  }
7847
7883
  const preamble = getArabicXeLatexPreamble({
7848
7884
  digitsMapping: options.digitsMapping ?? "arabicdigits",
7849
7885
  twocolumn: options.twocolumn === true
7850
- });
7886
+ }) + "\n" + articleMaketitlePreamble(meta);
7851
7887
  return `${preamble}
7852
7888
  \\begin{document}
7853
7889
 
@@ -8090,7 +8126,7 @@ function blockPreview(block, islands, output, equationSide, document2, previewOp
8090
8126
  function articleChromePreview(document2, uiLocale, previewOptions) {
8091
8127
  const meta = document2.meta ?? emptyDocument2Meta();
8092
8128
  const blocks = [
8093
- { kind: "basmala", id: "article-basmala", text: BUTEX_BASMALA, tex: butexDiwaniDisplayTex(BUTEX_BASMALA) }
8129
+ { kind: "basmala", id: "article-basmala", text: BUTEX_BASMALA, tex: butexBasmalaDisplayTex() }
8094
8130
  ];
8095
8131
  if (document2HasMaketitle(meta)) {
8096
8132
  blocks.push({
@@ -8489,7 +8525,11 @@ function ArticleMetaPanel({
8489
8525
  /* @__PURE__ */ jsx("strong", { children: messages.articleMetaTitle }),
8490
8526
  /* @__PURE__ */ jsx("span", { className: "butex-document2-widget__article-meta-badge", children: messages.articleMetaBadge })
8491
8527
  ] }),
8492
- /* @__PURE__ */ jsx("p", { className: "butex-document2-widget__article-meta-fixed", dir: "rtl", children: BUTEX_BASMALA }),
8528
+ /* @__PURE__ */ jsxs("p", { className: "butex-document2-widget__article-meta-fixed", dir: "rtl", children: [
8529
+ BUTEX_BASMALA_LINE1,
8530
+ /* @__PURE__ */ jsx("br", {}),
8531
+ BUTEX_BASMALA_SALAWAT
8532
+ ] }),
8493
8533
  /* @__PURE__ */ jsxs("div", { className: "butex-document2-widget__article-meta-grid", children: [
8494
8534
  /* @__PURE__ */ jsxs("label", { className: "butex-document2-widget__article-meta-field", children: [
8495
8535
  /* @__PURE__ */ jsx("span", { children: messages.articleTitle }),