@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
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const numberToRoman = number => {
|
|
1
|
+
const numberToRoman = (number: number): string => {
|
|
2
2
|
let roman = ""
|
|
3
|
-
const romanNumList = {
|
|
3
|
+
const romanNumList: Record<string, number> = {
|
|
4
4
|
M: 1000,
|
|
5
5
|
CM: 900,
|
|
6
6
|
D: 500,
|
|
@@ -15,7 +15,7 @@ const numberToRoman = number => {
|
|
|
15
15
|
IV: 4,
|
|
16
16
|
I: 1
|
|
17
17
|
}
|
|
18
|
-
let a
|
|
18
|
+
let a: number
|
|
19
19
|
for (const key in romanNumList) {
|
|
20
20
|
a = Math.floor(number / romanNumList[key])
|
|
21
21
|
if (a >= 0) {
|
|
@@ -28,10 +28,10 @@ const numberToRoman = number => {
|
|
|
28
28
|
return roman
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
const numberToAlpha = number => {
|
|
31
|
+
const numberToAlpha = (number: number): string => {
|
|
32
32
|
const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
33
33
|
let alpha = ""
|
|
34
|
-
let a
|
|
34
|
+
let a: number
|
|
35
35
|
for (let i = 0; i < number; i++) {
|
|
36
36
|
a = i % 26
|
|
37
37
|
alpha += alphabet[a]
|
|
@@ -39,7 +39,10 @@ const numberToAlpha = number => {
|
|
|
39
39
|
return alpha
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
export const displayNumber = (
|
|
42
|
+
export const displayNumber = (
|
|
43
|
+
number: number,
|
|
44
|
+
system?: string
|
|
45
|
+
): string | number => {
|
|
43
46
|
if (system === "roman") {
|
|
44
47
|
return numberToRoman(number)
|
|
45
48
|
}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import {escapeText} from "fwtoolkit"
|
|
2
|
+
|
|
3
|
+
import type {BibDBEntry, FidusNode} from "../../types.js"
|
|
4
|
+
import {convertTexts} from "./text.js"
|
|
5
|
+
|
|
6
|
+
// This list is based on values listed at https://jats.nlm.nih.gov/archiving/tag-library/1.2/attribute/publication-type.html
|
|
7
|
+
// And the advice given here: https://jats4r.org/citations/#recommendation
|
|
8
|
+
const PUBLICATION_TYPES: Record<string, string> = {
|
|
9
|
+
article: "journal",
|
|
10
|
+
"article-journal": "journal",
|
|
11
|
+
"article-magazine": "journal",
|
|
12
|
+
"article-newspaper": "journal",
|
|
13
|
+
book: "book",
|
|
14
|
+
bookinbook: "book",
|
|
15
|
+
booklet: "book",
|
|
16
|
+
chapter: "book",
|
|
17
|
+
collection: "standard",
|
|
18
|
+
dataset: "dataset",
|
|
19
|
+
"entry-dictionary": "standard",
|
|
20
|
+
"entry-encyclopedia": "standard",
|
|
21
|
+
inbook: "book",
|
|
22
|
+
incollection: "book",
|
|
23
|
+
inproceedings: "standard",
|
|
24
|
+
inreference: "standard",
|
|
25
|
+
manual: "book",
|
|
26
|
+
misc: "standard",
|
|
27
|
+
mvbook: "book",
|
|
28
|
+
mvcollection: "standard",
|
|
29
|
+
mvproceedings: "book",
|
|
30
|
+
mvreference: "standard",
|
|
31
|
+
online: "standard",
|
|
32
|
+
patent: "patent",
|
|
33
|
+
periodical: "book",
|
|
34
|
+
post: "standards",
|
|
35
|
+
"post-weblog": "standard",
|
|
36
|
+
proceedings: "book",
|
|
37
|
+
reference: "standard",
|
|
38
|
+
report: "report",
|
|
39
|
+
review: "review",
|
|
40
|
+
suppbook: "book",
|
|
41
|
+
suppcollection: "book",
|
|
42
|
+
suppperiodical: "journal",
|
|
43
|
+
thesis: "standard",
|
|
44
|
+
unpublished: "standard"
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface NameLike {
|
|
48
|
+
literal?: string
|
|
49
|
+
family?: string
|
|
50
|
+
given?: string
|
|
51
|
+
prefix?: string
|
|
52
|
+
suffix?: string
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function jatsBib(bib: BibDBEntry, id: number): string {
|
|
56
|
+
let start = "",
|
|
57
|
+
end = ""
|
|
58
|
+
start += `<ref id="ref-${id}">`
|
|
59
|
+
end = "</ref>" + end
|
|
60
|
+
// Type
|
|
61
|
+
const publicationType = PUBLICATION_TYPES[bib.bib_type || ""] ?? "standard"
|
|
62
|
+
start += `<element-citation publication-type="${publicationType}">`
|
|
63
|
+
end = "</element-citation>" + end
|
|
64
|
+
|
|
65
|
+
const fields = (bib.fields || {}) as Record<string, unknown>
|
|
66
|
+
|
|
67
|
+
// authors
|
|
68
|
+
if (fields.author && Array.isArray(fields.author) && fields.author.length) {
|
|
69
|
+
start += `<person-group person-group-type="author">${fields.author
|
|
70
|
+
.map((author: unknown) => {
|
|
71
|
+
const a = author as NameLike
|
|
72
|
+
if (a.literal) {
|
|
73
|
+
return `<collab>${convertTexts((a.literal) as unknown as FidusNode[])}</collab>`
|
|
74
|
+
}
|
|
75
|
+
let nameStart = `<name><surname>${convertTexts((a.family || "") as unknown as FidusNode[])}</surname> <given-names>${convertTexts((a.given || "") as unknown as FidusNode[])}</given-names>`
|
|
76
|
+
if (a.prefix && a.prefix.length) {
|
|
77
|
+
nameStart += ` <prefix>${convertTexts((a.prefix) as unknown as FidusNode[])}</prefix>`
|
|
78
|
+
}
|
|
79
|
+
if (a.suffix && a.suffix.length) {
|
|
80
|
+
nameStart += ` <suffix>${convertTexts((a.suffix) as unknown as FidusNode[])}</suffix>`
|
|
81
|
+
}
|
|
82
|
+
const nameEnd = "</name>"
|
|
83
|
+
return nameStart + nameEnd
|
|
84
|
+
})
|
|
85
|
+
.join(", ")}</person-group>`
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// title && container title
|
|
89
|
+
if (fields.title) {
|
|
90
|
+
if (
|
|
91
|
+
fields.shortjournal ||
|
|
92
|
+
fields.booktitle ||
|
|
93
|
+
fields.journaltitle
|
|
94
|
+
) {
|
|
95
|
+
start += `<source>${convertTexts((String(fields.shortjournal || fields.booktitle || fields.journaltitle) as unknown as FidusNode[]))}</source>`
|
|
96
|
+
start += `<article-title>${convertTexts((String(fields.title) as unknown as FidusNode[]))}</article-title>`
|
|
97
|
+
} else {
|
|
98
|
+
start += `<source>${convertTexts((String(fields.title) as unknown as FidusNode[]))}</source>`
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// editors
|
|
103
|
+
if (fields.editor && Array.isArray(fields.editor) && fields.editor.length) {
|
|
104
|
+
start += `<person-group person-group-type="editor">${fields.editor
|
|
105
|
+
.map((editor: unknown) => {
|
|
106
|
+
const e = editor as NameLike
|
|
107
|
+
if (e.literal) {
|
|
108
|
+
return `<collab>${convertTexts((e.literal) as unknown as FidusNode[])}</collab>`
|
|
109
|
+
}
|
|
110
|
+
let nameStart = `<name><surname>${convertTexts((e.family || "") as unknown as FidusNode[])}</surname> <given-names>${convertTexts((e.given || "") as unknown as FidusNode[])}</given-names>`
|
|
111
|
+
const nameEnd = "</name>"
|
|
112
|
+
if (e.prefix && e.prefix.length) {
|
|
113
|
+
nameStart += ` <prefix>${convertTexts((e.prefix) as unknown as FidusNode[])}</prefix>`
|
|
114
|
+
}
|
|
115
|
+
if (e.suffix && e.suffix.length) {
|
|
116
|
+
nameStart += ` <suffix>${convertTexts((e.suffix) as unknown as FidusNode[])}</suffix>`
|
|
117
|
+
}
|
|
118
|
+
return nameStart + nameEnd
|
|
119
|
+
})
|
|
120
|
+
.join(", ")}</person-group>`
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// publisher
|
|
124
|
+
if (fields.publisher && Array.isArray(fields.publisher) && fields.publisher.length) {
|
|
125
|
+
start += fields.publisher
|
|
126
|
+
.map(
|
|
127
|
+
publisher =>
|
|
128
|
+
`<publisher-name>${convertTexts((String(publisher) as unknown as FidusNode[]))}</publisher-name>`
|
|
129
|
+
)
|
|
130
|
+
.join("")
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// location
|
|
134
|
+
if (fields.location && Array.isArray(fields.location) && fields.location.length) {
|
|
135
|
+
start += fields.location
|
|
136
|
+
.map(
|
|
137
|
+
location =>
|
|
138
|
+
`<publisher-loc>${convertTexts((String(location) as unknown as FidusNode[]))}</publisher-loc>`
|
|
139
|
+
)
|
|
140
|
+
.join("")
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// date
|
|
144
|
+
if (fields.date && String(fields.date).length) {
|
|
145
|
+
const date = String(fields.date)
|
|
146
|
+
const dateParts = date.split("-")
|
|
147
|
+
start += `<date iso-8601-date="${date}" date-type="published">${
|
|
148
|
+
dateParts.length > 2 ? `<day>${dateParts[2]}</day>` : ""
|
|
149
|
+
}${
|
|
150
|
+
dateParts.length > 1 ? `<month>${dateParts[1]}</month>` : ""
|
|
151
|
+
}<year>${dateParts[0]}</year></date>`
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// volume
|
|
155
|
+
if (fields.volume && String(fields.volume).length) {
|
|
156
|
+
start += `<volume>${convertTexts((String(fields.volume) as unknown as FidusNode[]))}</volume>`
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// issue
|
|
160
|
+
if (fields.issue && String(fields.issue).length) {
|
|
161
|
+
start += `<issue>${convertTexts((String(fields.issue) as unknown as FidusNode[]))}</issue>`
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// pages
|
|
165
|
+
if (fields.pages && Array.isArray(fields.pages) && fields.pages.length) {
|
|
166
|
+
const pages = fields.pages as Array<string[]>
|
|
167
|
+
start += `<fpage>${convertTexts((pages[0][0]) as unknown as FidusNode[])}</fpage>`
|
|
168
|
+
const lastPageGroup = pages.slice(-1)[0]
|
|
169
|
+
start += `<lpage>${convertTexts((lastPageGroup.slice(-1)[0]) as unknown as FidusNode[])}</lpage>`
|
|
170
|
+
if (pages.length > 1) {
|
|
171
|
+
start += `<page-range>${pages
|
|
172
|
+
.map(pageGroup => pageGroup.map(page => convertTexts((page) as unknown as FidusNode[])).join("-"))
|
|
173
|
+
.join(", ")}</page-range>`
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// doi
|
|
178
|
+
if (fields.doi && String(fields.doi).length) {
|
|
179
|
+
start += `<pub-id pub-id-type="doi">${escapeText(String(fields.doi))}</pub-id>`
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// url
|
|
183
|
+
if (fields.url && String(fields.url).length) {
|
|
184
|
+
start += `<ext-link ext-link-type="web" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${escapeText(String(fields.url))}"/>`
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// url date
|
|
188
|
+
if (fields.urldate && String(fields.urldate).length) {
|
|
189
|
+
const date = String(fields.urldate)
|
|
190
|
+
const dateParts = date.split("-")
|
|
191
|
+
start += `<date-in-citation content-type="access-date" iso-8601-date="${date}">${
|
|
192
|
+
dateParts.length > 2 ? `<day>${dateParts[2]}</day>` : ""
|
|
193
|
+
}${
|
|
194
|
+
dateParts.length > 1 ? `<month>${dateParts[1]}</month>` : ""
|
|
195
|
+
}<year>${dateParts[0]}</year></date-in-citation>`
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return start + end
|
|
199
|
+
}
|
|
@@ -1,9 +1,32 @@
|
|
|
1
1
|
import {FormatCitations} from "../../citations/format.js"
|
|
2
2
|
|
|
3
|
+
import type {BibDB, CSL, ExportDoc} from "../../types.js"
|
|
3
4
|
import {jatsBib} from "./bibliography.js"
|
|
4
5
|
|
|
6
|
+
interface CitationLayout {
|
|
7
|
+
prefix?: string
|
|
8
|
+
suffix?: string
|
|
9
|
+
delimiter?: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface CSLStyleChild {
|
|
13
|
+
name: string
|
|
14
|
+
children?: CSLStyleChild[]
|
|
15
|
+
attrs?: Record<string, unknown>
|
|
16
|
+
}
|
|
17
|
+
|
|
5
18
|
export class JATSExporterCitations {
|
|
6
|
-
|
|
19
|
+
doc: ExportDoc
|
|
20
|
+
bibDB: BibDB
|
|
21
|
+
csl: CSL
|
|
22
|
+
|
|
23
|
+
citationTexts: string[]
|
|
24
|
+
citFm: FormatCitations | false
|
|
25
|
+
jatsBib: string
|
|
26
|
+
jatsIdConvert: Record<string, number>
|
|
27
|
+
citInfos: Record<string, unknown>[]
|
|
28
|
+
|
|
29
|
+
constructor(doc: ExportDoc, bibDB: BibDB, csl: CSL) {
|
|
7
30
|
this.doc = doc
|
|
8
31
|
this.bibDB = bibDB
|
|
9
32
|
this.csl = csl
|
|
@@ -12,9 +35,10 @@ export class JATSExporterCitations {
|
|
|
12
35
|
this.citFm = false
|
|
13
36
|
this.jatsBib = ""
|
|
14
37
|
this.jatsIdConvert = {}
|
|
38
|
+
this.citInfos = []
|
|
15
39
|
}
|
|
16
40
|
|
|
17
|
-
init(citInfos) {
|
|
41
|
+
init(citInfos: Record<string, unknown>[]): Promise<void> {
|
|
18
42
|
this.citInfos = citInfos
|
|
19
43
|
if (!citInfos.length) {
|
|
20
44
|
return Promise.resolve()
|
|
@@ -25,44 +49,58 @@ export class JATSExporterCitations {
|
|
|
25
49
|
// Citations are highly interdependent -- so we need to format them all
|
|
26
50
|
// together before laying out the document.
|
|
27
51
|
// We disregard the styling of the bibliography and instead create our own, JATS-specific bibliography.
|
|
28
|
-
formatCitations() {
|
|
52
|
+
formatCitations(): Promise<void> {
|
|
53
|
+
if (!this.csl.getStyle) {
|
|
54
|
+
return Promise.resolve()
|
|
55
|
+
}
|
|
29
56
|
return this.csl
|
|
30
|
-
.getStyle(this.doc.settings.citationstyle)
|
|
57
|
+
.getStyle(this.doc.settings.citationstyle || "")
|
|
31
58
|
.then(citationstyle => {
|
|
32
|
-
const modStyle = JSON.parse(JSON.stringify(citationstyle))
|
|
59
|
+
const modStyle = JSON.parse(JSON.stringify(citationstyle)) as {
|
|
60
|
+
children: CSLStyleChild[]
|
|
61
|
+
}
|
|
33
62
|
const citationLayout = modStyle.children
|
|
34
|
-
.find(section => section.name === "citation")
|
|
35
|
-
.children
|
|
63
|
+
.find(section => section.name === "citation")!
|
|
64
|
+
.children!.find(section => section.name === "layout")!.attrs as CitationLayout
|
|
36
65
|
const origCitationLayout = JSON.parse(
|
|
37
66
|
JSON.stringify(citationLayout)
|
|
38
|
-
)
|
|
67
|
+
) as CitationLayout
|
|
39
68
|
citationLayout.prefix = "{{prefix}}"
|
|
40
69
|
citationLayout.suffix = "{{suffix}}"
|
|
41
70
|
citationLayout.delimiter = "{{delimiter}}"
|
|
42
|
-
|
|
71
|
+
const citFm = new FormatCitations(
|
|
43
72
|
this.csl,
|
|
44
|
-
this.citInfos,
|
|
45
|
-
modStyle,
|
|
73
|
+
this.citInfos as any,
|
|
74
|
+
modStyle as any,
|
|
46
75
|
"",
|
|
47
76
|
this.bibDB,
|
|
48
77
|
false,
|
|
49
78
|
this.doc.settings.language
|
|
50
79
|
)
|
|
80
|
+
this.citFm = citFm
|
|
51
81
|
return Promise.all([
|
|
52
82
|
Promise.resolve(origCitationLayout),
|
|
53
|
-
|
|
83
|
+
citFm.init() as Promise<void>
|
|
54
84
|
])
|
|
55
85
|
})
|
|
56
86
|
.then(([origCitationLayout]) => {
|
|
87
|
+
if (!this.citFm) {
|
|
88
|
+
return Promise.resolve()
|
|
89
|
+
}
|
|
90
|
+
const citFm = this.citFm
|
|
57
91
|
// We need to add xref-links to the bibliography items. And there may be more than one work cited
|
|
58
92
|
// so we need to first split, then add the links and eventually put the citation back together
|
|
59
93
|
// again.
|
|
60
94
|
// The IDs used in the jats bibliography are 1 and up in this order
|
|
61
|
-
|
|
95
|
+
const bibliography = citFm.bibliography
|
|
96
|
+
if (!bibliography) {
|
|
97
|
+
return Promise.resolve()
|
|
98
|
+
}
|
|
99
|
+
bibliography[0].entry_ids.forEach((id, index) => {
|
|
62
100
|
this.jatsIdConvert[id] = index + 1
|
|
63
101
|
this.jatsBib += jatsBib(this.bibDB.db[id], index + 1)
|
|
64
102
|
})
|
|
65
|
-
this.citationTexts =
|
|
103
|
+
this.citationTexts = citFm.citationTexts.map(
|
|
66
104
|
(ref, index) => {
|
|
67
105
|
const content = ref
|
|
68
106
|
.split("{{delimiter}}")
|
|
@@ -71,7 +109,7 @@ export class JATSExporterCitations {
|
|
|
71
109
|
citationText.split("{{prefix}}")
|
|
72
110
|
const prefix =
|
|
73
111
|
prefixSplit.length > 1
|
|
74
|
-
? prefixSplit.shift() +
|
|
112
|
+
? prefixSplit.shift()! +
|
|
75
113
|
(origCitationLayout.prefix || "")
|
|
76
114
|
: ""
|
|
77
115
|
citationText = prefixSplit[0]
|
|
@@ -80,13 +118,11 @@ export class JATSExporterCitations {
|
|
|
80
118
|
const suffix =
|
|
81
119
|
suffixSplit.length > 1
|
|
82
120
|
? (origCitationLayout.suffix || "") +
|
|
83
|
-
suffixSplit.pop()
|
|
121
|
+
suffixSplit.pop()!
|
|
84
122
|
: ""
|
|
85
123
|
citationText = suffixSplit[0]
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
conIndex
|
|
89
|
-
][1].id
|
|
124
|
+
const sortedItems = ((citFm.citations[index] as unknown as {sortedItems: Array<[unknown, {id: string}]>}).sortedItems)
|
|
125
|
+
const citId = sortedItems[conIndex][1].id
|
|
90
126
|
const jatsId = this.jatsIdConvert[citId]
|
|
91
127
|
return `${prefix}<xref ref-type="bibr" rid="ref-${jatsId}">${citationText}</xref>${suffix}`
|
|
92
128
|
})
|