ooxml-core 1.8.4 → 1.9.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/PptxHandler-AT7FVG5Q.mjs +2 -0
- package/dist/{PptxHandler-BL4B7CZO.mjs → PptxHandler-EX4WBIQQ.mjs} +2 -2
- package/dist/PptxHandler-VFSCECPL.cjs +11 -0
- package/dist/automation/index.cjs +6652 -4002
- package/dist/automation/index.mjs +6652 -4002
- package/dist/chunk-AT66SA5M.cjs +44423 -0
- package/dist/{chunk-TTPZITQN.mjs → chunk-FIELY5PI.mjs} +1 -1
- package/dist/{chunk-ZAP5WLEN.mjs → chunk-IGOA57LE.mjs} +1 -1
- package/dist/chunk-LCS3J3QI.mjs +87604 -0
- package/dist/{chunk-NIHPA63A.mjs → chunk-M76PHYRR.mjs} +54 -37
- package/dist/chunk-OB277ZGE.mjs +44107 -0
- package/dist/{chunk-GAGSCAR3.mjs → chunk-OXHMZS7B.mjs} +552 -178
- package/dist/chunk-SWF7KVL5.cjs +87610 -0
- package/dist/{chunk-Z7IQR4S4.mjs → chunk-WSO4T2LJ.mjs} +246 -21
- package/dist/docx/block-parser.d.ts.map +1 -1
- package/dist/docx/cell-blocks.d.ts +4 -0
- package/dist/docx/cell-blocks.d.ts.map +1 -0
- package/dist/docx/document-paragraphs.d.ts.map +1 -1
- package/dist/docx/document-parts.d.ts +2 -0
- package/dist/docx/document-parts.d.ts.map +1 -1
- package/dist/docx/embedded.cjs +189 -20
- package/dist/docx/embedded.mjs +189 -20
- package/dist/docx/index.cjs +219 -24
- package/dist/docx/index.mjs +219 -24
- package/dist/docx/layout/adapt-table.d.ts.map +1 -1
- package/dist/docx/layout/adapter.d.ts.map +1 -1
- package/dist/docx/layout/flow-paragraph.d.ts +5 -0
- package/dist/docx/layout/flow-paragraph.d.ts.map +1 -1
- package/dist/docx/layout/flow-table.d.ts +2 -1
- package/dist/docx/layout/flow-table.d.ts.map +1 -1
- package/dist/docx/layout/footnote-columns.d.ts +22 -0
- package/dist/docx/layout/footnote-columns.d.ts.map +1 -0
- package/dist/docx/layout/footnote-flow.d.ts +27 -0
- package/dist/docx/layout/footnote-flow.d.ts.map +1 -0
- package/dist/docx/layout/footnote-split.d.ts +7 -0
- package/dist/docx/layout/footnote-split.d.ts.map +1 -0
- package/dist/docx/layout/index.cjs +1099 -92
- package/dist/docx/layout/index.mjs +1099 -92
- package/dist/docx/layout/input.d.ts +17 -1
- package/dist/docx/layout/input.d.ts.map +1 -1
- package/dist/docx/layout/legacy-footnote-flow.d.ts +18 -0
- package/dist/docx/layout/legacy-footnote-flow.d.ts.map +1 -0
- package/dist/docx/layout/line-metrics.d.ts.map +1 -1
- package/dist/docx/layout/page-cursor.d.ts +13 -8
- package/dist/docx/layout/page-cursor.d.ts.map +1 -1
- package/dist/docx/layout/page-flow.d.ts.map +1 -1
- package/dist/docx/layout/paragraph-layout.d.ts.map +1 -1
- package/dist/docx/layout/paragraph-tokens.d.ts +2 -0
- package/dist/docx/layout/paragraph-tokens.d.ts.map +1 -1
- package/dist/docx/layout/reference-footnotes.d.ts +7 -0
- package/dist/docx/layout/reference-footnotes.d.ts.map +1 -0
- package/dist/docx/layout/result.d.ts +31 -0
- package/dist/docx/layout/result.d.ts.map +1 -1
- package/dist/docx/layout/section-flow.d.ts +2 -0
- package/dist/docx/layout/section-flow.d.ts.map +1 -1
- package/dist/docx/layout/table-cell-layout.d.ts +11 -0
- package/dist/docx/layout/table-cell-layout.d.ts.map +1 -0
- package/dist/docx/layout/table-footnotes.d.ts +27 -0
- package/dist/docx/layout/table-footnotes.d.ts.map +1 -0
- package/dist/docx/layout/table-layout.d.ts +10 -4
- package/dist/docx/layout/table-layout.d.ts.map +1 -1
- package/dist/docx/load/index.cjs +194 -25
- package/dist/docx/load/index.mjs +194 -25
- package/dist/docx/model-run.d.ts +2 -0
- package/dist/docx/model-run.d.ts.map +1 -1
- package/dist/docx/model.d.ts +7 -0
- package/dist/docx/model.d.ts.map +1 -1
- package/dist/docx/notes.d.ts +5 -0
- package/dist/docx/notes.d.ts.map +1 -1
- package/dist/docx/parse-table.d.ts.map +1 -1
- package/dist/docx/parse.d.ts.map +1 -1
- package/dist/docx/save.d.ts.map +1 -1
- package/dist/docx/section-model.d.ts +2 -0
- package/dist/docx/section-model.d.ts.map +1 -1
- package/dist/docx/sections.d.ts.map +1 -1
- package/dist/docx/settings.d.ts +2 -0
- package/dist/docx/settings.d.ts.map +1 -1
- package/dist/docx/table-model.d.ts +3 -1
- package/dist/docx/table-model.d.ts.map +1 -1
- package/dist/docx/ui/index.cjs +55 -0
- package/dist/docx/ui/index.d.ts +1 -0
- package/dist/docx/ui/index.d.ts.map +1 -1
- package/dist/docx/ui/index.mjs +55 -1
- package/dist/docx/ui/table-structure-guard.d.ts +4 -0
- package/dist/docx/ui/table-structure-guard.d.ts.map +1 -0
- package/dist/docx/write-footnote-columns.d.ts +3 -0
- package/dist/docx/write-footnote-columns.d.ts.map +1 -0
- package/dist/docx/write-notes.d.ts.map +1 -1
- package/dist/docx/write-run.d.ts.map +1 -1
- package/dist/docx/write-sections.d.ts.map +1 -1
- package/dist/index.cjs +8 -5
- package/dist/index.mjs +8 -5
- package/dist/opc/clone-part-graph.d.ts +4 -0
- package/dist/opc/clone-part-graph.d.ts.map +1 -1
- package/dist/opc/index.cjs +8 -5
- package/dist/opc/index.mjs +8 -5
- package/dist/pptx/automation/index.cjs +621 -207
- package/dist/pptx/automation/index.d.ts +3 -3
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{index-Cn-GzYGp.d.ts → index-B4cnSPNz.d.ts} +33 -4
- package/dist/pptx/chunks/index-B4cnSPNz.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-CKIUurnd.d.ts → index-BZh-IMkN.d.ts} +14 -9
- package/dist/pptx/chunks/{index-CKIUurnd.d.ts.map → index-BZh-IMkN.d.ts.map} +1 -1
- package/dist/pptx/chunks/{text-operations-BHfAm5K9.d.ts → text-operations-BLodkuXE.d.ts} +29 -12
- package/dist/pptx/chunks/text-operations-BLodkuXE.d.ts.map +1 -0
- package/dist/pptx/cli/index.cjs +622 -213
- package/dist/pptx/cli/index.d.ts +1 -1
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.cjs +53 -36
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/find-replace.cjs +416 -45
- package/dist/pptx/editor/render/find-replace.d.ts +35 -4
- package/dist/pptx/editor/render/find-replace.d.ts.map +1 -1
- package/dist/pptx/editor/render/find-replace.mjs +416 -46
- package/dist/pptx/editor/render/slide-operations.cjs +87 -0
- package/dist/pptx/editor/render/slide-operations.d.ts +17 -1
- package/dist/pptx/editor/render/slide-operations.d.ts.map +1 -1
- package/dist/pptx/editor/render/slide-operations.mjs +83 -1
- package/dist/pptx/editor/render/slide-search.cjs +6 -10
- package/dist/pptx/editor/render/slide-search.d.ts +1 -1
- package/dist/pptx/editor/render/slide-search.mjs +6 -10
- package/dist/pptx/editor/render/template-editing.d.ts +1 -1
- package/dist/pptx/editor/render/template-editing.d.ts.map +1 -1
- package/dist/pptx/index.cjs +889 -237
- package/dist/pptx/index.d.ts +4 -4
- package/dist/pptx/index.mjs +5 -5
- package/dist/teams/index.cjs +593 -34
- package/dist/teams/index.mjs +593 -34
- package/dist/visio/accessibility.d.ts +10 -0
- package/dist/visio/accessibility.d.ts.map +1 -0
- package/dist/visio/cell-formula.d.ts +2 -0
- package/dist/visio/cell-formula.d.ts.map +1 -1
- package/dist/visio/connector-curve-aligned.d.ts +5 -0
- package/dist/visio/connector-curve-aligned.d.ts.map +1 -0
- package/dist/visio/connector-curve-spans.d.ts +14 -0
- package/dist/visio/connector-curve-spans.d.ts.map +1 -0
- package/dist/visio/connector-jumps.d.ts +5 -0
- package/dist/visio/connector-jumps.d.ts.map +1 -0
- package/dist/visio/connector-route-walk.d.ts +2 -1
- package/dist/visio/connector-route-walk.d.ts.map +1 -1
- package/dist/visio/edit-alt-text-scope.d.ts +5 -0
- package/dist/visio/edit-alt-text-scope.d.ts.map +1 -0
- package/dist/visio/edit-alt-text.d.ts +3 -0
- package/dist/visio/edit-alt-text.d.ts.map +1 -0
- package/dist/visio/edit-commands.d.ts +7 -2
- package/dist/visio/edit-commands.d.ts.map +1 -1
- package/dist/visio/edit-formatting-commands.d.ts +5 -0
- package/dist/visio/edit-formatting-commands.d.ts.map +1 -1
- package/dist/visio/edit-formatting-paint.d.ts.map +1 -1
- package/dist/visio/edit-formatting-scope.d.ts.map +1 -1
- package/dist/visio/edit-line-jump-cache.d.ts +4 -0
- package/dist/visio/edit-line-jump-cache.d.ts.map +1 -0
- package/dist/visio/edit-master-index.d.ts.map +1 -1
- package/dist/visio/edit-metadata-commands.d.ts +10 -2
- package/dist/visio/edit-metadata-commands.d.ts.map +1 -1
- package/dist/visio/edit-metadata.d.ts +3 -1
- package/dist/visio/edit-metadata.d.ts.map +1 -1
- package/dist/visio/edit-page-alt-text.d.ts +4 -0
- package/dist/visio/edit-page-alt-text.d.ts.map +1 -0
- package/dist/visio/edit-page-layout.d.ts.map +1 -1
- package/dist/visio/edit-page-rename.d.ts.map +1 -1
- package/dist/visio/edit-page-setup-commands.d.ts +7 -1
- package/dist/visio/edit-page-setup-commands.d.ts.map +1 -1
- package/dist/visio/edit-page-size.d.ts.map +1 -1
- package/dist/visio/edit-pages.d.ts.map +1 -1
- package/dist/visio/edit-recalculate-index.d.ts.map +1 -1
- package/dist/visio/edit-scope.d.ts.map +1 -1
- package/dist/visio/edit-shape-create.d.ts.map +1 -1
- package/dist/visio/edit-stencil-connector-write.d.ts.map +1 -1
- package/dist/visio/edit-style-admission.d.ts.map +1 -1
- package/dist/visio/edit-text.d.ts.map +1 -1
- package/dist/visio/edit.d.ts +1 -1
- package/dist/visio/edit.d.ts.map +1 -1
- package/dist/visio/index.cjs +1091 -233
- package/dist/visio/index.d.ts +2 -1
- package/dist/visio/index.d.ts.map +1 -1
- package/dist/visio/index.mjs +1091 -234
- package/dist/visio/line-jumps.d.ts +1 -5
- package/dist/visio/line-jumps.d.ts.map +1 -1
- package/dist/visio/model.d.ts +13 -0
- package/dist/visio/model.d.ts.map +1 -1
- package/dist/visio/page-layout.d.ts +11 -2
- package/dist/visio/page-layout.d.ts.map +1 -1
- package/dist/visio/parser.d.ts.map +1 -1
- package/dist/visio/shape-metadata.d.ts +6 -0
- package/dist/visio/shape-metadata.d.ts.map +1 -1
- package/dist/visio/shapes.d.ts.map +1 -1
- package/dist/visio/text-field-case.d.ts +2 -0
- package/dist/visio/text-field-case.d.ts.map +1 -0
- package/dist/visio/text-field-display.d.ts.map +1 -1
- package/dist/visio/text-field-numeric.d.ts +4 -0
- package/dist/visio/text-field-numeric.d.ts.map +1 -0
- package/dist/visio/ui/connector-preview.d.ts +1 -1
- package/dist/visio/ui/connector-preview.d.ts.map +1 -1
- package/dist/visio/ui/data-graphic-rules.d.ts +2 -0
- package/dist/visio/ui/data-graphic-rules.d.ts.map +1 -1
- package/dist/visio/ui/data-graphics.d.ts +3 -2
- package/dist/visio/ui/data-graphics.d.ts.map +1 -1
- package/dist/visio/ui/edit-commands.d.ts.map +1 -1
- package/dist/visio/ui/index.cjs +16898 -15855
- package/dist/visio/ui/index.mjs +16898 -15856
- package/dist/visio/ui/scene-details.d.ts.map +1 -1
- package/dist/visio/ui/scene-validation.d.ts.map +1 -1
- package/dist/visio/ui/snapshot-scene.d.ts +2 -1
- package/dist/visio/ui/snapshot-scene.d.ts.map +1 -1
- package/dist/visio/xml-attribute-whitespace.d.ts +5 -0
- package/dist/visio/xml-attribute-whitespace.d.ts.map +1 -0
- package/dist/xlsx/edit/index.d.ts +1 -0
- package/dist/xlsx/edit/index.d.ts.map +1 -1
- package/dist/xlsx/edit/insert-guard.d.ts.map +1 -1
- package/dist/xlsx/edit/merge.d.ts.map +1 -1
- package/dist/xlsx/edit/page-breaks.d.ts +5 -0
- package/dist/xlsx/edit/page-breaks.d.ts.map +1 -0
- package/dist/xlsx/edit/pivots.d.ts +8 -0
- package/dist/xlsx/edit/pivots.d.ts.map +1 -0
- package/dist/xlsx/edit/print-titles.d.ts +7 -0
- package/dist/xlsx/edit/print-titles.d.ts.map +1 -0
- package/dist/xlsx/edit/session.d.ts.map +1 -1
- package/dist/xlsx/edit/sheets.d.ts.map +1 -1
- package/dist/xlsx/edit/shift-formulas.d.ts.map +1 -1
- package/dist/xlsx/edit/shift-sheet.d.ts.map +1 -1
- package/dist/xlsx/edit/sparkline-ranges.d.ts +11 -0
- package/dist/xlsx/edit/sparkline-ranges.d.ts.map +1 -0
- package/dist/xlsx/edit/sparkline-xml.d.ts +13 -0
- package/dist/xlsx/edit/sparkline-xml.d.ts.map +1 -0
- package/dist/xlsx/edit/sparklines.d.ts +16 -0
- package/dist/xlsx/edit/sparklines.d.ts.map +1 -0
- package/dist/xlsx/edit/table-edits.d.ts.map +1 -1
- package/dist/xlsx/edit/tables.d.ts.map +1 -1
- package/dist/xlsx/edit/types.d.ts +22 -1
- package/dist/xlsx/edit/types.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/text-regex.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +3159 -1164
- package/dist/xlsx/index.d.ts +1 -0
- package/dist/xlsx/index.d.ts.map +1 -1
- package/dist/xlsx/index.mjs +3140 -1165
- package/dist/xlsx/layout/cell-view.d.ts +2 -0
- package/dist/xlsx/layout/cell-view.d.ts.map +1 -1
- package/dist/xlsx/layout/header-footer.d.ts +58 -0
- package/dist/xlsx/layout/header-footer.d.ts.map +1 -0
- package/dist/xlsx/layout/index.d.ts +5 -0
- package/dist/xlsx/layout/index.d.ts.map +1 -1
- package/dist/xlsx/layout/print-breaks.d.ts +11 -0
- package/dist/xlsx/layout/print-breaks.d.ts.map +1 -0
- package/dist/xlsx/layout/print-layout.d.ts +34 -0
- package/dist/xlsx/layout/print-layout.d.ts.map +1 -0
- package/dist/xlsx/layout/print-merges.d.ts +18 -0
- package/dist/xlsx/layout/print-merges.d.ts.map +1 -0
- package/dist/xlsx/layout/print-repeat.d.ts +12 -0
- package/dist/xlsx/layout/print-repeat.d.ts.map +1 -0
- package/dist/xlsx/layout/print-titles.d.ts +20 -0
- package/dist/xlsx/layout/print-titles.d.ts.map +1 -0
- package/dist/xlsx/layout/sparkline-data.d.ts.map +1 -1
- package/dist/xlsx/layout/sparkline-view.d.ts.map +1 -1
- package/dist/xlsx/load/index.cjs +7784 -6976
- package/dist/xlsx/load/index.mjs +7784 -6976
- package/dist/xlsx/model-pivots.d.ts +46 -0
- package/dist/xlsx/model-pivots.d.ts.map +1 -0
- package/dist/xlsx/model.d.ts +5 -0
- package/dist/xlsx/model.d.ts.map +1 -1
- package/dist/xlsx/pivot/admission.d.ts +5 -0
- package/dist/xlsx/pivot/admission.d.ts.map +1 -0
- package/dist/xlsx/pivot/aggregate.d.ts +19 -0
- package/dist/xlsx/pivot/aggregate.d.ts.map +1 -0
- package/dist/xlsx/pivot/cache-xml.d.ts +9 -0
- package/dist/xlsx/pivot/cache-xml.d.ts.map +1 -0
- package/dist/xlsx/pivot/data.d.ts +12 -0
- package/dist/xlsx/pivot/data.d.ts.map +1 -0
- package/dist/xlsx/pivot/hierarchy.d.ts +7 -0
- package/dist/xlsx/pivot/hierarchy.d.ts.map +1 -0
- package/dist/xlsx/pivot/index.d.ts +3 -0
- package/dist/xlsx/pivot/index.d.ts.map +1 -0
- package/dist/xlsx/pivot/read.d.ts +5 -0
- package/dist/xlsx/pivot/read.d.ts.map +1 -0
- package/dist/xlsx/pivot/table-xml.d.ts +5 -0
- package/dist/xlsx/pivot/table-xml.d.ts.map +1 -0
- package/dist/xlsx/pivot/write.d.ts +11 -0
- package/dist/xlsx/pivot/write.d.ts.map +1 -0
- package/dist/xlsx/read/load.d.ts.map +1 -1
- package/dist/xlsx/read/sheet-props.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/index.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/navigation.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/pivots.d.ts +3 -0
- package/dist/xlsx/ui/commands/i18n/pivots.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/i18n/print-layout.d.ts +3 -0
- package/dist/xlsx/ui/commands/i18n/print-layout.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/i18n/sparklines.d.ts +3 -0
- package/dist/xlsx/ui/commands/i18n/sparklines.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/i18n/tools.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/page-breaks.d.ts +3 -0
- package/dist/xlsx/ui/commands/page-breaks.d.ts.map +1 -0
- package/dist/xlsx/ui/index.cjs +2001 -288
- package/dist/xlsx/ui/index.d.ts +1 -0
- package/dist/xlsx/ui/index.d.ts.map +1 -1
- package/dist/xlsx/ui/index.mjs +2001 -289
- package/dist/xlsx/write/page-setup.d.ts.map +1 -1
- package/dist/xlsx/write/save.d.ts.map +1 -1
- package/dist/xlsx/write/sheet-parts.d.ts +1 -0
- package/dist/xlsx/write/sheet-parts.d.ts.map +1 -1
- package/dist/xlsx/write/workbook-part.d.ts +1 -1
- package/dist/xlsx/write/workbook-part.d.ts.map +1 -1
- package/dist/xlsx/write/worksheet.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/pptx/chunks/index-Cn-GzYGp.d.ts.map +0 -1
- package/dist/pptx/chunks/text-operations-BHfAm5K9.d.ts.map +0 -1
package/dist/docx/load/index.cjs
CHANGED
|
@@ -3298,8 +3298,8 @@ function named(element, local, ns, lenient = true) {
|
|
|
3298
3298
|
}
|
|
3299
3299
|
var children = (parent, local, ns, lenient = true) => elements(parent).filter((element) => named(element, local, ns, lenient));
|
|
3300
3300
|
var first = (parent, local, ns, lenient = true) => parent ? children(parent, local, ns, lenient)[0] : void 0;
|
|
3301
|
-
function attr(element, local, ns,
|
|
3302
|
-
return element?.getAttributeNS(ns, local) ?? element?.getAttribute(`${
|
|
3301
|
+
function attr(element, local, ns, prefix2) {
|
|
3302
|
+
return element?.getAttributeNS(ns, local) ?? element?.getAttribute(`${prefix2}:${local}`) ?? void 0;
|
|
3303
3303
|
}
|
|
3304
3304
|
var relAttr = (element, local) => attr(element, local, NS.r, "r");
|
|
3305
3305
|
|
|
@@ -3497,7 +3497,7 @@ async function applyCoreProperties(zip, next, prior) {
|
|
|
3497
3497
|
const root = doc.documentElement;
|
|
3498
3498
|
for (const field of PROPERTY_FIELDS) {
|
|
3499
3499
|
if ((next?.[field] ?? "") === (prior?.[field] ?? "")) continue;
|
|
3500
|
-
const [
|
|
3500
|
+
const [prefix2, ns] = PREFIX[field];
|
|
3501
3501
|
let element = child2(root, field);
|
|
3502
3502
|
const value = next?.[field] ?? "";
|
|
3503
3503
|
if (!value) {
|
|
@@ -3505,7 +3505,7 @@ async function applyCoreProperties(zip, next, prior) {
|
|
|
3505
3505
|
continue;
|
|
3506
3506
|
}
|
|
3507
3507
|
if (!element) {
|
|
3508
|
-
element = doc.createElementNS(ns, `${
|
|
3508
|
+
element = doc.createElementNS(ns, `${prefix2}:${field}`);
|
|
3509
3509
|
root.appendChild(element);
|
|
3510
3510
|
}
|
|
3511
3511
|
element.textContent = value;
|
|
@@ -4530,6 +4530,36 @@ function writeTable(doc, table, node, base, writeParagraph, replaceSlots2) {
|
|
|
4530
4530
|
return node;
|
|
4531
4531
|
}
|
|
4532
4532
|
|
|
4533
|
+
// docx/write-footnote-columns.ts
|
|
4534
|
+
var W15 = "http://schemas.microsoft.com/office/word/2012/wordml";
|
|
4535
|
+
var XMLNS = "http://www.w3.org/2000/xmlns/";
|
|
4536
|
+
var MC = "http://schemas.openxmlformats.org/markup-compatibility/2006";
|
|
4537
|
+
function prefix(doc, preferred, namespace) {
|
|
4538
|
+
let name = preferred;
|
|
4539
|
+
for (let suffix = 1; doc.documentElement.lookupNamespaceURI(name) && doc.documentElement.lookupNamespaceURI(name) !== namespace; suffix++)
|
|
4540
|
+
name = preferred + suffix;
|
|
4541
|
+
doc.documentElement.setAttributeNS(XMLNS, "xmlns:" + name, namespace);
|
|
4542
|
+
return name;
|
|
4543
|
+
}
|
|
4544
|
+
function writeFootnoteColumns(doc, section, value) {
|
|
4545
|
+
if (value !== void 0 && (!Number.isInteger(value) || value < 0 || value > 2147483647))
|
|
4546
|
+
throw new Error("Footnote column count must be an integer from 0 to 2147483647.");
|
|
4547
|
+
const old = elements(section).filter(
|
|
4548
|
+
(element2) => element2.namespaceURI === W15 && element2.localName === "footnoteColumns"
|
|
4549
|
+
);
|
|
4550
|
+
for (const element2 of old) section.removeChild(element2);
|
|
4551
|
+
if (value === void 0) return;
|
|
4552
|
+
const w15 = prefix(doc, "w15", W15), mc = prefix(doc, "mc", MC);
|
|
4553
|
+
const ignored = new Set(
|
|
4554
|
+
(doc.documentElement.getAttributeNS(MC, "Ignorable") ?? "").split(/\s+/).filter(Boolean)
|
|
4555
|
+
);
|
|
4556
|
+
ignored.add(w15);
|
|
4557
|
+
doc.documentElement.setAttributeNS(MC, mc + ":Ignorable", [...ignored].join(" "));
|
|
4558
|
+
const element = doc.createElementNS(W15, w15 + ":footnoteColumns");
|
|
4559
|
+
element.setAttributeNS(WORD_NS, "w:val", String(value));
|
|
4560
|
+
section.appendChild(element);
|
|
4561
|
+
}
|
|
4562
|
+
|
|
4533
4563
|
// docx/parse-diagnostics.ts
|
|
4534
4564
|
var sink;
|
|
4535
4565
|
function withParseWarnings(warnings, fn) {
|
|
@@ -4848,6 +4878,7 @@ var WRITABLE = /* @__PURE__ */ new Set([
|
|
|
4848
4878
|
"footerDistanceTwips",
|
|
4849
4879
|
"gutterTwips",
|
|
4850
4880
|
"columns",
|
|
4881
|
+
"footnoteColumns",
|
|
4851
4882
|
"titlePage",
|
|
4852
4883
|
"verticalAlign",
|
|
4853
4884
|
"pageNumbering",
|
|
@@ -4911,6 +4942,8 @@ var AFTER_TITLEPG = [
|
|
|
4911
4942
|
var AFTER_PGBORDERS = ["lnNumType", ...AFTER_LNNUM];
|
|
4912
4943
|
var AFTER_TYPE = ["pgSz", ...AFTER_PGSZ];
|
|
4913
4944
|
function writeSectionProperties(doc, sectPr, section, base) {
|
|
4945
|
+
if (section.footnoteColumns !== base?.footnoteColumns)
|
|
4946
|
+
writeFootnoteColumns(doc, sectPr, section.footnoteColumns);
|
|
4914
4947
|
if (section.type === "nextPage")
|
|
4915
4948
|
for (const type of children2(sectPr, "type")) sectPr.removeChild(type);
|
|
4916
4949
|
else setW5(child3(doc, sectPr, "type", AFTER_TYPE), "val", section.type);
|
|
@@ -5516,8 +5549,8 @@ var LIGATURE_VALUES = [
|
|
|
5516
5549
|
];
|
|
5517
5550
|
var isLigatures = (value) => typeof value === "string" && LIGATURE_VALUES.includes(value);
|
|
5518
5551
|
var WORD_2010_NS = "http://schemas.microsoft.com/office/word/2010/wordml";
|
|
5519
|
-
var
|
|
5520
|
-
var
|
|
5552
|
+
var MC2 = "http://schemas.openxmlformats.org/markup-compatibility/2006";
|
|
5553
|
+
var XMLNS2 = "http://www.w3.org/2000/xmlns/";
|
|
5521
5554
|
var ligatureElements = (props) => elements(props).filter(
|
|
5522
5555
|
(element) => element.namespaceURI === WORD_2010_NS && element.localName === "ligatures"
|
|
5523
5556
|
);
|
|
@@ -5527,24 +5560,24 @@ var parseLigatures = (props) => {
|
|
|
5527
5560
|
};
|
|
5528
5561
|
function extensionPrefix(doc, ns, preferred) {
|
|
5529
5562
|
const root = doc.documentElement;
|
|
5530
|
-
let
|
|
5531
|
-
for (let index = 1; root.lookupNamespaceURI(
|
|
5532
|
-
|
|
5533
|
-
root.setAttributeNS(
|
|
5534
|
-
return
|
|
5563
|
+
let prefix2 = preferred;
|
|
5564
|
+
for (let index = 1; root.lookupNamespaceURI(prefix2) && root.lookupNamespaceURI(prefix2) !== ns; index++)
|
|
5565
|
+
prefix2 = `${preferred}${index}`;
|
|
5566
|
+
root.setAttributeNS(XMLNS2, `xmlns:${prefix2}`, ns);
|
|
5567
|
+
return prefix2;
|
|
5535
5568
|
}
|
|
5536
5569
|
function writeLigatures(doc, props, value) {
|
|
5537
5570
|
for (const element2 of ligatureElements(props)) props.removeChild(element2);
|
|
5538
5571
|
if (value === void 0) return;
|
|
5539
|
-
const
|
|
5540
|
-
const mc = extensionPrefix(doc,
|
|
5572
|
+
const prefix2 = extensionPrefix(doc, WORD_2010_NS, "w14");
|
|
5573
|
+
const mc = extensionPrefix(doc, MC2, "mc");
|
|
5541
5574
|
const ignored = new Set(
|
|
5542
|
-
(doc.documentElement.getAttributeNS(
|
|
5575
|
+
(doc.documentElement.getAttributeNS(MC2, "Ignorable") ?? "").split(/\s+/).filter(Boolean)
|
|
5543
5576
|
);
|
|
5544
|
-
ignored.add(
|
|
5545
|
-
doc.documentElement.setAttributeNS(
|
|
5546
|
-
const element = doc.createElementNS(WORD_2010_NS, `${
|
|
5547
|
-
element.setAttributeNS(WORD_2010_NS, `${
|
|
5577
|
+
ignored.add(prefix2);
|
|
5578
|
+
doc.documentElement.setAttributeNS(MC2, `${mc}:Ignorable`, [...ignored].join(" "));
|
|
5579
|
+
const element = doc.createElementNS(WORD_2010_NS, `${prefix2}:ligatures`);
|
|
5580
|
+
element.setAttributeNS(WORD_2010_NS, `${prefix2}:val`, value);
|
|
5548
5581
|
props.appendChild(element);
|
|
5549
5582
|
}
|
|
5550
5583
|
|
|
@@ -7237,7 +7270,7 @@ function readBuiltInChartStyle(root) {
|
|
|
7237
7270
|
for (const content of children(root, "AlternateContent", NS.mc)) {
|
|
7238
7271
|
for (const choice of children(content, "Choice", NS.mc)) {
|
|
7239
7272
|
const requires = choice.getAttribute("Requires")?.trim().split(/\s+/);
|
|
7240
|
-
if (!requires?.length || !requires.every((
|
|
7273
|
+
if (!requires?.length || !requires.every((prefix2) => choice.lookupNamespaceURI(prefix2) === C14))
|
|
7241
7274
|
continue;
|
|
7242
7275
|
const modern = first(choice, "style", C14)?.getAttribute("val");
|
|
7243
7276
|
if (modern && /^\d+$/.test(modern) && Number(modern) >= 101 && Number(modern) <= 148)
|
|
@@ -7399,12 +7432,12 @@ var CHART_ROOT_BINDINGS = /* @__PURE__ */ new Map([
|
|
|
7399
7432
|
var DECLARATION = / xmlns:([A-Za-z_][\w.-]*)="([^"]*)"/g;
|
|
7400
7433
|
function stripDeclarations(xml, bindings) {
|
|
7401
7434
|
const conflicting = /* @__PURE__ */ new Set();
|
|
7402
|
-
for (const [,
|
|
7403
|
-
if (
|
|
7404
|
-
conflicting.add(
|
|
7435
|
+
for (const [, prefix2, uri] of xml.matchAll(DECLARATION))
|
|
7436
|
+
if (prefix2 !== void 0 && bindings.has(prefix2) && bindings.get(prefix2) !== uri)
|
|
7437
|
+
conflicting.add(prefix2);
|
|
7405
7438
|
return xml.replace(
|
|
7406
7439
|
DECLARATION,
|
|
7407
|
-
(match,
|
|
7440
|
+
(match, prefix2, uri) => bindings.get(prefix2) === uri && !conflicting.has(prefix2) ? "" : match
|
|
7408
7441
|
);
|
|
7409
7442
|
}
|
|
7410
7443
|
var innerXml = (element) => stripDeclarations(elements(element).map(buildXml).join(""), CHART_ROOT_BINDINGS);
|
|
@@ -9044,6 +9077,10 @@ function createRun(doc, run, base, old, allocator) {
|
|
|
9044
9077
|
node.appendChild(code);
|
|
9045
9078
|
return node;
|
|
9046
9079
|
}
|
|
9080
|
+
if (run.noteSeparator) {
|
|
9081
|
+
node.appendChild(makeW(doc, run.noteSeparator));
|
|
9082
|
+
return node;
|
|
9083
|
+
}
|
|
9047
9084
|
if (run.noteMark) {
|
|
9048
9085
|
node.appendChild(makeW(doc, run.noteMark === "footnote" ? "footnoteRef" : "endnoteRef"));
|
|
9049
9086
|
return node;
|
|
@@ -11055,7 +11092,12 @@ async function applyNoteEdits(zip, model, base, pendingMedia, docPrIds) {
|
|
|
11055
11092
|
const original = baseNotes.get(note.id);
|
|
11056
11093
|
return !original || JSON.stringify(original.blocks) !== JSON.stringify(note.blocks);
|
|
11057
11094
|
});
|
|
11058
|
-
|
|
11095
|
+
const separators = kind === "footnote" ? model.footnoteSeparators : void 0;
|
|
11096
|
+
const baseSeparators = kind === "footnote" ? base.footnoteSeparators : void 0;
|
|
11097
|
+
const editedSeparators = ["separator", "continuationSeparator"].filter(
|
|
11098
|
+
(type) => separators?.[type] && JSON.stringify(separators[type].blocks) !== JSON.stringify(baseSeparators?.[type]?.blocks)
|
|
11099
|
+
);
|
|
11100
|
+
if (!edited.length && !removed.length && !editedSeparators.length) continue;
|
|
11059
11101
|
const file = zip.file(part);
|
|
11060
11102
|
const doc = parseXml2(file ? await file.async("string") : await createNotesPart(zip, kind));
|
|
11061
11103
|
const elements2 = new Map(
|
|
@@ -11067,6 +11109,24 @@ async function applyNoteEdits(zip, model, base, pendingMedia, docPrIds) {
|
|
|
11067
11109
|
doc.documentElement.removeChild(element);
|
|
11068
11110
|
}
|
|
11069
11111
|
const allocator = await allocatorForPart(zip, part, doc, docPrIds);
|
|
11112
|
+
for (const type of editedSeparators) {
|
|
11113
|
+
const separator = separators[type];
|
|
11114
|
+
let element = children2(doc.documentElement, kind).find((node) => getW(node, "type") === type);
|
|
11115
|
+
if (!element) {
|
|
11116
|
+
element = doc.createElementNS(WORD_NS3, `w:${kind}`);
|
|
11117
|
+
element.setAttributeNS(WORD_NS3, "w:id", separator.id);
|
|
11118
|
+
element.setAttributeNS(WORD_NS3, "w:type", type);
|
|
11119
|
+
doc.documentElement.appendChild(element);
|
|
11120
|
+
}
|
|
11121
|
+
applyBlocks(
|
|
11122
|
+
doc,
|
|
11123
|
+
element,
|
|
11124
|
+
separator.blocks,
|
|
11125
|
+
baseSeparators?.[type]?.blocks ?? [],
|
|
11126
|
+
allocator,
|
|
11127
|
+
contentWidthTwips
|
|
11128
|
+
);
|
|
11129
|
+
}
|
|
11070
11130
|
for (const note of edited) {
|
|
11071
11131
|
let element = elements2.get(note.id);
|
|
11072
11132
|
const original = baseNotes.get(note.id);
|
|
@@ -11234,6 +11294,43 @@ async function applyTrackChangesSetting(zip, enabled2) {
|
|
|
11234
11294
|
}
|
|
11235
11295
|
await applySettingsFlag(zip, "trackRevisions", enabled2);
|
|
11236
11296
|
}
|
|
11297
|
+
async function applyCompatibilityMode(zip, mode) {
|
|
11298
|
+
if (mode !== void 0 && (!Number.isInteger(mode) || mode <= 0 || mode > 2147483647))
|
|
11299
|
+
throw new RangeError("Compatibility mode must be a positive integer.");
|
|
11300
|
+
const file = zip.file(SETTINGS_PATH);
|
|
11301
|
+
if (!file && mode === void 0) return;
|
|
11302
|
+
const doc = parseXml2(
|
|
11303
|
+
await file?.async("string") ?? `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:settings xmlns:w="${WORD_NS}"/>`
|
|
11304
|
+
);
|
|
11305
|
+
const root = doc.documentElement;
|
|
11306
|
+
let compat = children2(root, "compat")[0];
|
|
11307
|
+
if (!compat && mode !== void 0) {
|
|
11308
|
+
compat = makeW(doc, "compat");
|
|
11309
|
+
const rank = SETTINGS_ORDER.indexOf("compat");
|
|
11310
|
+
const after = Array.from(root.childNodes).find(
|
|
11311
|
+
(node) => node.nodeType === 1 && SETTINGS_ORDER.indexOf(node.localName ?? "") > rank
|
|
11312
|
+
);
|
|
11313
|
+
root.insertBefore(compat, after ?? null);
|
|
11314
|
+
}
|
|
11315
|
+
const uri = "http://schemas.microsoft.com/office/word";
|
|
11316
|
+
if (compat) {
|
|
11317
|
+
for (const setting of children2(compat, "compatSetting"))
|
|
11318
|
+
if (setting.getAttributeNS(WORD_NS, "name") === "compatibilityMode" && setting.getAttributeNS(WORD_NS, "uri") === uri)
|
|
11319
|
+
compat.removeChild(setting);
|
|
11320
|
+
if (mode !== void 0) {
|
|
11321
|
+
const setting = makeW(doc, "compatSetting");
|
|
11322
|
+
setting.setAttributeNS(WORD_NS, "w:name", "compatibilityMode");
|
|
11323
|
+
setting.setAttributeNS(WORD_NS, "w:uri", uri);
|
|
11324
|
+
setting.setAttributeNS(WORD_NS, "w:val", String(mode));
|
|
11325
|
+
compat.appendChild(setting);
|
|
11326
|
+
}
|
|
11327
|
+
}
|
|
11328
|
+
zip.file(SETTINGS_PATH, buildXml(doc));
|
|
11329
|
+
if (!file) {
|
|
11330
|
+
await ensureContentTypeOverride(zip, SETTINGS_PATH, SETTINGS_CONTENT_TYPE);
|
|
11331
|
+
await ensureDocumentRelationship(zip, SETTINGS_RELATIONSHIP_TYPE, "settings.xml");
|
|
11332
|
+
}
|
|
11333
|
+
}
|
|
11237
11334
|
|
|
11238
11335
|
// docx/page-background.ts
|
|
11239
11336
|
var HEX = /^[0-9a-fA-F]{6}$/;
|
|
@@ -11412,6 +11509,7 @@ function documentBlockLists(model) {
|
|
|
11412
11509
|
(slots) => Object.values(slots ?? {}).flatMap((content) => content ? [content.blocks] : [])
|
|
11413
11510
|
)
|
|
11414
11511
|
),
|
|
11512
|
+
...Object.values(model.footnoteSeparators ?? {}).map((note) => note.blocks),
|
|
11415
11513
|
...[...model.footnotes ?? [], ...model.endnotes ?? []].map((note) => note.blocks)
|
|
11416
11514
|
];
|
|
11417
11515
|
}
|
|
@@ -11444,6 +11542,14 @@ function mapDocumentParagraphs(model, map) {
|
|
|
11444
11542
|
...section.footers ? { footers: slots(section.footers) } : {}
|
|
11445
11543
|
}))
|
|
11446
11544
|
} : {},
|
|
11545
|
+
...model.footnoteSeparators ? {
|
|
11546
|
+
footnoteSeparators: Object.fromEntries(
|
|
11547
|
+
Object.entries(model.footnoteSeparators).map(([kind, note]) => [
|
|
11548
|
+
kind,
|
|
11549
|
+
{ ...note, blocks: mapBlockParagraphs(note.blocks, map) }
|
|
11550
|
+
])
|
|
11551
|
+
)
|
|
11552
|
+
} : {},
|
|
11447
11553
|
...model.footnotes ? {
|
|
11448
11554
|
footnotes: model.footnotes.map((note) => ({
|
|
11449
11555
|
...note,
|
|
@@ -11624,6 +11730,8 @@ async function saveDocx(model, pendingMedia) {
|
|
|
11624
11730
|
await applyNumberingCatalog(zip, model, binding);
|
|
11625
11731
|
await applyCoreProperties(zip, model.properties, binding?.base.properties);
|
|
11626
11732
|
if (binding) await applyStyleNumbering(zip, model, binding.base);
|
|
11733
|
+
if (model.compatibilityMode !== binding?.base.compatibilityMode)
|
|
11734
|
+
await applyCompatibilityMode(zip, model.compatibilityMode);
|
|
11627
11735
|
if (Boolean(model.evenAndOddHeaders) !== Boolean(binding?.base.evenAndOddHeaders))
|
|
11628
11736
|
await applySettingsFlag(zip, "evenAndOddHeaders", Boolean(model.evenAndOddHeaders));
|
|
11629
11737
|
if (model.pageColor !== binding?.base.pageColor)
|
|
@@ -11694,6 +11802,20 @@ function parseCell(cell, parseParagraph3, id) {
|
|
|
11694
11802
|
if (margins) result.margins = margins;
|
|
11695
11803
|
const nested = children2(cell, "tbl").map(nestedPreview);
|
|
11696
11804
|
if (nested.length) result.nestedTables = nested;
|
|
11805
|
+
if (nested.length) {
|
|
11806
|
+
let paragraphIndex = 0, tableIndex = 0;
|
|
11807
|
+
result.sourceBlocks = Array.from(cell.childNodes).flatMap(
|
|
11808
|
+
(child4) => {
|
|
11809
|
+
if (child4.nodeType !== 1) return [];
|
|
11810
|
+
const element = child4;
|
|
11811
|
+
if (element.namespaceURI !== WORD_NS) return [];
|
|
11812
|
+
if (element.localName === "p") return [result.paragraphs[paragraphIndex++]];
|
|
11813
|
+
if (element.localName === "tbl")
|
|
11814
|
+
return [parseTable(element, `${id}-nested${tableIndex++}`, parseParagraph3)];
|
|
11815
|
+
return [];
|
|
11816
|
+
}
|
|
11817
|
+
);
|
|
11818
|
+
}
|
|
11697
11819
|
return result;
|
|
11698
11820
|
}
|
|
11699
11821
|
function parseLook(element) {
|
|
@@ -11908,6 +12030,7 @@ function parseRun2(node, revision) {
|
|
|
11908
12030
|
let breakKind;
|
|
11909
12031
|
let noteReference;
|
|
11910
12032
|
let noteMark;
|
|
12033
|
+
let noteSeparator;
|
|
11911
12034
|
let fieldChar;
|
|
11912
12035
|
const fieldCode = content.length > 0 && content.every((child4) => named2(child4, "instrText")) ? content.map((child4) => textContent(child4)).join("") : void 0;
|
|
11913
12036
|
const only = content.length === 1 ? content[0] : void 0;
|
|
@@ -11923,6 +12046,8 @@ function parseRun2(node, revision) {
|
|
|
11923
12046
|
if (id) noteReference = { kind: "endnote", id };
|
|
11924
12047
|
} else if (named2(only, "footnoteRef")) noteMark = "footnote";
|
|
11925
12048
|
else if (named2(only, "endnoteRef")) noteMark = "endnote";
|
|
12049
|
+
else if (named2(only, "separator")) noteSeparator = "separator";
|
|
12050
|
+
else if (named2(only, "continuationSeparator")) noteSeparator = "continuationSeparator";
|
|
11926
12051
|
else if (named2(only, "fldChar")) {
|
|
11927
12052
|
const type = getW(only, "fldCharType");
|
|
11928
12053
|
if (type === "begin" || type === "separate" || type === "end") fieldChar = type;
|
|
@@ -11940,6 +12065,7 @@ function parseRun2(node, revision) {
|
|
|
11940
12065
|
if (breakKind) run.break = breakKind;
|
|
11941
12066
|
if (noteReference) run.noteReference = noteReference;
|
|
11942
12067
|
if (noteMark) run.noteMark = noteMark;
|
|
12068
|
+
if (noteSeparator) run.noteSeparator = noteSeparator;
|
|
11943
12069
|
if (fieldChar) {
|
|
11944
12070
|
run.fieldChar = fieldChar;
|
|
11945
12071
|
const flags = parseFieldFlags(only);
|
|
@@ -12116,6 +12242,14 @@ function pageBordersOf(element) {
|
|
|
12116
12242
|
return borders ? { pageBorders: borders } : {};
|
|
12117
12243
|
}
|
|
12118
12244
|
function parseOneSection(section, endsAtBlockId) {
|
|
12245
|
+
const footnoteColumns = parseUnsignedInteger(
|
|
12246
|
+
getW(
|
|
12247
|
+
elements(section).find(
|
|
12248
|
+
(element) => element.localName === "footnoteColumns" && element.namespaceURI === "http://schemas.microsoft.com/office/word/2012/wordml"
|
|
12249
|
+
),
|
|
12250
|
+
"val"
|
|
12251
|
+
)
|
|
12252
|
+
);
|
|
12119
12253
|
const size = first2(section, "pgSz");
|
|
12120
12254
|
const margins = first2(section, "pgMar");
|
|
12121
12255
|
const typeValue = enumValue(isStSectionMark, getW(first2(section, "type"), "val"), "w:type");
|
|
@@ -12140,6 +12274,7 @@ function parseOneSection(section, endsAtBlockId) {
|
|
|
12140
12274
|
...footerDistance !== void 0 ? { footerDistanceTwips: footerDistance } : {},
|
|
12141
12275
|
...gutter !== void 0 ? { gutterTwips: gutter } : {},
|
|
12142
12276
|
columns: parseColumns(section),
|
|
12277
|
+
...footnoteColumns !== void 0 ? { footnoteColumns } : {},
|
|
12143
12278
|
...onOffElement(first2(section, "titlePg")) === true ? { titlePage: true } : {},
|
|
12144
12279
|
...vAlignValue ? { verticalAlign: vAlignValue } : {},
|
|
12145
12280
|
...pgNum ? {
|
|
@@ -12193,6 +12328,29 @@ function parseNotesPart(xml, kind, parseBlocks) {
|
|
|
12193
12328
|
}
|
|
12194
12329
|
return notes;
|
|
12195
12330
|
}
|
|
12331
|
+
function parseFootnoteSeparators(xml, parseBlocks) {
|
|
12332
|
+
const root = parseXml2(xml).documentElement;
|
|
12333
|
+
const result = {};
|
|
12334
|
+
for (const element of children2(root, "footnote")) {
|
|
12335
|
+
const type = getW(element, "type");
|
|
12336
|
+
if (type !== "separator" && type !== "continuationSeparator") continue;
|
|
12337
|
+
for (const run of Array.from(element.getElementsByTagNameNS(root.namespaceURI, "r"))) {
|
|
12338
|
+
const content = Array.from(run.childNodes).filter((child4) => child4.nodeType === 1).filter((child4) => child4.localName !== "rPr");
|
|
12339
|
+
if (content.length < 2 || !content.some((child4) => skippedTypes.has(child4.localName)))
|
|
12340
|
+
continue;
|
|
12341
|
+
const props = children2(run, "rPr")[0];
|
|
12342
|
+
for (const child4 of content) {
|
|
12343
|
+
const split = run.cloneNode(false);
|
|
12344
|
+
if (props) split.appendChild(props.cloneNode(true));
|
|
12345
|
+
split.appendChild(child4.cloneNode(true));
|
|
12346
|
+
run.parentNode.insertBefore(split, run);
|
|
12347
|
+
}
|
|
12348
|
+
run.parentNode.removeChild(run);
|
|
12349
|
+
}
|
|
12350
|
+
result[type] = { id: getW(element, "id") ?? type, blocks: parseBlocks(element, `fn-${type}-`) };
|
|
12351
|
+
}
|
|
12352
|
+
return result;
|
|
12353
|
+
}
|
|
12196
12354
|
|
|
12197
12355
|
// docx/document-parts.ts
|
|
12198
12356
|
async function partContext(zip, path2, base) {
|
|
@@ -12208,6 +12366,10 @@ async function readPart(zip, path2) {
|
|
|
12208
12366
|
function parseSettings(xml) {
|
|
12209
12367
|
if (!xml) return { evenAndOddHeaders: false, autoHyphenation: false };
|
|
12210
12368
|
const root = parseXml2(xml).documentElement;
|
|
12369
|
+
const compatibility = (first2(root, "compat") ? children2(first2(root, "compat"), "compatSetting") : []).find(
|
|
12370
|
+
(setting) => getW(setting, "name") === "compatibilityMode" && getW(setting, "uri") === "http://schemas.microsoft.com/office/word"
|
|
12371
|
+
);
|
|
12372
|
+
const compatibilityMode = compatibility ? Number(getW(compatibility, "val")) : void 0;
|
|
12211
12373
|
const footnoteNumFmt = enumValue(
|
|
12212
12374
|
isStNumberFormat,
|
|
12213
12375
|
getW(first2(first2(root, "footnotePr"), "numFmt"), "val"),
|
|
@@ -12219,6 +12381,7 @@ function parseSettings(xml) {
|
|
|
12219
12381
|
"w:endnotePr/w:numFmt"
|
|
12220
12382
|
);
|
|
12221
12383
|
return {
|
|
12384
|
+
...compatibilityMode !== void 0 && Number.isInteger(compatibilityMode) && compatibilityMode > 0 ? { compatibilityMode } : {},
|
|
12222
12385
|
evenAndOddHeaders: onOffElement(first2(root, "evenAndOddHeaders")) === true,
|
|
12223
12386
|
autoHyphenation: onOffElement(first2(root, "autoHyphenation")) === true,
|
|
12224
12387
|
...footnoteNumFmt ? { footnoteNumFmt } : {},
|
|
@@ -12283,9 +12446,10 @@ async function parseDocumentParts(zip, body, blocks, drawings) {
|
|
|
12283
12446
|
const endnotesXml = await readPart(zip, "word/endnotes.xml");
|
|
12284
12447
|
const notesParser = async (path2) => {
|
|
12285
12448
|
const context = await partContext(zip, path2, drawings);
|
|
12286
|
-
return (container2,
|
|
12449
|
+
return (container2, prefix2) => withParseWarnings(warnings, () => parseBlocksFromContainer(container2, prefix2, context));
|
|
12287
12450
|
};
|
|
12288
12451
|
const footnotes = footnotesXml ? parseNotesPart(footnotesXml, "footnote", await notesParser("word/footnotes.xml")) : void 0;
|
|
12452
|
+
const footnoteSeparators = footnotesXml ? parseFootnoteSeparators(footnotesXml, await notesParser("word/footnotes.xml")) : void 0;
|
|
12289
12453
|
const endnotes = endnotesXml ? parseNotesPart(endnotesXml, "endnote", await notesParser("word/endnotes.xml")) : void 0;
|
|
12290
12454
|
if (sections.some((section) => section.columns.count > 1))
|
|
12291
12455
|
warnings.push(
|
|
@@ -12297,7 +12461,9 @@ async function parseDocumentParts(zip, body, blocks, drawings) {
|
|
|
12297
12461
|
);
|
|
12298
12462
|
return {
|
|
12299
12463
|
sections,
|
|
12464
|
+
...settings.compatibilityMode !== void 0 ? { compatibilityMode: settings.compatibilityMode } : {},
|
|
12300
12465
|
...footnotes ? { footnotes } : {},
|
|
12466
|
+
...footnoteSeparators ? { footnoteSeparators } : {},
|
|
12301
12467
|
...endnotes ? { endnotes } : {},
|
|
12302
12468
|
...settings.footnoteNumFmt ? { footnoteNumFmt: settings.footnoteNumFmt } : {},
|
|
12303
12469
|
...settings.endnoteNumFmt ? { endnoteNumFmt: settings.endnoteNumFmt } : {},
|
|
@@ -12535,7 +12701,9 @@ async function readPackage(input) {
|
|
|
12535
12701
|
);
|
|
12536
12702
|
const parts = await parseDocumentParts(zip, body, blocks, drawings);
|
|
12537
12703
|
model.sections = parts.sections;
|
|
12704
|
+
if (parts.compatibilityMode !== void 0) model.compatibilityMode = parts.compatibilityMode;
|
|
12538
12705
|
if (parts.footnotes) model.footnotes = parts.footnotes;
|
|
12706
|
+
if (parts.footnoteSeparators) model.footnoteSeparators = parts.footnoteSeparators;
|
|
12539
12707
|
if (parts.endnotes) model.endnotes = parts.endnotes;
|
|
12540
12708
|
if (parts.footnoteNumFmt) model.footnoteNumFmt = parts.footnoteNumFmt;
|
|
12541
12709
|
if (parts.endnoteNumFmt) model.endnoteNumFmt = parts.endnoteNumFmt;
|
|
@@ -12582,6 +12750,7 @@ async function readPackage(input) {
|
|
|
12582
12750
|
(slots) => Object.values(slots ?? {}).flatMap((content) => content?.blocks ?? [])
|
|
12583
12751
|
)
|
|
12584
12752
|
),
|
|
12753
|
+
...Object.values(model.footnoteSeparators ?? {}).flatMap((note) => note.blocks),
|
|
12585
12754
|
...[...model.footnotes ?? [], ...model.endnotes ?? []].flatMap((note) => note.blocks)
|
|
12586
12755
|
];
|
|
12587
12756
|
await resolveDocumentDiagrams(
|