@drghaliasri/butex 8.1.3 → 8.1.5
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/book.d.mts +1 -0
- package/dist/book.d.ts +1 -0
- package/dist/book.js +17 -1
- package/dist/book.js.map +1 -1
- package/dist/book.mjs +17 -1
- package/dist/book.mjs.map +1 -1
- package/dist/document-cli.js +16 -1
- package/dist/document-cli.js.map +1 -1
- package/dist/document.d.mts +1 -0
- package/dist/document.d.ts +1 -0
- package/dist/document.js +10 -2
- package/dist/document.js.map +1 -1
- package/dist/document.mjs +10 -2
- package/dist/document.mjs.map +1 -1
- package/dist/react-book.d.mts +1 -0
- package/dist/react-book.d.ts +1 -0
- package/dist/react-book.js +10 -2
- package/dist/react-book.js.map +1 -1
- package/dist/react-book.mjs +10 -2
- package/dist/react-book.mjs.map +1 -1
- package/dist/react-document-preview.d.mts +1 -0
- package/dist/react-document-preview.d.ts +1 -0
- package/dist/react-document-preview.js +10 -2
- package/dist/react-document-preview.js.map +1 -1
- package/dist/react-document-preview.mjs +10 -2
- package/dist/react-document-preview.mjs.map +1 -1
- package/dist/react-document.d.mts +1 -0
- package/dist/react-document.d.ts +1 -0
- package/dist/react-document.js +10 -2
- package/dist/react-document.js.map +1 -1
- package/dist/react-document.mjs +10 -2
- package/dist/react-document.mjs.map +1 -1
- package/package.json +1 -1
package/dist/document-cli.js
CHANGED
|
@@ -8299,6 +8299,21 @@ function bookPreamble(snapshot) {
|
|
|
8299
8299
|
"\\renewcommand{\\contentsname}{\u0627\u0644\u0645\u062D\u062A\u0648\u064A\u0627\u062A}"
|
|
8300
8300
|
].join("\n");
|
|
8301
8301
|
}
|
|
8302
|
+
function normalizeBookEquationLabels(content, unitId, projection) {
|
|
8303
|
+
const aliases = /* @__PURE__ */ new Map();
|
|
8304
|
+
let latex = content;
|
|
8305
|
+
for (const target of projection.targets) {
|
|
8306
|
+
if (target.kind !== "eq" || !target.manualKey || target.manualKey === target.key) continue;
|
|
8307
|
+
aliases.set(target.manualKey, target.key);
|
|
8308
|
+
if (target.unitId === unitId) {
|
|
8309
|
+
const automatic = "\\label{" + target.key + "}";
|
|
8310
|
+
const manual = "\\label{" + target.manualKey + "}";
|
|
8311
|
+
latex = latex.replace(automatic + "\n" + manual, automatic);
|
|
8312
|
+
}
|
|
8313
|
+
}
|
|
8314
|
+
if (!aliases.size) return latex;
|
|
8315
|
+
return latex.replace(/\\(eqref|ref)\{([^}]*)\}/g, (_whole, command, keys) => "\\" + command + "{" + keys.split(",").map((key) => aliases.get(key.trim()) ?? key).join(",") + "}");
|
|
8316
|
+
}
|
|
8302
8317
|
function book2Latex(raw, _options = {}) {
|
|
8303
8318
|
const snapshot = normalizeBookSnapshot(raw);
|
|
8304
8319
|
const projection = resolveBookSnapshot(snapshot);
|
|
@@ -8366,7 +8381,7 @@ function book2Latex(raw, _options = {}) {
|
|
|
8366
8381
|
references: snapshot.references.references,
|
|
8367
8382
|
targets: projection.targets
|
|
8368
8383
|
};
|
|
8369
|
-
const content = documentContentLatex(fromDocumentJson(doc), context);
|
|
8384
|
+
const content = normalizeBookEquationLabels(documentContentLatex(fromDocumentJson(doc), context), entry.id, projection);
|
|
8370
8385
|
files[unitPath] = [unitBoundary(entry, projection, unnumbered), content, ""].join("\n\n");
|
|
8371
8386
|
main2.push("\\input{" + unitPath + "}");
|
|
8372
8387
|
if (!((entry.type === "chapter" || entry.type === "appendix") && entry.numbered)) {
|