@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
|
@@ -0,0 +1,651 @@
|
|
|
1
|
+
import { escapeText } from "fwtoolkit";
|
|
2
|
+
import { BIBLIOGRAPHY_HEADERS } from "../../schema/i18n.js";
|
|
3
|
+
import { textContent } from "../tools/doc_content.js";
|
|
4
|
+
import { xmlDOM } from "../tools/xml.js";
|
|
5
|
+
/**
|
|
6
|
+
* Create Zotero bibliography reference mark name for ODT.
|
|
7
|
+
* @returns Reference mark name
|
|
8
|
+
*/
|
|
9
|
+
export function createOdtBibliographyMark() {
|
|
10
|
+
return "ZOTERO_BIBL CSL_BIBLIOGRAPHY";
|
|
11
|
+
}
|
|
12
|
+
export class ODTExporterRender {
|
|
13
|
+
xml;
|
|
14
|
+
filePath;
|
|
15
|
+
text;
|
|
16
|
+
constructor(xml) {
|
|
17
|
+
this.xml = xml;
|
|
18
|
+
this.filePath = "content.xml";
|
|
19
|
+
this.text = false;
|
|
20
|
+
}
|
|
21
|
+
init() {
|
|
22
|
+
return this.xml.getXml(this.filePath).then(xml => {
|
|
23
|
+
this.text = xml.query("office:text") || false;
|
|
24
|
+
return Promise.resolve();
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
parseStructuredTags(block, tag) {
|
|
28
|
+
let blockText = block.textContent;
|
|
29
|
+
const tagName = tag.title;
|
|
30
|
+
// Check for BEGIN...END loops (with optional limit)
|
|
31
|
+
const beginStartRegex = new RegExp(`\\{BEGIN_${tagName}(?::limit=(\\d+))?\\}`);
|
|
32
|
+
const beginStartMatch = blockText.match(beginStartRegex);
|
|
33
|
+
if (beginStartMatch &&
|
|
34
|
+
tag.content &&
|
|
35
|
+
Array.isArray(tag.content) &&
|
|
36
|
+
tag.content.length > 0) {
|
|
37
|
+
const limit = beginStartMatch[1]
|
|
38
|
+
? parseInt(beginStartMatch[1])
|
|
39
|
+
: null;
|
|
40
|
+
const beginStart = beginStartMatch.index;
|
|
41
|
+
const beginEnd = beginStart + beginStartMatch[0].length;
|
|
42
|
+
// Find matching {END_tag}
|
|
43
|
+
const endTag = `{END_${tagName}}`;
|
|
44
|
+
const endPos = blockText.indexOf(endTag, beginEnd);
|
|
45
|
+
if (endPos === -1) {
|
|
46
|
+
console.warn(`Missing ${endTag} for ${tagName}`);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const templateXml = blockText.slice(beginEnd, endPos);
|
|
50
|
+
const replacementXml = this.processLoop(templateXml, tag.content, tagName, limit);
|
|
51
|
+
const beforeText = blockText.slice(0, beginStart);
|
|
52
|
+
const afterText = blockText.slice(endPos + endTag.length);
|
|
53
|
+
const fullReplacement = beforeText + replacementXml + afterText;
|
|
54
|
+
block.innerXML = fullReplacement;
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
// Check for IF...ELIF...ELSE...ENDIF conditionals
|
|
58
|
+
blockText = this.processConditionals(blockText, {
|
|
59
|
+
tagName,
|
|
60
|
+
count: tag.content ? tag.content.length : 0,
|
|
61
|
+
content: tag.content || []
|
|
62
|
+
});
|
|
63
|
+
if (blockText !== block.textContent) {
|
|
64
|
+
block.innerXML = blockText;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
processLoop(templateXml, items, tagName, limit = null) {
|
|
68
|
+
const effectiveItems = limit !== null ? items.slice(0, limit) : items;
|
|
69
|
+
const results = [];
|
|
70
|
+
effectiveItems.forEach((item, index) => {
|
|
71
|
+
const loopCtx = {
|
|
72
|
+
count: items.length,
|
|
73
|
+
index: index,
|
|
74
|
+
first: index === 0,
|
|
75
|
+
last: index === effectiveItems.length - 1,
|
|
76
|
+
item: item,
|
|
77
|
+
content: [item],
|
|
78
|
+
odd: index % 2 === 1,
|
|
79
|
+
even: index % 2 === 0
|
|
80
|
+
};
|
|
81
|
+
let itemXml = templateXml;
|
|
82
|
+
// Replace field placeholders
|
|
83
|
+
if (typeof item === "string") {
|
|
84
|
+
itemXml = itemXml.replace(/%tag/g, escapeText(item));
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
itemXml = itemXml
|
|
88
|
+
.replace(/\{?%firstname\}?/g, escapeText(item.firstname || ""))
|
|
89
|
+
.replace(/\{?%lastname\}?/g, escapeText(item.lastname || ""))
|
|
90
|
+
.replace(/\{?%institution\}?/g, escapeText(item.institution || ""))
|
|
91
|
+
.replace(/\{?%email\}?/g, escapeText(item.email || ""))
|
|
92
|
+
.replace(/\{?%id_type\}?/g, escapeText(item.id_type || ""))
|
|
93
|
+
.replace(/\{?%id_value\}?/g, escapeText(item.id_value || ""));
|
|
94
|
+
}
|
|
95
|
+
// Handle conditionals inside the loop
|
|
96
|
+
itemXml = this.processConditionals(itemXml, { tagName, ...loopCtx });
|
|
97
|
+
// Handle special delimiters for ODT
|
|
98
|
+
itemXml = itemXml.replace(/\\n/g, "<text:line-break/>");
|
|
99
|
+
itemXml = itemXml.replace(/\\p/g, "</text:p><text:p>");
|
|
100
|
+
results.push(itemXml);
|
|
101
|
+
});
|
|
102
|
+
return results.join("");
|
|
103
|
+
}
|
|
104
|
+
processConditionals(text, ctx) {
|
|
105
|
+
let result = text;
|
|
106
|
+
let changed = true;
|
|
107
|
+
while (changed) {
|
|
108
|
+
changed = false;
|
|
109
|
+
const ifStart = result.indexOf("{IF(");
|
|
110
|
+
if (ifStart === -1) {
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
let depth = 1;
|
|
114
|
+
let pos = ifStart + 4; // skip {IF(
|
|
115
|
+
// Find the closing ) of the IF expression
|
|
116
|
+
while (pos < result.length && result[pos] !== ")") {
|
|
117
|
+
pos++;
|
|
118
|
+
}
|
|
119
|
+
if (pos >= result.length) {
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
pos++; // skip )
|
|
123
|
+
// Now scan for matching {ENDIF}
|
|
124
|
+
while (pos < result.length && depth > 0) {
|
|
125
|
+
if (result.substr(pos, 4) === "{IF(") {
|
|
126
|
+
depth++;
|
|
127
|
+
pos += 4;
|
|
128
|
+
}
|
|
129
|
+
else if (result.substr(pos, 7) === "{ENDIF}") {
|
|
130
|
+
depth--;
|
|
131
|
+
if (depth > 0) {
|
|
132
|
+
pos += 7;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
pos++;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
if (depth === 0) {
|
|
140
|
+
const exprEnd = result.indexOf(")", ifStart + 4);
|
|
141
|
+
const ifExpr = result.slice(ifStart + 4, exprEnd);
|
|
142
|
+
// Skip the closing } of {IF(...)} if present
|
|
143
|
+
let innerStart = exprEnd + 1;
|
|
144
|
+
if (result[innerStart] === "}") {
|
|
145
|
+
innerStart++;
|
|
146
|
+
}
|
|
147
|
+
const innerContent = result.slice(innerStart, pos);
|
|
148
|
+
const conditions = [];
|
|
149
|
+
conditions.push({ expr: ifExpr, content: "" });
|
|
150
|
+
const remaining = innerContent;
|
|
151
|
+
let lastIndex = 0;
|
|
152
|
+
const elifRegex = /\{ELIF\(([^)]+)\)\}/g;
|
|
153
|
+
let elifMatch;
|
|
154
|
+
while ((elifMatch = elifRegex.exec(remaining)) !== null) {
|
|
155
|
+
conditions[conditions.length - 1].content = remaining.slice(lastIndex, elifMatch.index);
|
|
156
|
+
conditions.push({ expr: elifMatch[1], content: "" });
|
|
157
|
+
lastIndex = elifMatch.index + elifMatch[0].length;
|
|
158
|
+
}
|
|
159
|
+
const elseMatch = remaining.slice(lastIndex).match(/\{ELSE\}/);
|
|
160
|
+
if (elseMatch) {
|
|
161
|
+
conditions[conditions.length - 1].content = remaining.slice(lastIndex, lastIndex + elseMatch.index);
|
|
162
|
+
conditions.push({
|
|
163
|
+
expr: null,
|
|
164
|
+
content: remaining.slice(lastIndex + elseMatch.index + elseMatch[0].length)
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
conditions[conditions.length - 1].content =
|
|
169
|
+
remaining.slice(lastIndex);
|
|
170
|
+
}
|
|
171
|
+
let replacement = "";
|
|
172
|
+
for (const cond of conditions) {
|
|
173
|
+
if (cond.expr === null ||
|
|
174
|
+
this.evaluateExpression(cond.expr, ctx)) {
|
|
175
|
+
replacement = cond.content;
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
result =
|
|
180
|
+
result.slice(0, ifStart) +
|
|
181
|
+
replacement +
|
|
182
|
+
result.slice(pos + 7);
|
|
183
|
+
changed = true;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return result;
|
|
187
|
+
}
|
|
188
|
+
evaluateExpression(expr, ctx) {
|
|
189
|
+
try {
|
|
190
|
+
// Allow explicit tag name references (e.g., authors.count -> ctx.count)
|
|
191
|
+
if (ctx.tagName) {
|
|
192
|
+
const safeTagName = ctx.tagName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
193
|
+
expr = expr.replace(new RegExp(`\\b${safeTagName}\\b`, "g"), "ctx");
|
|
194
|
+
}
|
|
195
|
+
// Replace ctx.property accesses with literal values
|
|
196
|
+
const evalExpr = expr.replace(/ctx\.(\w+)(?:\.(\w+))?(?:\[(\d+)\])?/g, (_match, p1, p2, p3) => {
|
|
197
|
+
let val = ctx[p1];
|
|
198
|
+
if (p2 !== undefined && val !== undefined) {
|
|
199
|
+
val = val[p2];
|
|
200
|
+
}
|
|
201
|
+
if (p3 !== undefined && val !== undefined) {
|
|
202
|
+
val = val[parseInt(p3)];
|
|
203
|
+
}
|
|
204
|
+
return JSON.stringify(val);
|
|
205
|
+
});
|
|
206
|
+
// Remove string literals before character check
|
|
207
|
+
const safeExpr = evalExpr.replace(/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g, '""');
|
|
208
|
+
// Check for unknown identifiers
|
|
209
|
+
const bareIdRegex = /\b[a-zA-Z_]\w*\b/g;
|
|
210
|
+
const allowed = ["true", "false", "null", "undefined"];
|
|
211
|
+
let m;
|
|
212
|
+
while ((m = bareIdRegex.exec(safeExpr)) !== null) {
|
|
213
|
+
if (!allowed.includes(m[0])) {
|
|
214
|
+
console.warn("Unknown identifier in expression:", m[0], "expression:", expr);
|
|
215
|
+
return false;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
// Check for unsafe characters
|
|
219
|
+
if (/[^ \t\n\r0-9a-zA-Z_\.\+\-*\/%==<>!&|()\[\]]/.test(safeExpr)) {
|
|
220
|
+
console.warn("Unsafe characters in expression:", expr);
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
return new Function(`return (${evalExpr})`)();
|
|
224
|
+
}
|
|
225
|
+
catch (e) {
|
|
226
|
+
console.warn("Error evaluating expression:", expr, e);
|
|
227
|
+
return false;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
// Define the tags that are to be looked for in the document
|
|
231
|
+
getTagData(docContent, pmBib, settings) {
|
|
232
|
+
const tags = docContent.content.map((node) => {
|
|
233
|
+
const tag = {};
|
|
234
|
+
switch (node.type) {
|
|
235
|
+
case "title":
|
|
236
|
+
tag.title = "title";
|
|
237
|
+
tag.content = textContent(node);
|
|
238
|
+
break;
|
|
239
|
+
case "heading_part":
|
|
240
|
+
tag.title = node.attrs.id;
|
|
241
|
+
tag.content = textContent(node);
|
|
242
|
+
break;
|
|
243
|
+
case "table_part":
|
|
244
|
+
case "richtext_part":
|
|
245
|
+
tag.title = `@${node.attrs.id}`;
|
|
246
|
+
tag.content = node.content;
|
|
247
|
+
break;
|
|
248
|
+
case "contributors_part":
|
|
249
|
+
tag.title = node.attrs.id;
|
|
250
|
+
// Return array of structured objects for format with delimiter support
|
|
251
|
+
tag.content = node.content
|
|
252
|
+
? node.content.map((node) => {
|
|
253
|
+
const c = node.attrs;
|
|
254
|
+
return {
|
|
255
|
+
firstname: c.firstname || "",
|
|
256
|
+
lastname: c.lastname || "",
|
|
257
|
+
institution: c.institution || "",
|
|
258
|
+
email: c.email || "",
|
|
259
|
+
id_type: c.id_type || "",
|
|
260
|
+
id_value: c.id_value || ""
|
|
261
|
+
};
|
|
262
|
+
})
|
|
263
|
+
: [];
|
|
264
|
+
break;
|
|
265
|
+
case "tags_part":
|
|
266
|
+
tag.title = node.attrs.id;
|
|
267
|
+
// Return array of tag strings for format with delimiter support
|
|
268
|
+
tag.content = node.content
|
|
269
|
+
? node.content.map((node) => node.attrs.tag)
|
|
270
|
+
: [];
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
return tag;
|
|
274
|
+
});
|
|
275
|
+
const lang = settings.language;
|
|
276
|
+
const bibliographyHeader = settings.bibliography_header?.[lang] ||
|
|
277
|
+
BIBLIOGRAPHY_HEADERS[lang];
|
|
278
|
+
tags.push({
|
|
279
|
+
title: "@bibliography", // The '@' triggers handling as block
|
|
280
|
+
content: pmBib
|
|
281
|
+
? [
|
|
282
|
+
{
|
|
283
|
+
type: "bibliography_heading",
|
|
284
|
+
content: [{ type: "text", text: bibliographyHeader }]
|
|
285
|
+
},
|
|
286
|
+
pmBib
|
|
287
|
+
]
|
|
288
|
+
: [{ type: "paragraph", content: [{ type: "text", text: " " }] }]
|
|
289
|
+
});
|
|
290
|
+
tags.push({
|
|
291
|
+
title: "@copyright", // The '@' triggers handling as block
|
|
292
|
+
content: settings.copyright && settings.copyright.holder
|
|
293
|
+
? [
|
|
294
|
+
{
|
|
295
|
+
type: "paragraph",
|
|
296
|
+
content: [
|
|
297
|
+
{
|
|
298
|
+
type: "text",
|
|
299
|
+
text: `© ${settings.copyright.year ? settings.copyright.year : new Date().getFullYear()} ${settings.copyright.holder}`
|
|
300
|
+
}
|
|
301
|
+
]
|
|
302
|
+
}
|
|
303
|
+
]
|
|
304
|
+
: [
|
|
305
|
+
{
|
|
306
|
+
type: "paragraph",
|
|
307
|
+
content: [{ type: "text", text: " " }]
|
|
308
|
+
}
|
|
309
|
+
]
|
|
310
|
+
});
|
|
311
|
+
tags.push({
|
|
312
|
+
title: "@licenses", // The '@' triggers handling as block
|
|
313
|
+
content: settings.copyright && settings.copyright.licenses.length
|
|
314
|
+
? settings.copyright.licenses.map((license) => ({
|
|
315
|
+
type: "paragraph",
|
|
316
|
+
content: [
|
|
317
|
+
{
|
|
318
|
+
type: "text",
|
|
319
|
+
marks: [
|
|
320
|
+
{
|
|
321
|
+
type: "link",
|
|
322
|
+
attrs: {
|
|
323
|
+
href: license.url,
|
|
324
|
+
title: license.url
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
],
|
|
328
|
+
text: license.title
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
type: "text",
|
|
332
|
+
text: license.start
|
|
333
|
+
? ` (${license.start})`
|
|
334
|
+
: ""
|
|
335
|
+
}
|
|
336
|
+
]
|
|
337
|
+
}))
|
|
338
|
+
: [
|
|
339
|
+
{
|
|
340
|
+
type: "paragraph",
|
|
341
|
+
content: [{ type: "text", text: " " }]
|
|
342
|
+
}
|
|
343
|
+
]
|
|
344
|
+
});
|
|
345
|
+
return tags;
|
|
346
|
+
}
|
|
347
|
+
processMultiBlockStructuredTags(blocks, tags) {
|
|
348
|
+
const tagMap = {};
|
|
349
|
+
tags.forEach(tag => {
|
|
350
|
+
if (tag.title) {
|
|
351
|
+
tagMap[tag.title] = tag;
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
// Process from end to start to avoid index shifting issues
|
|
355
|
+
for (let i = blocks.length - 1; i >= 0; i--) {
|
|
356
|
+
const block = blocks[i];
|
|
357
|
+
const text = block.textContent;
|
|
358
|
+
// Check for multi-block BEGIN...END loops
|
|
359
|
+
for (const tag of tags) {
|
|
360
|
+
if (!tag.title || !tag.content || !Array.isArray(tag.content)) {
|
|
361
|
+
continue;
|
|
362
|
+
}
|
|
363
|
+
const tagName = tag.title;
|
|
364
|
+
const beginRegex = new RegExp(`\\{BEGIN_${tagName}(?::limit=(\\d+))?\\}`);
|
|
365
|
+
const beginMatch = text.match(beginRegex);
|
|
366
|
+
if (!beginMatch) {
|
|
367
|
+
continue;
|
|
368
|
+
}
|
|
369
|
+
// Find matching END in a later block
|
|
370
|
+
let endIndex = -1;
|
|
371
|
+
for (let j = i + 1; j < blocks.length; j++) {
|
|
372
|
+
if (blocks[j].textContent.includes(`{END_${tagName}}`)) {
|
|
373
|
+
endIndex = j;
|
|
374
|
+
break;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
if (endIndex === -1 || endIndex === i) {
|
|
378
|
+
continue;
|
|
379
|
+
}
|
|
380
|
+
// Found multi-block loop - process it
|
|
381
|
+
const limit = beginMatch[1] ? parseInt(beginMatch[1]) : null;
|
|
382
|
+
this._replaceMultiBlockLoop(blocks, i, endIndex, tag, limit);
|
|
383
|
+
i = Math.min(i, blocks.length - 1);
|
|
384
|
+
break; // Only process one loop per block per iteration
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
// Process multi-block conditionals from end to start
|
|
388
|
+
for (let i = blocks.length - 1; i >= 0; i--) {
|
|
389
|
+
const block = blocks[i];
|
|
390
|
+
const text = block.textContent;
|
|
391
|
+
const ifMatch = text.match(/\{IF\(([^)]+)\)\}/);
|
|
392
|
+
if (!ifMatch) {
|
|
393
|
+
continue;
|
|
394
|
+
}
|
|
395
|
+
// Find matching ENDIF in a later block
|
|
396
|
+
let endIndex = -1;
|
|
397
|
+
for (let j = i + 1; j < blocks.length; j++) {
|
|
398
|
+
if (/\{ENDIF\}/.test(blocks[j].textContent)) {
|
|
399
|
+
endIndex = j;
|
|
400
|
+
break;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
if (endIndex === -1 || endIndex === i) {
|
|
404
|
+
continue;
|
|
405
|
+
}
|
|
406
|
+
this._replaceMultiBlockConditional(blocks, i, endIndex, ifMatch[1], tagMap);
|
|
407
|
+
i = Math.min(i, blocks.length - 1);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
_replaceMultiBlockLoop(blocks, beginIndex, endIndex, tag, limit) {
|
|
411
|
+
const tagName = tag.title;
|
|
412
|
+
const beginBlock = blocks[beginIndex];
|
|
413
|
+
// Concatenate all blocks from begin to end
|
|
414
|
+
let combinedXml = "";
|
|
415
|
+
for (let i = beginIndex; i <= endIndex; i++) {
|
|
416
|
+
combinedXml += blocks[i].toString();
|
|
417
|
+
}
|
|
418
|
+
// Find the BEGIN and END tags in the combined XML
|
|
419
|
+
const beginRegex = new RegExp(`\\{BEGIN_${tagName}(?::limit=\\d+)?\\}`);
|
|
420
|
+
const beginMatch = combinedXml.match(beginRegex);
|
|
421
|
+
const endTag = `{END_${tagName}}`;
|
|
422
|
+
const endPos = combinedXml.indexOf(endTag);
|
|
423
|
+
if (!beginMatch || endPos === -1) {
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
const beforeXml = combinedXml.slice(0, beginMatch.index);
|
|
427
|
+
const templateXml = combinedXml.slice(beginMatch.index + beginMatch[0].length, endPos);
|
|
428
|
+
const afterXml = combinedXml.slice(endPos + endTag.length);
|
|
429
|
+
// Decode > so expressions like >= work in nested conditionals
|
|
430
|
+
const decodedTemplateXml = templateXml.replace(/>/g, ">");
|
|
431
|
+
const replacementXml = this.processLoop(decodedTemplateXml, tag.content, tagName, limit);
|
|
432
|
+
const fullReplacement = beforeXml + replacementXml + afterXml;
|
|
433
|
+
// Parse replacement
|
|
434
|
+
const parent = beginBlock.parentElement;
|
|
435
|
+
const dom = xmlDOM(`<root>${fullReplacement}</root>`);
|
|
436
|
+
const root = dom.query("root");
|
|
437
|
+
const newBlocks = root.children.filter(child => child.tagName === "text:p" ||
|
|
438
|
+
child.tagName === "text:h");
|
|
439
|
+
// Insert new blocks before begin block
|
|
440
|
+
for (let i = newBlocks.length - 1; i >= 0; i--) {
|
|
441
|
+
parent.insertBefore(newBlocks[i], beginBlock);
|
|
442
|
+
}
|
|
443
|
+
// Remove old blocks
|
|
444
|
+
for (let i = endIndex; i >= beginIndex; i--) {
|
|
445
|
+
parent.removeChild(blocks[i]);
|
|
446
|
+
}
|
|
447
|
+
// Update blocks array
|
|
448
|
+
blocks.splice(beginIndex, endIndex - beginIndex + 1, ...newBlocks);
|
|
449
|
+
}
|
|
450
|
+
_replaceMultiBlockConditional(blocks, ifIndex, endIndex, expr, tagMap) {
|
|
451
|
+
const ifBlock = blocks[ifIndex];
|
|
452
|
+
// Concatenate all blocks from if to endif
|
|
453
|
+
let combinedXml = "";
|
|
454
|
+
for (let i = ifIndex; i <= endIndex; i++) {
|
|
455
|
+
combinedXml += blocks[i].toString();
|
|
456
|
+
}
|
|
457
|
+
// Determine which tag the expression references
|
|
458
|
+
let ctx = { count: 0, content: [] };
|
|
459
|
+
for (const tagName in tagMap) {
|
|
460
|
+
const safeTagName = tagName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
461
|
+
if (new RegExp(`\\b${safeTagName}\\b`).test(expr)) {
|
|
462
|
+
const tag = tagMap[tagName];
|
|
463
|
+
ctx = {
|
|
464
|
+
tagName: tag.title,
|
|
465
|
+
count: tag.content ? tag.content.length : 0,
|
|
466
|
+
content: tag.content || []
|
|
467
|
+
};
|
|
468
|
+
break;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
// Decode > so expressions like >= work in conditionals
|
|
472
|
+
const decodedXml = combinedXml.replace(/>/g, ">");
|
|
473
|
+
// Process conditionals on the combined XML
|
|
474
|
+
const processedXml = this.processConditionals(decodedXml, ctx);
|
|
475
|
+
if (processedXml === combinedXml) {
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
// Parse and replace
|
|
479
|
+
const parent = ifBlock.parentElement;
|
|
480
|
+
const dom = xmlDOM(`<root>${processedXml}</root>`);
|
|
481
|
+
const root = dom.query("root");
|
|
482
|
+
const newBlocks = root.children.filter(child => child.tagName === "text:p" ||
|
|
483
|
+
child.tagName === "text:h");
|
|
484
|
+
for (let i = newBlocks.length - 1; i >= 0; i--) {
|
|
485
|
+
parent.insertBefore(newBlocks[i], ifBlock);
|
|
486
|
+
}
|
|
487
|
+
for (let i = endIndex; i >= ifIndex; i--) {
|
|
488
|
+
parent.removeChild(blocks[i]);
|
|
489
|
+
}
|
|
490
|
+
blocks.splice(ifIndex, endIndex - ifIndex + 1, ...newBlocks);
|
|
491
|
+
}
|
|
492
|
+
// go through content.xml looking for tags and replace them with the given
|
|
493
|
+
// replacements.
|
|
494
|
+
render(docContent, pmBib, settings, richtext, citations) {
|
|
495
|
+
const tags = this.getTagData(docContent, pmBib, settings);
|
|
496
|
+
const textEl = this.text;
|
|
497
|
+
const textBlocks = textEl.queryAll(["text:p", "text:h"]);
|
|
498
|
+
// Process multi-block structured tags first (BEGIN...END across paragraphs)
|
|
499
|
+
this.processMultiBlockStructuredTags(textBlocks, tags);
|
|
500
|
+
textBlocks.forEach(block => {
|
|
501
|
+
if (block.parentElement?.tagName === "text:deletion") {
|
|
502
|
+
// Inside of tracked changes deletion, don't do anything
|
|
503
|
+
return;
|
|
504
|
+
}
|
|
505
|
+
const text = block.textContent;
|
|
506
|
+
tags.forEach((tag) => {
|
|
507
|
+
const tagString = tag.title;
|
|
508
|
+
const hasInlineTag = text.includes(`{${tagString}}`) ||
|
|
509
|
+
text.includes(`{${tagString}:format=`);
|
|
510
|
+
const hasBeginTag = text.includes(`{BEGIN_${tagString}}`);
|
|
511
|
+
const hasIfTag = text.includes(`{IF(${tagString}.`) ||
|
|
512
|
+
text.includes(`{IF(ctx.`);
|
|
513
|
+
if (hasInlineTag || hasBeginTag || hasIfTag) {
|
|
514
|
+
tag.block = block;
|
|
515
|
+
if (hasInlineTag && tag.title[0] === "@") {
|
|
516
|
+
this.blockRender(tag, richtext, citations);
|
|
517
|
+
}
|
|
518
|
+
else if (hasInlineTag && tag.title[0] !== "@") {
|
|
519
|
+
this.inlineRender(tag);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
});
|
|
523
|
+
// Parse structured tags (BEGIN...END and IF...ENDIF)
|
|
524
|
+
tags.forEach((tag) => {
|
|
525
|
+
if (tag.block) {
|
|
526
|
+
this.parseStructuredTags(tag.block, tag);
|
|
527
|
+
}
|
|
528
|
+
});
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
// Render Tags that only exchange inline content
|
|
532
|
+
inlineRender(tag) {
|
|
533
|
+
const blockText = tag.block.textContent;
|
|
534
|
+
const tagString = tag.title;
|
|
535
|
+
if (!blockText.includes(`{${tag.title}`)) {
|
|
536
|
+
// No inline tag present - structured tags only
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
539
|
+
// Check for format string with delimiter: {tag:format=%firstname|; }
|
|
540
|
+
const formatRegex = new RegExp(`\\{${tagString}:format=([^|]+)\\|?([^}]*)?\\}`);
|
|
541
|
+
const formatMatch = blockText.match(formatRegex);
|
|
542
|
+
let fullText = "";
|
|
543
|
+
if (formatMatch && tag.content && Array.isArray(tag.content)) {
|
|
544
|
+
// Find format string and delimiter
|
|
545
|
+
const [, format, delimiter = "; "] = formatMatch;
|
|
546
|
+
// Process each item with the format string
|
|
547
|
+
const formattedItems = tag.content
|
|
548
|
+
.map((item) => {
|
|
549
|
+
if (typeof item === "string") {
|
|
550
|
+
// For tags (simple strings)
|
|
551
|
+
return format.replace(/%tag/g, item);
|
|
552
|
+
}
|
|
553
|
+
else {
|
|
554
|
+
// For contributors (objects)
|
|
555
|
+
return format
|
|
556
|
+
.replace(/%firstname/g, item.firstname || "")
|
|
557
|
+
.replace(/%lastname/g, item.lastname || "")
|
|
558
|
+
.replace(/%institution/g, item.institution || "")
|
|
559
|
+
.replace(/%email/g, item.email || "")
|
|
560
|
+
.replace(/%id_type/g, item.id_type || "")
|
|
561
|
+
.replace(/%id_value/g, item.id_value || "");
|
|
562
|
+
}
|
|
563
|
+
})
|
|
564
|
+
.filter((s) => s.trim() !== "");
|
|
565
|
+
// Handle special delimiters for ODT
|
|
566
|
+
let delimiterXml = delimiter;
|
|
567
|
+
delimiterXml = delimiterXml.replace(/\\n/g, "<text:line-break/>");
|
|
568
|
+
delimiterXml = delimiterXml.replace(/\\p/g, "<text:line-break/><text:line-break/>");
|
|
569
|
+
const replacement = formattedItems.join(delimiterXml);
|
|
570
|
+
fullText = blockText.replace(formatRegex, replacement);
|
|
571
|
+
}
|
|
572
|
+
else {
|
|
573
|
+
// Fall back to simple string replacement (backward compatible)
|
|
574
|
+
let contentStr = tag.content || "";
|
|
575
|
+
if (Array.isArray(contentStr)) {
|
|
576
|
+
if (contentStr.length === 0) {
|
|
577
|
+
contentStr = "";
|
|
578
|
+
}
|
|
579
|
+
else if (typeof contentStr[0] === "string") {
|
|
580
|
+
contentStr = contentStr.join(", ");
|
|
581
|
+
}
|
|
582
|
+
else {
|
|
583
|
+
// Contributors - backward compatible formatting
|
|
584
|
+
contentStr = contentStr
|
|
585
|
+
.map((item) => {
|
|
586
|
+
const nameParts = [];
|
|
587
|
+
let affiliation = false;
|
|
588
|
+
if (item.firstname) {
|
|
589
|
+
nameParts.push(item.firstname);
|
|
590
|
+
}
|
|
591
|
+
if (item.lastname) {
|
|
592
|
+
nameParts.push(item.lastname);
|
|
593
|
+
}
|
|
594
|
+
if (item.institution) {
|
|
595
|
+
if (nameParts.length) {
|
|
596
|
+
affiliation = item.institution;
|
|
597
|
+
}
|
|
598
|
+
else {
|
|
599
|
+
nameParts.push(item.institution);
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
const parts = [nameParts.join(" ")];
|
|
603
|
+
if (affiliation) {
|
|
604
|
+
parts.push(affiliation);
|
|
605
|
+
}
|
|
606
|
+
if (item.email) {
|
|
607
|
+
parts.push(item.email);
|
|
608
|
+
}
|
|
609
|
+
if (item.id_type && item.id_value) {
|
|
610
|
+
parts.push(`${item.id_type}: ${item.id_value}`);
|
|
611
|
+
}
|
|
612
|
+
return parts.join(", ");
|
|
613
|
+
})
|
|
614
|
+
.join("; ");
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
const texts = blockText.split(`{${tagString}}`);
|
|
618
|
+
fullText = texts[0] + contentStr + texts[1];
|
|
619
|
+
}
|
|
620
|
+
// Escape text but restore ODT XML line break tags
|
|
621
|
+
fullText = escapeText(fullText).replace(/<text:line-break\/>/g, "<text:line-break/>");
|
|
622
|
+
tag.block.innerXML = fullText.replace(/^\s+|\s+$/g, match => "<text:s/>".repeat(match.length));
|
|
623
|
+
}
|
|
624
|
+
// Render tags that exchange text blocks
|
|
625
|
+
blockRender(tag, richtext, citations) {
|
|
626
|
+
const section = tag.block.hasAttribute("text:style-name")
|
|
627
|
+
? tag.block.getAttribute("text:style-name")
|
|
628
|
+
: "Text_20_body";
|
|
629
|
+
const outXML = tag.content
|
|
630
|
+
? tag.content
|
|
631
|
+
.map((content, contentIndex) => richtext.run(content, {
|
|
632
|
+
citationType: citations.citFm.citationType,
|
|
633
|
+
section,
|
|
634
|
+
tag: tag.title.slice(1)
|
|
635
|
+
}, tag, contentIndex))
|
|
636
|
+
.join("")
|
|
637
|
+
: "";
|
|
638
|
+
if (!outXML.length) {
|
|
639
|
+
// If there is no content, we need to put in a space to prevent the
|
|
640
|
+
// tag from being removed by LibreOffice.
|
|
641
|
+
tag.block.innerXML = "<text:s/>";
|
|
642
|
+
return;
|
|
643
|
+
}
|
|
644
|
+
const parentElement = tag.block.parentElement;
|
|
645
|
+
const dom = xmlDOM(outXML);
|
|
646
|
+
const domPars = dom.node["#document"]?.slice() || [dom];
|
|
647
|
+
domPars.forEach(node => parentElement.insertBefore(node, tag.block));
|
|
648
|
+
parentElement.removeChild(tag.block);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
//# sourceMappingURL=render.js.map
|