@drghaliasri/butex 8.2.0 → 8.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/document-cli.js +2 -2
- 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 +28 -13
- package/dist/document.js.map +1 -1
- package/dist/document.mjs +28 -13
- package/dist/document.mjs.map +1 -1
- package/dist/react-book.js +38 -14
- package/dist/react-book.js.map +1 -1
- package/dist/react-book.mjs +38 -14
- package/dist/react-book.mjs.map +1 -1
- package/dist/react-document-preview.d.mts +1 -1
- package/dist/react-document-preview.d.ts +1 -1
- package/dist/react-document-preview.js +38 -14
- package/dist/react-document-preview.js.map +1 -1
- package/dist/react-document-preview.mjs +38 -14
- package/dist/react-document-preview.mjs.map +1 -1
- package/dist/react-document.d.mts +2 -1
- package/dist/react-document.d.ts +2 -1
- package/dist/react-document.js +38 -14
- package/dist/react-document.js.map +1 -1
- package/dist/react-document.mjs +38 -14
- package/dist/react-document.mjs.map +1 -1
- package/package.json +1 -1
package/dist/document.d.mts
CHANGED
package/dist/document.d.ts
CHANGED
package/dist/document.js
CHANGED
|
@@ -9160,17 +9160,31 @@ function previewInlines(field, islands, output, equationSide, document2, preview
|
|
|
9160
9160
|
return { kind: "math", ...island, ...numberLabel ? { numberLabel } : {} };
|
|
9161
9161
|
});
|
|
9162
9162
|
}
|
|
9163
|
-
function
|
|
9163
|
+
function nextHeadingNumber(block, counters, options) {
|
|
9164
|
+
const level = block.command === "\\section" ? 1 : block.command === "\\subsection" ? 2 : 3;
|
|
9165
|
+
counters[level - 1] += 1;
|
|
9166
|
+
for (let index = level; index < counters.length; index += 1) counters[index] = 0;
|
|
9167
|
+
const kind = block.command.slice(1);
|
|
9168
|
+
const projected = options.mode === "book-content" ? options.bookContext?.targets?.find((target) => target.unitId === options.bookContext?.unitId && target.ownerId === block.id && target.kind === kind) : void 0;
|
|
9169
|
+
if (projected?.ordinal) return projected.ordinal;
|
|
9170
|
+
return counters.slice(0, level).map((number) => formatBibliographyNumber(number, {
|
|
9171
|
+
documentDirection: options.documentDirection,
|
|
9172
|
+
digitForm: options.digitForm
|
|
9173
|
+
})).join(".");
|
|
9174
|
+
}
|
|
9175
|
+
function textBlockPreview(block, islands, output, equationSide, document2, previewOptions, headingCounters) {
|
|
9164
9176
|
const inlines = previewInlines(block.field, islands, output, equationSide, document2, previewOptions);
|
|
9165
9177
|
const metadata = block.metadata ? { metadata: { ...block.metadata } } : {};
|
|
9166
|
-
if (block.command === "\\section") {
|
|
9167
|
-
|
|
9168
|
-
|
|
9169
|
-
|
|
9170
|
-
|
|
9171
|
-
|
|
9172
|
-
|
|
9173
|
-
|
|
9178
|
+
if (block.command === "\\section" || block.command === "\\subsection" || block.command === "\\subsubsection") {
|
|
9179
|
+
const level = block.command === "\\section" ? 1 : block.command === "\\subsection" ? 2 : 3;
|
|
9180
|
+
return {
|
|
9181
|
+
kind: "heading",
|
|
9182
|
+
id: block.id,
|
|
9183
|
+
level,
|
|
9184
|
+
inlines,
|
|
9185
|
+
numberLabel: nextHeadingNumber(block, headingCounters, previewOptions),
|
|
9186
|
+
...metadata
|
|
9187
|
+
};
|
|
9174
9188
|
}
|
|
9175
9189
|
return {
|
|
9176
9190
|
kind: "paragraph",
|
|
@@ -9202,9 +9216,9 @@ function captionPreview(block, islands, output, equationSide, document2, preview
|
|
|
9202
9216
|
captionInlines: previewInlines(block.captionField, islands, output, equationSide, document2, previewOptions)
|
|
9203
9217
|
};
|
|
9204
9218
|
}
|
|
9205
|
-
function blockPreview(block, islands, output, equationSide, document2, previewOptions) {
|
|
9219
|
+
function blockPreview(block, islands, output, equationSide, document2, previewOptions, headingCounters) {
|
|
9206
9220
|
if (block.kind === "textBlock") {
|
|
9207
|
-
return textBlockPreview(block, islands, output, equationSide, document2, previewOptions);
|
|
9221
|
+
return textBlockPreview(block, islands, output, equationSide, document2, previewOptions, headingCounters);
|
|
9208
9222
|
}
|
|
9209
9223
|
if (block.kind === "list") {
|
|
9210
9224
|
return {
|
|
@@ -9214,7 +9228,7 @@ function blockPreview(block, islands, output, equationSide, document2, previewOp
|
|
|
9214
9228
|
items: block.items.map((item) => ({
|
|
9215
9229
|
id: item.id,
|
|
9216
9230
|
inlines: previewInlines(item.field, islands, output, equationSide, document2, previewOptions),
|
|
9217
|
-
blocks: item.blocks.map((child) => blockPreview(child, islands, output, equationSide, document2, previewOptions))
|
|
9231
|
+
blocks: item.blocks.map((child) => blockPreview(child, islands, output, equationSide, document2, previewOptions, headingCounters))
|
|
9218
9232
|
})),
|
|
9219
9233
|
...block.metadata ? { metadata: { ...block.metadata } } : {}
|
|
9220
9234
|
};
|
|
@@ -9300,7 +9314,8 @@ function documentPreview(document2, output = "svg", equationSide = "arabic", pre
|
|
|
9300
9314
|
mode: previewOptions.mode ?? "article",
|
|
9301
9315
|
bookContext: previewOptions.bookContext
|
|
9302
9316
|
};
|
|
9303
|
-
const
|
|
9317
|
+
const headingCounters = [0, 0, 0];
|
|
9318
|
+
const body = document2.blocks.filter((block) => options.mode !== "book-content" || block.kind !== "bibliography").map((block) => blockPreview(block, mathIslands, output, equationSide, document2, options, headingCounters));
|
|
9304
9319
|
return {
|
|
9305
9320
|
blocks: [
|
|
9306
9321
|
...options.mode === "book-content" ? [] : articleChromePreview(document2, options.uiLocale ?? "ar", options),
|