@fiduswriter/document 0.1.0-alpha.3 → 0.1.0-alpha.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/README.md +22 -1
- package/dist/bibliography/common.d.ts +10 -0
- package/dist/bibliography/common.d.ts.map +1 -0
- package/dist/bibliography/common.js +86 -0
- package/dist/bibliography/common.js.map +1 -0
- package/dist/bibliography/csl_bib.d.ts +3 -0
- package/dist/bibliography/csl_bib.d.ts.map +1 -0
- package/dist/bibliography/csl_bib.js +131 -0
- package/dist/bibliography/csl_bib.js.map +1 -0
- package/dist/citations/citeproc_sys.d.ts +12 -0
- package/dist/citations/citeproc_sys.d.ts.map +1 -0
- package/dist/citations/citeproc_sys.js +48 -0
- package/dist/citations/citeproc_sys.js.map +1 -0
- package/dist/citations/format.d.ts +40 -0
- package/dist/citations/format.d.ts.map +1 -0
- package/dist/citations/format.js +186 -0
- package/dist/citations/format.js.map +1 -0
- package/dist/editor/e2ee/encryptor.d.ts +123 -0
- package/dist/editor/e2ee/encryptor.d.ts.map +1 -0
- package/dist/editor/e2ee/encryptor.js +201 -0
- package/dist/editor/e2ee/encryptor.js.map +1 -0
- package/dist/exporter/docx/citations.d.ts +31 -0
- package/dist/exporter/docx/citations.d.ts.map +1 -0
- package/dist/exporter/docx/citations.js +171 -0
- package/dist/exporter/docx/citations.js.map +1 -0
- package/dist/exporter/docx/comments.d.ts +22 -0
- package/dist/exporter/docx/comments.d.ts.map +1 -0
- package/dist/exporter/docx/comments.js +170 -0
- package/dist/exporter/docx/comments.js.map +1 -0
- package/dist/exporter/docx/footnotes.d.ts +47 -0
- package/dist/exporter/docx/footnotes.d.ts.map +1 -0
- package/dist/exporter/docx/footnotes.js +216 -0
- package/dist/exporter/docx/footnotes.js.map +1 -0
- package/dist/exporter/docx/images.d.ts +25 -0
- package/dist/exporter/docx/images.d.ts.map +1 -0
- package/dist/exporter/docx/images.js +101 -0
- package/dist/exporter/docx/images.js.map +1 -0
- package/dist/exporter/docx/index.d.ts +16 -0
- package/dist/exporter/docx/index.d.ts.map +1 -0
- package/dist/exporter/docx/index.js +115 -0
- package/dist/exporter/docx/index.js.map +1 -0
- package/dist/exporter/docx/lists.d.ts +38 -0
- package/dist/exporter/docx/lists.d.ts.map +1 -0
- package/dist/exporter/docx/lists.js +276 -0
- package/dist/exporter/docx/lists.js.map +1 -0
- package/dist/exporter/docx/math.d.ts +13 -0
- package/dist/exporter/docx/math.d.ts.map +1 -0
- package/dist/exporter/docx/math.js +59 -0
- package/dist/exporter/docx/math.js.map +1 -0
- package/dist/exporter/docx/metadata.d.ts +17 -0
- package/dist/exporter/docx/metadata.d.ts.map +1 -0
- package/dist/exporter/docx/metadata.js +272 -0
- package/dist/exporter/docx/metadata.js.map +1 -0
- package/dist/exporter/docx/rels.d.ts +27 -0
- package/dist/exporter/docx/rels.d.ts.map +1 -0
- package/dist/exporter/docx/rels.js +183 -0
- package/dist/exporter/docx/rels.js.map +1 -0
- package/dist/exporter/docx/render.d.ts +22 -0
- package/dist/exporter/docx/render.d.ts.map +1 -0
- package/dist/exporter/docx/render.js +780 -0
- package/dist/exporter/docx/render.js.map +1 -0
- package/dist/exporter/docx/richtext.d.ts +25 -0
- package/dist/exporter/docx/richtext.d.ts.map +1 -0
- package/dist/exporter/docx/richtext.js +1070 -0
- package/dist/exporter/docx/richtext.js.map +1 -0
- package/dist/exporter/docx/tables.d.ts +16 -0
- package/dist/exporter/docx/tables.d.ts.map +1 -0
- package/dist/exporter/docx/tables.js +115 -0
- package/dist/exporter/docx/tables.js.map +1 -0
- package/dist/exporter/docx/tools.d.ts +4 -0
- package/dist/exporter/docx/tools.d.ts.map +1 -0
- package/dist/exporter/docx/tools.js +48 -0
- package/dist/exporter/docx/tools.js.map +1 -0
- package/dist/exporter/epub/index.d.ts +19 -0
- package/dist/exporter/epub/index.d.ts.map +1 -0
- package/dist/exporter/epub/index.js +109 -0
- package/dist/exporter/epub/index.js.map +1 -0
- package/dist/exporter/epub/templates.d.ts +63 -0
- package/dist/exporter/epub/templates.d.ts.map +1 -0
- package/dist/exporter/epub/templates.js +95 -0
- package/dist/exporter/epub/templates.js.map +1 -0
- package/dist/exporter/epub/tools.d.ts +13 -0
- package/dist/exporter/epub/tools.d.ts.map +1 -0
- package/{src → dist}/exporter/epub/tools.js +32 -46
- package/dist/exporter/epub/tools.js.map +1 -0
- package/dist/exporter/html/citations.d.ts +29 -0
- package/dist/exporter/html/citations.d.ts.map +1 -0
- package/dist/exporter/html/citations.js +110 -0
- package/dist/exporter/html/citations.js.map +1 -0
- package/dist/exporter/html/convert.d.ts +50 -0
- package/dist/exporter/html/convert.d.ts.map +1 -0
- package/dist/exporter/html/convert.js +750 -0
- package/dist/exporter/html/convert.js.map +1 -0
- package/dist/exporter/html/index.d.ts +64 -0
- package/dist/exporter/html/index.d.ts.map +1 -0
- package/dist/exporter/html/index.js +154 -0
- package/dist/exporter/html/index.js.map +1 -0
- package/dist/exporter/html/templates.d.ts +24 -0
- package/dist/exporter/html/templates.d.ts.map +1 -0
- package/dist/exporter/html/templates.js +21 -0
- package/dist/exporter/html/templates.js.map +1 -0
- package/dist/exporter/html/tools.d.ts +2 -0
- package/dist/exporter/html/tools.d.ts.map +1 -0
- package/dist/exporter/html/tools.js +49 -0
- package/dist/exporter/html/tools.js.map +1 -0
- package/dist/exporter/jats/bibliography.d.ts +3 -0
- package/dist/exporter/jats/bibliography.d.ts.map +1 -0
- package/dist/exporter/jats/bibliography.js +158 -0
- package/dist/exporter/jats/bibliography.js.map +1 -0
- package/dist/exporter/jats/citations.d.ts +16 -0
- package/dist/exporter/jats/citations.d.ts.map +1 -0
- package/dist/exporter/jats/citations.js +105 -0
- package/dist/exporter/jats/citations.js.map +1 -0
- package/dist/exporter/jats/convert.d.ts +41 -0
- package/dist/exporter/jats/convert.d.ts.map +1 -0
- package/dist/exporter/jats/convert.js +816 -0
- package/dist/exporter/jats/convert.js.map +1 -0
- package/dist/exporter/jats/index.d.ts +25 -0
- package/dist/exporter/jats/index.d.ts.map +1 -0
- package/dist/exporter/jats/index.js +82 -0
- package/dist/exporter/jats/index.js.map +1 -0
- package/dist/exporter/jats/templates.d.ts +18 -0
- package/dist/exporter/jats/templates.d.ts.map +1 -0
- package/dist/exporter/jats/templates.js +25 -0
- package/dist/exporter/jats/templates.js.map +1 -0
- package/dist/exporter/jats/text.d.ts +4 -0
- package/dist/exporter/jats/text.d.ts.map +1 -0
- package/dist/exporter/jats/text.js +72 -0
- package/dist/exporter/jats/text.js.map +1 -0
- package/dist/exporter/latex/convert.d.ts +24 -0
- package/dist/exporter/latex/convert.d.ts.map +1 -0
- package/dist/exporter/latex/convert.js +881 -0
- package/dist/exporter/latex/convert.js.map +1 -0
- package/dist/exporter/latex/escape_latex.d.ts +2 -0
- package/dist/exporter/latex/escape_latex.d.ts.map +1 -0
- package/dist/exporter/latex/escape_latex.js +20 -0
- package/dist/exporter/latex/escape_latex.js.map +1 -0
- package/dist/exporter/latex/index.d.ts +24 -0
- package/dist/exporter/latex/index.d.ts.map +1 -0
- package/dist/exporter/latex/index.js +67 -0
- package/dist/exporter/latex/index.js.map +1 -0
- package/dist/exporter/latex/readme.d.ts +2 -0
- package/dist/exporter/latex/readme.d.ts.map +1 -0
- package/dist/exporter/latex/readme.js +23 -0
- package/dist/exporter/latex/readme.js.map +1 -0
- package/dist/exporter/native/copy.d.ts +30 -0
- package/dist/exporter/native/copy.d.ts.map +1 -0
- package/dist/exporter/native/copy.js +151 -0
- package/dist/exporter/native/copy.js.map +1 -0
- package/dist/exporter/native/file.d.ts +12 -0
- package/dist/exporter/native/file.d.ts.map +1 -0
- package/dist/exporter/native/file.js +38 -0
- package/dist/exporter/native/file.js.map +1 -0
- package/dist/exporter/native/index.d.ts +5 -0
- package/dist/exporter/native/index.d.ts.map +1 -0
- package/dist/exporter/native/index.js +5 -0
- package/dist/exporter/native/index.js.map +1 -0
- package/dist/exporter/native/revision.d.ts +18 -0
- package/dist/exporter/native/revision.d.ts.map +1 -0
- package/dist/exporter/native/revision.js +39 -0
- package/dist/exporter/native/revision.js.map +1 -0
- package/dist/exporter/native/shrink.d.ts +36 -0
- package/dist/exporter/native/shrink.d.ts.map +1 -0
- package/dist/exporter/native/shrink.js +124 -0
- package/dist/exporter/native/shrink.js.map +1 -0
- package/dist/exporter/native/zip.d.ts +25 -0
- package/dist/exporter/native/zip.d.ts.map +1 -0
- package/dist/exporter/native/zip.js +56 -0
- package/dist/exporter/native/zip.js.map +1 -0
- package/dist/exporter/odt/citations.d.ts +21 -0
- package/dist/exporter/odt/citations.d.ts.map +1 -0
- package/dist/exporter/odt/citations.js +104 -0
- package/dist/exporter/odt/citations.js.map +1 -0
- package/dist/exporter/odt/footnotes.d.ts +31 -0
- package/dist/exporter/odt/footnotes.d.ts.map +1 -0
- package/dist/exporter/odt/footnotes.js +129 -0
- package/dist/exporter/odt/footnotes.js.map +1 -0
- package/dist/exporter/odt/images.d.ts +25 -0
- package/dist/exporter/odt/images.d.ts.map +1 -0
- package/dist/exporter/odt/images.js +106 -0
- package/dist/exporter/odt/images.js.map +1 -0
- package/dist/exporter/odt/index.d.ts +17 -0
- package/dist/exporter/odt/index.d.ts.map +1 -0
- package/dist/exporter/odt/index.js +108 -0
- package/dist/exporter/odt/index.js.map +1 -0
- package/dist/exporter/odt/math.d.ts +15 -0
- package/dist/exporter/odt/math.d.ts.map +1 -0
- package/dist/exporter/odt/math.js +71 -0
- package/dist/exporter/odt/math.js.map +1 -0
- package/dist/exporter/odt/metadata.d.ts +18 -0
- package/dist/exporter/odt/metadata.d.ts.map +1 -0
- package/dist/exporter/odt/metadata.js +224 -0
- package/dist/exporter/odt/metadata.js.map +1 -0
- package/dist/exporter/odt/render.d.ts +26 -0
- package/dist/exporter/odt/render.d.ts.map +1 -0
- package/dist/exporter/odt/render.js +651 -0
- package/dist/exporter/odt/render.js.map +1 -0
- package/dist/exporter/odt/richtext.d.ts +22 -0
- package/dist/exporter/odt/richtext.d.ts.map +1 -0
- package/dist/exporter/odt/richtext.js +743 -0
- package/dist/exporter/odt/richtext.js.map +1 -0
- package/dist/exporter/odt/styles.d.ts +41 -0
- package/dist/exporter/odt/styles.d.ts.map +1 -0
- package/dist/exporter/odt/styles.js +370 -0
- package/dist/exporter/odt/styles.js.map +1 -0
- package/dist/exporter/odt/track.d.ts +18 -0
- package/dist/exporter/odt/track.d.ts.map +1 -0
- package/dist/exporter/odt/track.js +66 -0
- package/dist/exporter/odt/track.js.map +1 -0
- package/dist/exporter/pandoc/citations.d.ts +23 -0
- package/dist/exporter/pandoc/citations.d.ts.map +1 -0
- package/dist/exporter/pandoc/citations.js +99 -0
- package/dist/exporter/pandoc/citations.js.map +1 -0
- package/dist/exporter/pandoc/convert.d.ts +19 -0
- package/dist/exporter/pandoc/convert.d.ts.map +1 -0
- package/dist/exporter/pandoc/convert.js +886 -0
- package/dist/exporter/pandoc/convert.js.map +1 -0
- package/dist/exporter/pandoc/index.d.ts +25 -0
- package/dist/exporter/pandoc/index.d.ts.map +1 -0
- package/dist/exporter/pandoc/index.js +79 -0
- package/dist/exporter/pandoc/index.js.map +1 -0
- package/dist/exporter/pandoc/readme.d.ts +2 -0
- package/dist/exporter/pandoc/readme.d.ts.map +1 -0
- package/dist/exporter/pandoc/readme.js +8 -0
- package/dist/exporter/pandoc/readme.js.map +1 -0
- package/dist/exporter/pandoc/tools.d.ts +22 -0
- package/dist/exporter/pandoc/tools.d.ts.map +1 -0
- package/dist/exporter/pandoc/tools.js +52 -0
- package/dist/exporter/pandoc/tools.js.map +1 -0
- package/dist/exporter/print/index.d.ts +20 -0
- package/dist/exporter/print/index.d.ts.map +1 -0
- package/dist/exporter/print/index.js +142 -0
- package/dist/exporter/print/index.js.map +1 -0
- package/dist/exporter/tools/doc_content.d.ts +6 -0
- package/dist/exporter/tools/doc_content.d.ts.map +1 -0
- package/dist/exporter/tools/doc_content.js +130 -0
- package/dist/exporter/tools/doc_content.js.map +1 -0
- package/dist/exporter/tools/file.d.ts +2 -0
- package/dist/exporter/tools/file.d.ts.map +1 -0
- package/dist/exporter/tools/file.js +10 -0
- package/dist/exporter/tools/file.js.map +1 -0
- package/dist/exporter/tools/json.d.ts +7 -0
- package/dist/exporter/tools/json.d.ts.map +1 -0
- package/dist/exporter/tools/json.js +82 -0
- package/dist/exporter/tools/json.js.map +1 -0
- package/dist/exporter/tools/svg.d.ts +8 -0
- package/dist/exporter/tools/svg.d.ts.map +1 -0
- package/dist/exporter/tools/svg.js +26 -0
- package/dist/exporter/tools/svg.js.map +1 -0
- package/dist/exporter/tools/xml.d.ts +42 -0
- package/dist/exporter/tools/xml.d.ts.map +1 -0
- package/dist/exporter/tools/xml.js +467 -0
- package/dist/exporter/tools/xml.js.map +1 -0
- package/dist/exporter/tools/xml_zip.d.ts +21 -0
- package/dist/exporter/tools/xml_zip.d.ts.map +1 -0
- package/dist/exporter/tools/xml_zip.js +92 -0
- package/dist/exporter/tools/xml_zip.js.map +1 -0
- package/dist/exporter/tools/zip.d.ts +35 -0
- package/dist/exporter/tools/zip.d.ts.map +1 -0
- package/dist/exporter/tools/zip.js +78 -0
- package/dist/exporter/tools/zip.js.map +1 -0
- package/dist/exporter/tools/zotero_csl.d.ts +23 -0
- package/dist/exporter/tools/zotero_csl.d.ts.map +1 -0
- package/dist/exporter/tools/zotero_csl.js +78 -0
- package/dist/exporter/tools/zotero_csl.js.map +1 -0
- package/dist/importer/citations.d.ts +28 -0
- package/dist/importer/citations.d.ts.map +1 -0
- package/dist/importer/citations.js +68 -0
- package/dist/importer/citations.js.map +1 -0
- package/dist/importer/docx/citations.d.ts +43 -0
- package/dist/importer/docx/citations.d.ts.map +1 -0
- package/dist/importer/docx/citations.js +81 -0
- package/dist/importer/docx/citations.js.map +1 -0
- package/dist/importer/docx/convert.d.ts +150 -0
- package/dist/importer/docx/convert.d.ts.map +1 -0
- package/dist/importer/docx/convert.js +1243 -0
- package/dist/importer/docx/convert.js.map +1 -0
- package/dist/importer/docx/helpers.d.ts +2 -0
- package/dist/importer/docx/helpers.d.ts.map +1 -0
- package/dist/importer/docx/helpers.js +10 -0
- package/dist/importer/docx/helpers.js.map +1 -0
- package/dist/importer/docx/index.d.ts +27 -0
- package/dist/importer/docx/index.d.ts.map +1 -0
- package/dist/importer/docx/index.js +77 -0
- package/dist/importer/docx/index.js.map +1 -0
- package/dist/importer/docx/omml2mathml.d.ts +6 -0
- package/dist/importer/docx/omml2mathml.d.ts.map +1 -0
- package/dist/importer/docx/omml2mathml.js +1146 -0
- package/dist/importer/docx/omml2mathml.js.map +1 -0
- package/dist/importer/docx/parse.d.ts +96 -0
- package/dist/importer/docx/parse.d.ts.map +1 -0
- package/dist/importer/docx/parse.js +681 -0
- package/dist/importer/docx/parse.js.map +1 -0
- package/dist/importer/native/extract_template.d.ts +6 -0
- package/dist/importer/native/extract_template.d.ts.map +1 -0
- package/dist/importer/native/extract_template.js +80 -0
- package/dist/importer/native/extract_template.js.map +1 -0
- package/dist/importer/native/file.d.ts +37 -0
- package/dist/importer/native/file.d.ts.map +1 -0
- package/dist/importer/native/file.js +162 -0
- package/dist/importer/native/file.js.map +1 -0
- package/dist/importer/native/get_images.d.ts +21 -0
- package/dist/importer/native/get_images.d.ts.map +1 -0
- package/dist/importer/native/get_images.js +58 -0
- package/dist/importer/native/get_images.js.map +1 -0
- package/dist/importer/native/importer.d.ts +41 -0
- package/dist/importer/native/importer.d.ts.map +1 -0
- package/dist/importer/native/importer.js +170 -0
- package/dist/importer/native/importer.js.map +1 -0
- package/dist/importer/native/index.d.ts +7 -0
- package/dist/importer/native/index.d.ts.map +1 -0
- package/dist/importer/native/index.js +7 -0
- package/dist/importer/native/index.js.map +1 -0
- package/dist/importer/native/update.d.ts +7 -0
- package/dist/importer/native/update.d.ts.map +1 -0
- package/dist/importer/native/update.js +27 -0
- package/dist/importer/native/update.js.map +1 -0
- package/dist/importer/native/update_template.d.ts +12 -0
- package/dist/importer/native/update_template.d.ts.map +1 -0
- package/dist/importer/native/update_template.js +19 -0
- package/dist/importer/native/update_template.js.map +1 -0
- package/dist/importer/odt/citations.d.ts +27 -0
- package/dist/importer/odt/citations.d.ts.map +1 -0
- package/dist/importer/odt/citations.js +57 -0
- package/dist/importer/odt/citations.js.map +1 -0
- package/dist/importer/odt/convert.d.ts +146 -0
- package/dist/importer/odt/convert.d.ts.map +1 -0
- package/dist/importer/odt/convert.js +1530 -0
- package/dist/importer/odt/convert.js.map +1 -0
- package/dist/importer/odt/index.d.ts +30 -0
- package/dist/importer/odt/index.d.ts.map +1 -0
- package/dist/importer/odt/index.js +124 -0
- package/dist/importer/odt/index.js.map +1 -0
- package/dist/importer/pandoc/convert.d.ts +32 -0
- package/dist/importer/pandoc/convert.d.ts.map +1 -0
- package/dist/importer/pandoc/convert.js +790 -0
- package/dist/importer/pandoc/convert.js.map +1 -0
- package/dist/importer/pandoc/helpers.d.ts +5 -0
- package/dist/importer/pandoc/helpers.d.ts.map +1 -0
- package/dist/importer/pandoc/helpers.js +73 -0
- package/dist/importer/pandoc/helpers.js.map +1 -0
- package/dist/importer/pandoc/index.d.ts +31 -0
- package/dist/importer/pandoc/index.d.ts.map +1 -0
- package/dist/importer/pandoc/index.js +114 -0
- package/dist/importer/pandoc/index.js.map +1 -0
- package/dist/importer/registry.d.ts +21 -0
- package/dist/importer/registry.d.ts.map +1 -0
- package/dist/importer/registry.js +41 -0
- package/dist/importer/registry.js.map +1 -0
- package/dist/importer/zip_analyzer.d.ts +31 -0
- package/dist/importer/zip_analyzer.d.ts.map +1 -0
- package/dist/importer/zip_analyzer.js +89 -0
- package/dist/importer/zip_analyzer.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/mathlive/opf_includes.d.ts +2 -0
- package/dist/mathlive/opf_includes.d.ts.map +1 -0
- package/dist/mathlive/opf_includes.js +25 -0
- package/dist/mathlive/opf_includes.js.map +1 -0
- package/dist/schema/common/annotate.d.ts +47 -0
- package/dist/schema/common/annotate.d.ts.map +1 -0
- package/dist/schema/common/annotate.js +75 -0
- package/dist/schema/common/annotate.js.map +1 -0
- package/dist/schema/common/base.d.ts +91 -0
- package/dist/schema/common/base.d.ts.map +1 -0
- package/dist/schema/common/base.js +109 -0
- package/dist/schema/common/base.js.map +1 -0
- package/dist/schema/common/citation.d.ts +30 -0
- package/dist/schema/common/citation.d.ts.map +1 -0
- package/dist/schema/common/citation.js +61 -0
- package/dist/schema/common/citation.js.map +1 -0
- package/dist/schema/common/equation.d.ts +17 -0
- package/dist/schema/common/equation.d.ts.map +1 -0
- package/dist/schema/common/equation.js +32 -0
- package/dist/schema/common/equation.js.map +1 -0
- package/dist/schema/common/figure.d.ts +87 -0
- package/dist/schema/common/figure.d.ts.map +1 -0
- package/dist/schema/common/figure.js +178 -0
- package/dist/schema/common/figure.js.map +1 -0
- package/dist/schema/common/heading.d.ts +9 -0
- package/dist/schema/common/heading.d.ts.map +1 -0
- package/dist/schema/common/heading.js +41 -0
- package/dist/schema/common/heading.js.map +1 -0
- package/dist/schema/common/index.d.ts +11 -0
- package/dist/schema/common/index.d.ts.map +1 -0
- package/dist/schema/common/index.js +11 -0
- package/dist/schema/common/index.js.map +1 -0
- package/dist/schema/common/list.d.ts +63 -0
- package/dist/schema/common/list.d.ts.map +1 -0
- package/dist/schema/common/list.js +92 -0
- package/dist/schema/common/list.js.map +1 -0
- package/dist/schema/common/reference.d.ts +70 -0
- package/dist/schema/common/reference.d.ts.map +1 -0
- package/dist/schema/common/reference.js +97 -0
- package/dist/schema/common/reference.js.map +1 -0
- package/dist/schema/common/table.d.ts +76 -0
- package/dist/schema/common/table.d.ts.map +1 -0
- package/dist/schema/common/table.js +86 -0
- package/dist/schema/common/table.js.map +1 -0
- package/dist/schema/common/track.d.ts +117 -0
- package/dist/schema/common/track.d.ts.map +1 -0
- package/{src → dist}/schema/common/track.js +44 -49
- package/dist/schema/common/track.js.map +1 -0
- package/dist/schema/const.d.ts +3 -0
- package/dist/schema/const.d.ts.map +1 -0
- package/{src → dist}/schema/const.js +3 -3
- package/dist/schema/const.js.map +1 -0
- package/dist/schema/convert.d.ts +3 -0
- package/dist/schema/convert.d.ts.map +1 -0
- package/dist/schema/convert.js +1215 -0
- package/dist/schema/convert.js.map +1 -0
- package/dist/schema/document/content.d.ts +110 -0
- package/dist/schema/document/content.d.ts.map +1 -0
- package/dist/schema/document/content.js +177 -0
- package/dist/schema/document/content.js.map +1 -0
- package/dist/schema/document/index.d.ts +795 -0
- package/dist/schema/document/index.d.ts.map +1 -0
- package/dist/schema/document/index.js +68 -0
- package/dist/schema/document/index.js.map +1 -0
- package/dist/schema/document/structure.d.ts +164 -0
- package/dist/schema/document/structure.d.ts.map +1 -0
- package/dist/schema/document/structure.js +445 -0
- package/dist/schema/document/structure.js.map +1 -0
- package/dist/schema/export.d.ts +7 -0
- package/dist/schema/export.d.ts.map +1 -0
- package/dist/schema/export.js +17 -0
- package/dist/schema/export.js.map +1 -0
- package/dist/schema/footnotes.d.ts +454 -0
- package/dist/schema/footnotes.d.ts.map +1 -0
- package/dist/schema/footnotes.js +90 -0
- package/dist/schema/footnotes.js.map +1 -0
- package/dist/schema/footnotes_convert.d.ts +5 -0
- package/dist/schema/footnotes_convert.d.ts.map +1 -0
- package/dist/schema/footnotes_convert.js +30 -0
- package/dist/schema/footnotes_convert.js.map +1 -0
- package/dist/schema/i18n.d.ts +55 -0
- package/dist/schema/i18n.d.ts.map +1 -0
- package/{src → dist}/schema/i18n.js +14 -23
- package/dist/schema/i18n.js.map +1 -0
- package/dist/schema/index.d.ts +6 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +6 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/mini_json.d.ts +4 -0
- package/dist/schema/mini_json.d.ts.map +1 -0
- package/{src → dist}/schema/mini_json.js +19 -28
- package/dist/schema/mini_json.js.map +1 -0
- package/dist/schema/text.d.ts +3 -0
- package/dist/schema/text.d.ts.map +1 -0
- package/dist/schema/text.js +23 -0
- package/dist/schema/text.js.map +1 -0
- package/dist/types.d.ts +281 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/package.json +51 -16
- package/scripts/export-schema.js +1 -1
- package/src/bibliography/{common.js → common.ts} +15 -12
- package/src/bibliography/{csl_bib.js → csl_bib.ts} +16 -15
- package/src/citations/{citeproc_sys.js → citeproc_sys.ts} +26 -6
- package/src/citations/{format.js → format.ts} +80 -24
- package/src/editor/e2ee/{encryptor.js → encryptor.ts} +76 -44
- package/src/exporter/docx/{citations.js → citations.ts} +51 -23
- package/src/exporter/docx/{comments.js → comments.ts} +69 -26
- package/src/exporter/docx/{footnotes.js → footnotes.ts} +81 -42
- package/src/exporter/docx/images.ts +128 -0
- package/src/exporter/docx/{index.js → index.ts} +48 -25
- package/src/exporter/docx/{lists.js → lists.ts} +89 -46
- package/src/exporter/docx/{math.js → math.ts} +29 -9
- package/src/exporter/docx/{metadata.js → metadata.ts} +78 -42
- package/src/exporter/docx/{rels.js → rels.ts} +71 -50
- package/src/exporter/docx/{render.js → render.ts} +124 -87
- package/src/exporter/docx/{richtext.js → richtext.ts} +107 -84
- package/src/exporter/docx/{tables.js → tables.ts} +33 -23
- package/src/exporter/docx/{tools.js → tools.ts} +4 -3
- package/src/exporter/epub/{index.js → index.ts} +44 -15
- package/src/exporter/epub/{templates.js → templates.ts} +71 -7
- package/src/exporter/epub/tools.ts +102 -0
- package/src/exporter/html/{citations.js → citations.ts} +79 -31
- package/src/exporter/html/{convert.js → convert.ts} +118 -71
- package/src/exporter/html/{index.js → index.ts} +63 -29
- package/src/exporter/html/{templates.js → templates.ts} +22 -2
- package/src/exporter/html/{tools.js → tools.ts} +9 -6
- package/src/exporter/jats/bibliography.ts +199 -0
- package/src/exporter/jats/{citations.js → citations.ts} +56 -20
- package/src/exporter/jats/{convert.js → convert.ts} +72 -53
- package/src/exporter/jats/index.ts +132 -0
- package/src/exporter/jats/{templates.js → templates.ts} +19 -3
- package/src/exporter/jats/{text.js → text.ts} +8 -6
- package/src/exporter/latex/{convert.js → convert.ts} +160 -125
- package/src/exporter/latex/{escape_latex.js → escape_latex.ts} +1 -1
- package/src/exporter/latex/{index.js → index.ts} +27 -12
- package/src/exporter/latex/{readme.js → readme.ts} +2 -2
- package/src/exporter/native/copy.ts +231 -0
- package/src/exporter/native/file.ts +65 -0
- package/src/exporter/native/index.ts +4 -0
- package/src/exporter/native/revision.ts +76 -0
- package/src/exporter/native/{shrink.js → shrink.ts} +64 -29
- package/src/exporter/native/zip.ts +85 -0
- package/src/exporter/odt/{citations.js → citations.ts} +35 -15
- package/src/exporter/odt/{footnotes.js → footnotes.ts} +53 -30
- package/src/exporter/odt/images.ts +135 -0
- package/src/exporter/odt/{index.js → index.ts} +49 -27
- package/src/exporter/odt/{math.js → math.ts} +38 -9
- package/src/exporter/odt/{metadata.js → metadata.ts} +54 -29
- package/src/exporter/odt/{render.js → render.ts} +89 -60
- package/src/exporter/odt/{richtext.js → richtext.ts} +102 -72
- package/src/exporter/odt/{styles.js → styles.ts} +98 -66
- package/src/exporter/odt/{track.js → track.ts} +22 -6
- package/src/exporter/pandoc/{citations.js → citations.ts} +31 -15
- package/src/exporter/pandoc/{convert.js → convert.ts} +98 -79
- package/src/exporter/pandoc/{index.js → index.ts} +36 -13
- package/src/exporter/pandoc/{readme.js → readme.ts} +0 -1
- package/src/exporter/pandoc/{tools.js → tools.ts} +28 -5
- package/src/exporter/print/{index.js → index.ts} +38 -19
- package/src/exporter/tools/{doc_content.js → doc_content.ts} +34 -24
- package/src/exporter/tools/{file.js → file.ts} +1 -1
- package/src/exporter/tools/{json.js → json.ts} +30 -19
- package/src/exporter/tools/{svg.js → svg.ts} +9 -3
- package/src/exporter/tools/{xml.js → xml.ts} +187 -138
- package/src/exporter/tools/{xml_zip.js → xml_zip.ts} +19 -11
- package/src/exporter/tools/{zip.js → zip.ts} +35 -11
- package/src/exporter/tools/{zotero_csl.js → zotero_csl.ts} +35 -18
- package/src/global.d.ts +13 -0
- package/src/importer/citations.ts +116 -0
- package/src/importer/docx/{citations.js → citations.ts} +22 -37
- package/src/importer/docx/{convert.js → convert.ts} +176 -141
- package/src/importer/docx/{helpers.js → helpers.ts} +1 -1
- package/src/importer/docx/index.ts +124 -0
- package/src/importer/docx/{omml2mathml.js → omml2mathml.ts} +154 -176
- package/src/importer/docx/{parse.js → parse.ts} +103 -81
- package/src/importer/native/extract_template.ts +83 -0
- package/src/importer/native/file.ts +282 -0
- package/src/importer/native/get_images.ts +82 -0
- package/src/importer/native/importer.ts +244 -0
- package/src/importer/native/index.ts +6 -0
- package/src/importer/native/{update.js → update.ts} +13 -5
- package/src/importer/native/update_template.ts +32 -0
- package/src/importer/odt/{citations.js → citations.ts} +17 -29
- package/src/importer/odt/{convert.js → convert.ts} +261 -237
- package/src/importer/odt/index.ts +202 -0
- package/src/importer/pandoc/{convert.js → convert.ts} +116 -94
- package/src/importer/pandoc/{helpers.js → helpers.ts} +24 -12
- package/src/importer/pandoc/index.ts +171 -0
- package/src/importer/registry.ts +69 -0
- package/src/importer/{zip_analyzer.js → zip_analyzer.ts} +44 -18
- package/src/mathlive/{opf_includes.js → opf_includes.ts} +1 -1
- package/src/modules.d.ts +40 -0
- package/src/schema/common/{annotate.js → annotate.ts} +10 -8
- package/src/schema/common/{base.js → base.ts} +12 -10
- package/src/schema/common/{citation.js → citation.ts} +17 -8
- package/src/schema/common/{equation.js → equation.ts} +6 -4
- package/src/schema/common/{figure.js → figure.ts} +43 -23
- package/src/schema/common/{heading.js → heading.ts} +7 -5
- package/src/schema/common/{list.js → list.ts} +15 -13
- package/src/schema/common/{reference.js → reference.ts} +14 -12
- package/src/schema/common/{table.js → table.ts} +16 -14
- package/src/schema/common/track.ts +201 -0
- package/src/schema/const.ts +58 -0
- package/src/schema/{convert.js → convert.ts} +6 -2
- package/src/schema/document/{content.js → content.ts} +22 -20
- package/src/schema/document/{structure.js → structure.ts} +15 -9
- package/src/schema/{export.js → export.ts} +4 -2
- package/src/schema/{footnotes.js → footnotes.ts} +11 -8
- package/src/schema/{footnotes_convert.js → footnotes_convert.ts} +11 -8
- package/src/schema/i18n.ts +601 -0
- package/src/schema/mini_json.ts +60 -0
- package/src/schema/{text.js → text.ts} +6 -2
- package/src/types.ts +314 -0
- package/jest.config.js +0 -24
- package/src/exporter/docx/images.js +0 -101
- package/src/exporter/jats/bibliography.js +0 -183
- package/src/exporter/jats/index.js +0 -92
- package/src/exporter/odt/images.js +0 -115
- package/src/importer/citations.js +0 -129
- package/src/importer/native/get_images.js +0 -76
- /package/src/{index.js → index.ts} +0 -0
- /package/src/schema/common/{index.js → index.ts} +0 -0
- /package/src/schema/document/{index.js → index.ts} +0 -0
- /package/src/schema/{index.js → index.ts} +0 -0
|
@@ -2,9 +2,17 @@ import {escapeText} from "fwtoolkit"
|
|
|
2
2
|
import {BIBLIOGRAPHY_HEADERS} from "../../schema/i18n.js"
|
|
3
3
|
import {textContent} from "../tools/doc_content.js"
|
|
4
4
|
import {xmlDOM} from "../tools/xml.js"
|
|
5
|
+
import type {XMLElement} from "../tools/xml.js"
|
|
6
|
+
import type {XmlZip} from "../tools/xml_zip.js"
|
|
5
7
|
|
|
6
8
|
export class DOCXExporterRender {
|
|
7
|
-
|
|
9
|
+
xml: XmlZip
|
|
10
|
+
|
|
11
|
+
filePath: string | false // "word/document.xml" or "word/document2.xml" in some cases
|
|
12
|
+
ctXML: XMLElement | false
|
|
13
|
+
text: XMLElement | false
|
|
14
|
+
|
|
15
|
+
constructor(xml: XmlZip) {
|
|
8
16
|
this.xml = xml
|
|
9
17
|
|
|
10
18
|
this.filePath = false // "word/document.xml" or "word/document2.xml" in some cases
|
|
@@ -12,7 +20,7 @@ export class DOCXExporterRender {
|
|
|
12
20
|
this.text = false
|
|
13
21
|
}
|
|
14
22
|
|
|
15
|
-
init() {
|
|
23
|
+
init(): Promise<void> {
|
|
16
24
|
return this.xml
|
|
17
25
|
.getXml("[Content_Types].xml")
|
|
18
26
|
.then(ctXML => {
|
|
@@ -21,9 +29,9 @@ export class DOCXExporterRender {
|
|
|
21
29
|
ContentType:
|
|
22
30
|
"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"
|
|
23
31
|
})
|
|
24
|
-
this.filePath =
|
|
25
|
-
|
|
26
|
-
|
|
32
|
+
this.filePath = String(
|
|
33
|
+
documentOverride!.getAttribute("PartName")
|
|
34
|
+
).slice(1)
|
|
27
35
|
return this.xml.getXml(this.filePath)
|
|
28
36
|
})
|
|
29
37
|
.then(xml => {
|
|
@@ -31,20 +39,20 @@ export class DOCXExporterRender {
|
|
|
31
39
|
// Ensure we support the three latest docx feature sets:
|
|
32
40
|
// wp14 (drawing 2010), w14 (word 2010), w15 (word 2012)
|
|
33
41
|
const documentEl = this.text.query("w:document")
|
|
34
|
-
if (!documentEl
|
|
35
|
-
documentEl
|
|
42
|
+
if (!documentEl!.getAttribute("xmlns:wp14")) {
|
|
43
|
+
documentEl!.setAttribute(
|
|
36
44
|
"xmlns:wp14",
|
|
37
45
|
"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing"
|
|
38
46
|
)
|
|
39
47
|
}
|
|
40
|
-
if (!documentEl
|
|
41
|
-
documentEl
|
|
48
|
+
if (!documentEl!.getAttribute("xmlns:w14")) {
|
|
49
|
+
documentEl!.setAttribute(
|
|
42
50
|
"xmlns:w14",
|
|
43
51
|
"http://schemas.microsoft.com/office/word/2010/wordml"
|
|
44
52
|
)
|
|
45
53
|
}
|
|
46
|
-
if (!documentEl
|
|
47
|
-
documentEl
|
|
54
|
+
if (!documentEl!.getAttribute("xmlns:w15")) {
|
|
55
|
+
documentEl!.setAttribute(
|
|
48
56
|
"xmlns:w15",
|
|
49
57
|
"http://schemas.microsoft.com/office/word/2012/wordml"
|
|
50
58
|
)
|
|
@@ -52,19 +60,18 @@ export class DOCXExporterRender {
|
|
|
52
60
|
const ignorable = [
|
|
53
61
|
...new Set(
|
|
54
62
|
["w14", "wp14", "w15"].concat(
|
|
55
|
-
documentEl
|
|
56
|
-
.getAttribute("mc:Ignorable", "")
|
|
63
|
+
String(documentEl!.getAttribute("mc:Ignorable") || "")
|
|
57
64
|
.split(" ")
|
|
58
65
|
.filter(item => item.length)
|
|
59
66
|
)
|
|
60
67
|
)
|
|
61
68
|
]
|
|
62
|
-
documentEl
|
|
69
|
+
documentEl!.setAttribute("mc:Ignorable", ignorable.join(" "))
|
|
63
70
|
return Promise.resolve()
|
|
64
71
|
})
|
|
65
72
|
}
|
|
66
73
|
|
|
67
|
-
parseStructuredTags(block, tag) {
|
|
74
|
+
parseStructuredTags(block: XMLElement, tag: any): void {
|
|
68
75
|
let blockText = block.textContent
|
|
69
76
|
const tagName = tag.title
|
|
70
77
|
|
|
@@ -83,7 +90,7 @@ export class DOCXExporterRender {
|
|
|
83
90
|
const limit = beginStartMatch[1]
|
|
84
91
|
? parseInt(beginStartMatch[1])
|
|
85
92
|
: null
|
|
86
|
-
const beginStart = beginStartMatch.index
|
|
93
|
+
const beginStart = beginStartMatch.index as number
|
|
87
94
|
const beginEnd = beginStart + beginStartMatch[0].length
|
|
88
95
|
|
|
89
96
|
// Find matching {END_tag}
|
|
@@ -122,9 +129,9 @@ export class DOCXExporterRender {
|
|
|
122
129
|
}
|
|
123
130
|
}
|
|
124
131
|
|
|
125
|
-
processLoop(templateXml, items, tagName, limit = null) {
|
|
132
|
+
processLoop(templateXml: string, items: any[], tagName: string, limit: number | null = null): string {
|
|
126
133
|
const effectiveItems = limit !== null ? items.slice(0, limit) : items
|
|
127
|
-
const results = []
|
|
134
|
+
const results: string[] = []
|
|
128
135
|
|
|
129
136
|
effectiveItems.forEach((item, index) => {
|
|
130
137
|
const loopCtx = {
|
|
@@ -178,7 +185,7 @@ export class DOCXExporterRender {
|
|
|
178
185
|
return results.join("")
|
|
179
186
|
}
|
|
180
187
|
|
|
181
|
-
processConditionals(text, ctx) {
|
|
188
|
+
processConditionals(text: string, ctx: any): string {
|
|
182
189
|
let result = text
|
|
183
190
|
let changed = true
|
|
184
191
|
while (changed) {
|
|
@@ -224,14 +231,14 @@ export class DOCXExporterRender {
|
|
|
224
231
|
}
|
|
225
232
|
const innerContent = result.slice(innerStart, pos)
|
|
226
233
|
|
|
227
|
-
const conditions = []
|
|
234
|
+
const conditions: any[] = []
|
|
228
235
|
conditions.push({expr: ifExpr, content: ""})
|
|
229
236
|
|
|
230
237
|
const remaining = innerContent
|
|
231
238
|
let lastIndex = 0
|
|
232
239
|
|
|
233
240
|
const elifRegex = /\{ELIF\(([^)]+)\)\}/g
|
|
234
|
-
let elifMatch
|
|
241
|
+
let elifMatch: RegExpExecArray | null
|
|
235
242
|
while ((elifMatch = elifRegex.exec(remaining)) !== null) {
|
|
236
243
|
conditions[conditions.length - 1].content = remaining.slice(
|
|
237
244
|
lastIndex,
|
|
@@ -245,12 +252,12 @@ export class DOCXExporterRender {
|
|
|
245
252
|
if (elseMatch) {
|
|
246
253
|
conditions[conditions.length - 1].content = remaining.slice(
|
|
247
254
|
lastIndex,
|
|
248
|
-
lastIndex + elseMatch.index
|
|
255
|
+
lastIndex + elseMatch.index!
|
|
249
256
|
)
|
|
250
257
|
conditions.push({
|
|
251
258
|
expr: null,
|
|
252
259
|
content: remaining.slice(
|
|
253
|
-
lastIndex + elseMatch.index + elseMatch[0].length
|
|
260
|
+
lastIndex + elseMatch.index! + elseMatch[0].length
|
|
254
261
|
)
|
|
255
262
|
})
|
|
256
263
|
} else {
|
|
@@ -279,7 +286,7 @@ export class DOCXExporterRender {
|
|
|
279
286
|
return result
|
|
280
287
|
}
|
|
281
288
|
|
|
282
|
-
evaluateExpression(expr, ctx) {
|
|
289
|
+
evaluateExpression(expr: string, ctx: any): any {
|
|
283
290
|
try {
|
|
284
291
|
// Allow explicit tag name references (e.g., authors.count -> ctx.count)
|
|
285
292
|
if (ctx.tagName) {
|
|
@@ -317,7 +324,7 @@ export class DOCXExporterRender {
|
|
|
317
324
|
// Check for unknown identifiers
|
|
318
325
|
const bareIdRegex = /\b[a-zA-Z_]\w*\b/g
|
|
319
326
|
const allowed = ["true", "false", "null", "undefined"]
|
|
320
|
-
let m
|
|
327
|
+
let m: RegExpExecArray | null
|
|
321
328
|
while ((m = bareIdRegex.exec(safeExpr)) !== null) {
|
|
322
329
|
if (!allowed.includes(m[0])) {
|
|
323
330
|
console.warn(
|
|
@@ -343,8 +350,8 @@ export class DOCXExporterRender {
|
|
|
343
350
|
}
|
|
344
351
|
}
|
|
345
352
|
|
|
346
|
-
processMultiBlockStructuredTags(blocks, tags) {
|
|
347
|
-
const tagMap = {}
|
|
353
|
+
processMultiBlockStructuredTags(blocks: XMLElement[], tags: any[]): void {
|
|
354
|
+
const tagMap: Record<string, any> = {}
|
|
348
355
|
tags.forEach(tag => {
|
|
349
356
|
if (tag.title) {
|
|
350
357
|
tagMap[tag.title] = tag
|
|
@@ -425,7 +432,13 @@ export class DOCXExporterRender {
|
|
|
425
432
|
}
|
|
426
433
|
}
|
|
427
434
|
|
|
428
|
-
_replaceMultiBlockLoop(
|
|
435
|
+
_replaceMultiBlockLoop(
|
|
436
|
+
blocks: XMLElement[],
|
|
437
|
+
beginIndex: number,
|
|
438
|
+
endIndex: number,
|
|
439
|
+
tag: any,
|
|
440
|
+
limit: number | null
|
|
441
|
+
): void {
|
|
429
442
|
const tagName = tag.title
|
|
430
443
|
const beginBlock = blocks[beginIndex]
|
|
431
444
|
|
|
@@ -447,7 +460,7 @@ export class DOCXExporterRender {
|
|
|
447
460
|
|
|
448
461
|
const beforeXml = combinedXml.slice(0, beginMatch.index)
|
|
449
462
|
const templateXml = combinedXml.slice(
|
|
450
|
-
beginMatch.index + beginMatch[0].length,
|
|
463
|
+
(beginMatch.index as number) + beginMatch[0].length,
|
|
451
464
|
endPos
|
|
452
465
|
)
|
|
453
466
|
const afterXml = combinedXml.slice(endPos + endTag.length)
|
|
@@ -466,25 +479,33 @@ export class DOCXExporterRender {
|
|
|
466
479
|
const parent = beginBlock.parentElement
|
|
467
480
|
const dom = xmlDOM(`<root>${fullReplacement}</root>`)
|
|
468
481
|
const root = dom.query("root")
|
|
469
|
-
const newBlocks = root
|
|
470
|
-
child =>
|
|
471
|
-
|
|
482
|
+
const newBlocks = root!.children.filter(
|
|
483
|
+
child =>
|
|
484
|
+
(child as XMLElement).tagName === "w:p" ||
|
|
485
|
+
(child as XMLElement).tagName === "w:sectPr"
|
|
486
|
+
) as XMLElement[]
|
|
472
487
|
|
|
473
488
|
// Insert new blocks before begin block
|
|
474
489
|
for (let i = newBlocks.length - 1; i >= 0; i--) {
|
|
475
|
-
parent
|
|
490
|
+
parent!.insertBefore(newBlocks[i], beginBlock)
|
|
476
491
|
}
|
|
477
492
|
|
|
478
493
|
// Remove old blocks
|
|
479
494
|
for (let i = endIndex; i >= beginIndex; i--) {
|
|
480
|
-
parent
|
|
495
|
+
parent!.removeChild(blocks[i])
|
|
481
496
|
}
|
|
482
497
|
|
|
483
498
|
// Update blocks array
|
|
484
499
|
blocks.splice(beginIndex, endIndex - beginIndex + 1, ...newBlocks)
|
|
485
500
|
}
|
|
486
501
|
|
|
487
|
-
_replaceMultiBlockConditional(
|
|
502
|
+
_replaceMultiBlockConditional(
|
|
503
|
+
blocks: XMLElement[],
|
|
504
|
+
ifIndex: number,
|
|
505
|
+
endIndex: number,
|
|
506
|
+
expr: string,
|
|
507
|
+
tagMap: Record<string, any>
|
|
508
|
+
): void {
|
|
488
509
|
const ifBlock = blocks[ifIndex]
|
|
489
510
|
|
|
490
511
|
// Concatenate all blocks from if to endif
|
|
@@ -494,9 +515,12 @@ export class DOCXExporterRender {
|
|
|
494
515
|
}
|
|
495
516
|
|
|
496
517
|
// Determine which tag the expression references
|
|
497
|
-
let ctx = {count: 0, content: []}
|
|
518
|
+
let ctx: any = {count: 0, content: []}
|
|
498
519
|
for (const tagName in tagMap) {
|
|
499
|
-
const safeTagName = tagName.replace(
|
|
520
|
+
const safeTagName = tagName.replace(
|
|
521
|
+
/[.*+?^${}()|[\]\\]/g,
|
|
522
|
+
"\\$&"
|
|
523
|
+
)
|
|
500
524
|
if (new RegExp(`\\b${safeTagName}\\b`).test(expr)) {
|
|
501
525
|
const tag = tagMap[tagName]
|
|
502
526
|
ctx = {
|
|
@@ -521,25 +545,27 @@ export class DOCXExporterRender {
|
|
|
521
545
|
const parent = ifBlock.parentElement
|
|
522
546
|
const dom = xmlDOM(`<root>${processedXml}</root>`)
|
|
523
547
|
const root = dom.query("root")
|
|
524
|
-
const newBlocks = root
|
|
525
|
-
child =>
|
|
526
|
-
|
|
548
|
+
const newBlocks = root!.children.filter(
|
|
549
|
+
child =>
|
|
550
|
+
(child as XMLElement).tagName === "w:p" ||
|
|
551
|
+
(child as XMLElement).tagName === "w:sectPr"
|
|
552
|
+
) as XMLElement[]
|
|
527
553
|
|
|
528
554
|
for (let i = newBlocks.length - 1; i >= 0; i--) {
|
|
529
|
-
parent
|
|
555
|
+
parent!.insertBefore(newBlocks[i], ifBlock)
|
|
530
556
|
}
|
|
531
557
|
|
|
532
558
|
for (let i = endIndex; i >= ifIndex; i--) {
|
|
533
|
-
parent
|
|
559
|
+
parent!.removeChild(blocks[i])
|
|
534
560
|
}
|
|
535
561
|
|
|
536
562
|
blocks.splice(ifIndex, endIndex - ifIndex + 1, ...newBlocks)
|
|
537
563
|
}
|
|
538
564
|
|
|
539
565
|
// Define the tags that are to be looked for in the document
|
|
540
|
-
getTagData(docContent, pmBib, settings) {
|
|
541
|
-
const tags = docContent.content.map(node => {
|
|
542
|
-
const tag = {}
|
|
566
|
+
getTagData(docContent: any, pmBib: any, settings: any): any[] {
|
|
567
|
+
const tags = docContent.content.map((node: any) => {
|
|
568
|
+
const tag: any = {}
|
|
543
569
|
switch (node.type) {
|
|
544
570
|
case "title":
|
|
545
571
|
tag.title = "title"
|
|
@@ -558,7 +584,7 @@ export class DOCXExporterRender {
|
|
|
558
584
|
tag.title = node.attrs.id
|
|
559
585
|
// Return array of structured objects for format with delimiter support
|
|
560
586
|
tag.content = node.content
|
|
561
|
-
? node.content.map(node => {
|
|
587
|
+
? node.content.map((node: any) => {
|
|
562
588
|
const c = node.attrs
|
|
563
589
|
return {
|
|
564
590
|
firstname: c.firstname || "",
|
|
@@ -575,14 +601,14 @@ export class DOCXExporterRender {
|
|
|
575
601
|
tag.title = node.attrs.id
|
|
576
602
|
// Return array of tag strings for format with delimiter support
|
|
577
603
|
tag.content = node.content
|
|
578
|
-
? node.content.map(node => node.attrs.tag)
|
|
604
|
+
? node.content.map((node: any) => node.attrs.tag)
|
|
579
605
|
: []
|
|
580
606
|
break
|
|
581
607
|
}
|
|
582
608
|
return tag
|
|
583
609
|
})
|
|
584
610
|
|
|
585
|
-
let bibliographyContent
|
|
611
|
+
let bibliographyContent: any[]
|
|
586
612
|
if (pmBib && pmBib.content && pmBib.content.length > 0) {
|
|
587
613
|
// Add bibliography heading and mark first/last items
|
|
588
614
|
const firstPmBib = pmBib.content[0]
|
|
@@ -591,9 +617,10 @@ export class DOCXExporterRender {
|
|
|
591
617
|
firstPmBib.attrs.first = true
|
|
592
618
|
lastPmBib.attrs = lastPmBib.attrs || {}
|
|
593
619
|
lastPmBib.attrs.last = true
|
|
620
|
+
const lang = settings.language as string
|
|
594
621
|
const bibliographyHeader =
|
|
595
|
-
settings.bibliography_header[
|
|
596
|
-
BIBLIOGRAPHY_HEADERS[
|
|
622
|
+
(settings.bibliography_header as Record<string, string> | undefined)?.[lang] ||
|
|
623
|
+
(BIBLIOGRAPHY_HEADERS as Record<string, string>)[lang]
|
|
597
624
|
bibliographyContent = [
|
|
598
625
|
{
|
|
599
626
|
type: "bibliography_heading",
|
|
@@ -640,7 +667,7 @@ export class DOCXExporterRender {
|
|
|
640
667
|
title: "@licenses", // The '@' triggers handling as block
|
|
641
668
|
content:
|
|
642
669
|
settings.copyright && settings.copyright.licenses.length
|
|
643
|
-
? settings.copyright.licenses.map(license => ({
|
|
670
|
+
? settings.copyright.licenses.map((license: any) => ({
|
|
644
671
|
type: "paragraph",
|
|
645
672
|
content: [
|
|
646
673
|
{
|
|
@@ -677,16 +704,23 @@ export class DOCXExporterRender {
|
|
|
677
704
|
|
|
678
705
|
// go through document.xml looking for tags and replace them with the given
|
|
679
706
|
// replacements.
|
|
680
|
-
render(
|
|
707
|
+
render(
|
|
708
|
+
docContent: any,
|
|
709
|
+
pmBib: any,
|
|
710
|
+
settings: any,
|
|
711
|
+
richtext: any,
|
|
712
|
+
citations: any
|
|
713
|
+
): void {
|
|
681
714
|
const tags = this.getTagData(docContent, pmBib, settings)
|
|
682
715
|
|
|
683
716
|
// Including global page definition at end
|
|
684
|
-
const
|
|
717
|
+
const textEl = this.text as XMLElement
|
|
718
|
+
const blocks = textEl.queryAll(["w:p", "w:sectPr"])
|
|
685
719
|
|
|
686
720
|
// Process multi-block structured tags first (BEGIN...END across paragraphs)
|
|
687
721
|
this.processMultiBlockStructuredTags(blocks, tags)
|
|
688
722
|
|
|
689
|
-
const currentTags = []
|
|
723
|
+
const currentTags: any[] = []
|
|
690
724
|
blocks.forEach(block => {
|
|
691
725
|
// Assuming there is nothing outside of <w:t>...</w:t>
|
|
692
726
|
const text = block.textContent
|
|
@@ -720,22 +754,22 @@ export class DOCXExporterRender {
|
|
|
720
754
|
if (pageSize && pageMargins) {
|
|
721
755
|
// Not sure if these all need to come together
|
|
722
756
|
let width =
|
|
723
|
-
Number.parseInt(pageSize.getAttribute("w:w")) -
|
|
724
|
-
Number.parseInt(pageMargins.getAttribute("w:right")) -
|
|
725
|
-
Number.parseInt(pageMargins.getAttribute("w:left"))
|
|
757
|
+
Number.parseInt(String(pageSize.getAttribute("w:w"))) -
|
|
758
|
+
Number.parseInt(String(pageMargins.getAttribute("w:right"))) -
|
|
759
|
+
Number.parseInt(String(pageMargins.getAttribute("w:left")))
|
|
726
760
|
const height =
|
|
727
|
-
Number.parseInt(pageSize.getAttribute("w:h")) -
|
|
728
|
-
Number.parseInt(pageMargins.getAttribute("w:bottom")) -
|
|
729
|
-
Number.parseInt(pageMargins.getAttribute("w:top")) -
|
|
730
|
-
Number.parseInt(pageMargins.getAttribute("w:header")) -
|
|
731
|
-
Number.parseInt(pageMargins.getAttribute("w:footer"))
|
|
761
|
+
Number.parseInt(String(pageSize.getAttribute("w:h"))) -
|
|
762
|
+
Number.parseInt(String(pageMargins.getAttribute("w:bottom"))) -
|
|
763
|
+
Number.parseInt(String(pageMargins.getAttribute("w:top"))) -
|
|
764
|
+
Number.parseInt(String(pageMargins.getAttribute("w:header"))) -
|
|
765
|
+
Number.parseInt(String(pageMargins.getAttribute("w:footer")))
|
|
732
766
|
|
|
733
767
|
const colCount = cols
|
|
734
|
-
? Number.parseInt(cols.getAttribute("w:num"))
|
|
768
|
+
? Number.parseInt(String(cols.getAttribute("w:num")))
|
|
735
769
|
: 1
|
|
736
|
-
if (colCount > 1) {
|
|
770
|
+
if (cols && colCount > 1) {
|
|
737
771
|
const colSpace = Number.parseInt(
|
|
738
|
-
cols.getAttribute("w:space")
|
|
772
|
+
String(cols.getAttribute("w:space"))
|
|
739
773
|
)
|
|
740
774
|
width = width - colSpace * (colCount - 1)
|
|
741
775
|
width = width / colCount
|
|
@@ -749,7 +783,7 @@ export class DOCXExporterRender {
|
|
|
749
783
|
}
|
|
750
784
|
}
|
|
751
785
|
})
|
|
752
|
-
tags.forEach(tag => {
|
|
786
|
+
tags.forEach((tag: any) => {
|
|
753
787
|
if (!tag.title) {
|
|
754
788
|
return
|
|
755
789
|
} else if (tag.title[0] === "@") {
|
|
@@ -761,7 +795,7 @@ export class DOCXExporterRender {
|
|
|
761
795
|
}
|
|
762
796
|
|
|
763
797
|
// Render Tags that only exchange inline content
|
|
764
|
-
inlineRender(tag) {
|
|
798
|
+
inlineRender(tag: any): void {
|
|
765
799
|
if (!tag.block) {
|
|
766
800
|
return
|
|
767
801
|
}
|
|
@@ -787,7 +821,7 @@ export class DOCXExporterRender {
|
|
|
787
821
|
|
|
788
822
|
// Process each item with the format string
|
|
789
823
|
const formattedItems = tag.content
|
|
790
|
-
.map(item => {
|
|
824
|
+
.map((item: any) => {
|
|
791
825
|
if (typeof item === "string") {
|
|
792
826
|
// For tags (simple strings)
|
|
793
827
|
return format.replace(/%tag/g, item)
|
|
@@ -802,10 +836,10 @@ export class DOCXExporterRender {
|
|
|
802
836
|
.replace(/%id_value/g, item.id_value || "")
|
|
803
837
|
}
|
|
804
838
|
})
|
|
805
|
-
.filter(s => s.trim() !== "")
|
|
839
|
+
.filter((s: string) => s.trim() !== "")
|
|
806
840
|
|
|
807
841
|
// Handle special delimiters
|
|
808
|
-
let delimiterText = delimiter
|
|
842
|
+
let delimiterText: string = delimiter
|
|
809
843
|
delimiterText = delimiterText.replace(/\\n/g, "\n")
|
|
810
844
|
delimiterText = delimiterText.replace(/\\p/g, "\n\n")
|
|
811
845
|
|
|
@@ -813,7 +847,7 @@ export class DOCXExporterRender {
|
|
|
813
847
|
fullText = blockText.replace(formatRegex, replacement)
|
|
814
848
|
} else {
|
|
815
849
|
// Fall back to simple string replacement (backward compatible)
|
|
816
|
-
let contentStr = tag.content || ""
|
|
850
|
+
let contentStr: any = tag.content || ""
|
|
817
851
|
if (Array.isArray(contentStr)) {
|
|
818
852
|
if (contentStr.length === 0) {
|
|
819
853
|
contentStr = ""
|
|
@@ -822,9 +856,9 @@ export class DOCXExporterRender {
|
|
|
822
856
|
} else {
|
|
823
857
|
// Contributors - backward compatible formatting
|
|
824
858
|
contentStr = contentStr
|
|
825
|
-
.map(item => {
|
|
826
|
-
const nameParts = []
|
|
827
|
-
let affiliation = false
|
|
859
|
+
.map((item: any) => {
|
|
860
|
+
const nameParts: string[] = []
|
|
861
|
+
let affiliation: string | false = false
|
|
828
862
|
if (item.firstname) {
|
|
829
863
|
nameParts.push(item.firstname)
|
|
830
864
|
}
|
|
@@ -842,6 +876,7 @@ export class DOCXExporterRender {
|
|
|
842
876
|
if (affiliation) {
|
|
843
877
|
parts.push(affiliation)
|
|
844
878
|
}
|
|
879
|
+
|
|
845
880
|
if (item.email) {
|
|
846
881
|
parts.push(item.email)
|
|
847
882
|
}
|
|
@@ -859,13 +894,13 @@ export class DOCXExporterRender {
|
|
|
859
894
|
|
|
860
895
|
// Apply the replacement
|
|
861
896
|
const rs = tag.block.queryAll("w:r").reverse()
|
|
862
|
-
let lastR
|
|
897
|
+
let lastR: XMLElement | undefined
|
|
863
898
|
// Remove all <w:r> with text in them (<w:t>).
|
|
864
899
|
// Exclude <w:r> used for other things, like page breaks.
|
|
865
|
-
rs.forEach(r => {
|
|
900
|
+
rs.forEach((r: XMLElement) => {
|
|
866
901
|
if (r.query("w:t")) {
|
|
867
902
|
if (lastR) {
|
|
868
|
-
r.parentElement
|
|
903
|
+
r.parentElement!.removeChild(r)
|
|
869
904
|
} else {
|
|
870
905
|
lastR = r
|
|
871
906
|
}
|
|
@@ -896,17 +931,17 @@ export class DOCXExporterRender {
|
|
|
896
931
|
lastR.innerXML = `<w:t ${textAttr}>${escapeText(fullText)}</w:t>`
|
|
897
932
|
}
|
|
898
933
|
} else {
|
|
899
|
-
lastR.parentElement
|
|
934
|
+
lastR.parentElement!.removeChild(lastR)
|
|
900
935
|
}
|
|
901
936
|
}
|
|
902
937
|
|
|
903
938
|
// Render tags that exchange paragraphs
|
|
904
|
-
blockRender(tag, citations, richtext) {
|
|
939
|
+
blockRender(tag: any, citations: any, richtext: any): void {
|
|
905
940
|
if (!tag.block) {
|
|
906
941
|
return
|
|
907
942
|
}
|
|
908
943
|
const pStyle = tag.block.query("w:pStyle")
|
|
909
|
-
const options = {
|
|
944
|
+
const options: any = {
|
|
910
945
|
dimensions: tag.dimensions,
|
|
911
946
|
citationType: citations.citFm.citationType,
|
|
912
947
|
section: pStyle ? pStyle.getAttribute("w:val") : "Normal",
|
|
@@ -914,7 +949,7 @@ export class DOCXExporterRender {
|
|
|
914
949
|
}
|
|
915
950
|
const outXML = tag.content
|
|
916
951
|
? tag.content
|
|
917
|
-
.map((content, i) =>
|
|
952
|
+
.map((content: any, i: number) =>
|
|
918
953
|
richtext.run(content, options, tag.content[i + 1])
|
|
919
954
|
)
|
|
920
955
|
.join("")
|
|
@@ -922,20 +957,22 @@ export class DOCXExporterRender {
|
|
|
922
957
|
if (!outXML.length) {
|
|
923
958
|
// If there is no content, we need to put in a space to prevent the
|
|
924
959
|
// tag from being removed.
|
|
925
|
-
tag.block.innerXML =
|
|
960
|
+
tag.block.innerXML =
|
|
961
|
+
'<w:r><w:t xml:space="preserve"> </w:t></w:r>'
|
|
926
962
|
return
|
|
927
963
|
}
|
|
928
964
|
const parentElement = tag.block.parentElement
|
|
929
965
|
const dom = xmlDOM(outXML)
|
|
930
|
-
const domPars =
|
|
931
|
-
|
|
966
|
+
const domPars =
|
|
967
|
+
(dom.node["#document"] as XMLElement[] | undefined)?.slice() || [dom]
|
|
968
|
+
domPars.forEach(node => parentElement!.insertBefore(node, tag.block))
|
|
932
969
|
// sectPr contains information about columns, etc. We need to move this
|
|
933
970
|
// to the last paragraph we will be adding.
|
|
934
971
|
const sectPr = tag.block.query("w:sectPr")
|
|
935
972
|
if (sectPr) {
|
|
936
|
-
const pPr = tag.block.previousSibling
|
|
937
|
-
pPr
|
|
973
|
+
const pPr = tag.block.previousSibling!.query("w:pPr")
|
|
974
|
+
pPr!.appendChild(sectPr as unknown as never)
|
|
938
975
|
}
|
|
939
|
-
parentElement
|
|
976
|
+
parentElement!.removeChild(tag.block)
|
|
940
977
|
}
|
|
941
978
|
}
|