pulpweaver4 0.0.0-stage → 0.0.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ast/djot.d.ts +124 -0
- package/dist/ast/djot.js +464 -0
- package/dist/ast/djot.js.map +1 -0
- package/dist/ast/index.d.ts +10 -0
- package/dist/ast/index.js +11 -0
- package/dist/ast/index.js.map +1 -0
- package/dist/ast/locator.d.ts +27 -0
- package/dist/ast/locator.js +77 -0
- package/dist/ast/locator.js.map +1 -0
- package/dist/ast/nodes.d.ts +543 -0
- package/dist/ast/nodes.js +56 -0
- package/dist/ast/nodes.js.map +1 -0
- package/dist/ast/position.d.ts +88 -0
- package/dist/ast/position.js +98 -0
- package/dist/ast/position.js.map +1 -0
- package/dist/ast/traverse.d.ts +12 -0
- package/dist/ast/traverse.js +37 -0
- package/dist/ast/traverse.js.map +1 -0
- package/dist/bibliography/biblatex.d.ts +13 -0
- package/dist/bibliography/biblatex.js +849 -0
- package/dist/bibliography/biblatex.js.map +1 -0
- package/dist/bibliography/bibtex.d.ts +39 -0
- package/dist/bibliography/bibtex.js +259 -0
- package/dist/bibliography/bibtex.js.map +1 -0
- package/dist/bibliography/csl.d.ts +9 -0
- package/dist/bibliography/csl.js +241 -0
- package/dist/bibliography/csl.js.map +1 -0
- package/dist/bibliography/dates.d.ts +33 -0
- package/dist/bibliography/dates.js +223 -0
- package/dist/bibliography/dates.js.map +1 -0
- package/dist/bibliography/index.d.ts +8 -0
- package/dist/bibliography/index.js +9 -0
- package/dist/bibliography/index.js.map +1 -0
- package/dist/bibliography/item.d.ts +142 -0
- package/dist/bibliography/item.js +181 -0
- package/dist/bibliography/item.js.map +1 -0
- package/dist/bibliography/latex.d.ts +21 -0
- package/dist/bibliography/latex.js +586 -0
- package/dist/bibliography/latex.js.map +1 -0
- package/dist/bibliography/names.d.ts +23 -0
- package/dist/bibliography/names.js +244 -0
- package/dist/bibliography/names.js.map +1 -0
- package/dist/bibliography/read.d.ts +24 -0
- package/dist/bibliography/read.js +50 -0
- package/dist/bibliography/read.js.map +1 -0
- package/dist/citations/book.d.ts +93 -0
- package/dist/citations/book.js +217 -0
- package/dist/citations/book.js.map +1 -0
- package/dist/citations/collect.d.ts +56 -0
- package/dist/citations/collect.js +129 -0
- package/dist/citations/collect.js.map +1 -0
- package/dist/citations/hast.d.ts +12 -0
- package/dist/citations/hast.js +49 -0
- package/dist/citations/hast.js.map +1 -0
- package/dist/citations/index.d.ts +14 -0
- package/dist/citations/index.js +15 -0
- package/dist/citations/index.js.map +1 -0
- package/dist/citations/lint.d.ts +70 -0
- package/dist/citations/lint.js +92 -0
- package/dist/citations/lint.js.map +1 -0
- package/dist/citations/notes.d.ts +11 -0
- package/dist/citations/notes.js +163 -0
- package/dist/citations/notes.js.map +1 -0
- package/dist/citations/positions.d.ts +34 -0
- package/dist/citations/positions.js +90 -0
- package/dist/citations/positions.js.map +1 -0
- package/dist/citations/project.d.ts +7 -0
- package/dist/citations/project.js +24 -0
- package/dist/citations/project.js.map +1 -0
- package/dist/colour/cmyk.d.ts +71 -0
- package/dist/colour/cmyk.js +210 -0
- package/dist/colour/cmyk.js.map +1 -0
- package/dist/colour/images.d.ts +36 -0
- package/dist/colour/images.js +106 -0
- package/dist/colour/images.js.map +1 -0
- package/dist/colour/index.d.ts +7 -0
- package/dist/colour/index.js +8 -0
- package/dist/colour/index.js.map +1 -0
- package/dist/colour/ink-limit.d.ts +68 -0
- package/dist/colour/ink-limit.js +109 -0
- package/dist/colour/ink-limit.js.map +1 -0
- package/dist/colour/intents.d.ts +145 -0
- package/dist/colour/intents.js +193 -0
- package/dist/colour/intents.js.map +1 -0
- package/dist/colour/lcms.d.ts +79 -0
- package/dist/colour/lcms.js +229 -0
- package/dist/colour/lcms.js.map +1 -0
- package/dist/colour/previews.d.ts +49 -0
- package/dist/colour/previews.js +116 -0
- package/dist/colour/previews.js.map +1 -0
- package/dist/colour/wasm/LICENSE-lcms2 +22 -0
- package/dist/colour/wasm/lcms2.wasm +0 -0
- package/dist/config/config.d.ts +114 -0
- package/dist/config/config.js +309 -0
- package/dist/config/config.js.map +1 -0
- package/dist/config/index.d.ts +6 -0
- package/dist/config/index.js +7 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/page.d.ts +42 -0
- package/dist/config/page.js +95 -0
- package/dist/config/page.js.map +1 -0
- package/dist/config/project-schema.d.ts +23 -0
- package/dist/config/project-schema.js +223 -0
- package/dist/config/project-schema.js.map +1 -0
- package/dist/config/schema.d.ts +68 -0
- package/dist/config/schema.js +333 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/toml.d.ts +54 -0
- package/dist/config/toml.js +238 -0
- package/dist/config/toml.js.map +1 -0
- package/dist/contents/index.d.ts +8 -0
- package/dist/contents/index.js +9 -0
- package/dist/contents/index.js.map +1 -0
- package/dist/contents/transform.d.ts +64 -0
- package/dist/contents/transform.js +149 -0
- package/dist/contents/transform.js.map +1 -0
- package/dist/csl/affix.d.ts +16 -0
- package/dist/csl/affix.js +74 -0
- package/dist/csl/affix.js.map +1 -0
- package/dist/csl/data/chicago-author-date.d.ts +2 -0
- package/dist/csl/data/chicago-author-date.js +3 -0
- package/dist/csl/data/chicago-author-date.js.map +1 -0
- package/dist/csl/data/chicago-notes-bibliography.d.ts +2 -0
- package/dist/csl/data/chicago-notes-bibliography.js +3 -0
- package/dist/csl/data/chicago-notes-bibliography.js.map +1 -0
- package/dist/csl/data/locales-en-GB.d.ts +2 -0
- package/dist/csl/data/locales-en-GB.js +3 -0
- package/dist/csl/data/locales-en-GB.js.map +1 -0
- package/dist/csl/data/locales-en-US.d.ts +2 -0
- package/dist/csl/data/locales-en-US.js +3 -0
- package/dist/csl/data/locales-en-US.js.map +1 -0
- package/dist/csl/dates.d.ts +30 -0
- package/dist/csl/dates.js +223 -0
- package/dist/csl/dates.js.map +1 -0
- package/dist/csl/format.d.ts +29 -0
- package/dist/csl/format.js +157 -0
- package/dist/csl/format.js.map +1 -0
- package/dist/csl/index.d.ts +26 -0
- package/dist/csl/index.js +16 -0
- package/dist/csl/index.js.map +1 -0
- package/dist/csl/ir.d.ts +103 -0
- package/dist/csl/ir.js +549 -0
- package/dist/csl/ir.js.map +1 -0
- package/dist/csl/load.d.ts +98 -0
- package/dist/csl/load.js +163 -0
- package/dist/csl/load.js.map +1 -0
- package/dist/csl/locale.d.ts +90 -0
- package/dist/csl/locale.js +251 -0
- package/dist/csl/locale.js.map +1 -0
- package/dist/csl/names.d.ts +41 -0
- package/dist/csl/names.js +203 -0
- package/dist/csl/names.js.map +1 -0
- package/dist/csl/numbers.d.ts +48 -0
- package/dist/csl/numbers.js +170 -0
- package/dist/csl/numbers.js.map +1 -0
- package/dist/csl/processor.d.ts +179 -0
- package/dist/csl/processor.js +765 -0
- package/dist/csl/processor.js.map +1 -0
- package/dist/csl/project.d.ts +21 -0
- package/dist/csl/project.js +85 -0
- package/dist/csl/project.js.map +1 -0
- package/dist/csl/render.d.ts +130 -0
- package/dist/csl/render.js +748 -0
- package/dist/csl/render.js.map +1 -0
- package/dist/csl/style.d.ts +168 -0
- package/dist/csl/style.js +262 -0
- package/dist/csl/style.js.map +1 -0
- package/dist/csl/xml.d.ts +28 -0
- package/dist/csl/xml.js +162 -0
- package/dist/csl/xml.js.map +1 -0
- package/dist/djot/djot.js/LICENSE +20 -0
- package/dist/djot/djot.js/src/ast.d.ts +327 -0
- package/dist/djot/djot.js/src/ast.js +68 -0
- package/dist/djot/djot.js/src/ast.js.map +1 -0
- package/dist/djot/djot.js/src/attributes.d.ts +31 -0
- package/dist/djot/djot.js/src/attributes.js +300 -0
- package/dist/djot/djot.js/src/attributes.js.map +1 -0
- package/dist/djot/djot.js/src/block.d.ts +87 -0
- package/dist/djot/djot.js/src/block.js +1201 -0
- package/dist/djot/djot.js/src/block.js.map +1 -0
- package/dist/djot/djot.js/src/djot-renderer.d.ts +8 -0
- package/dist/djot/djot.js/src/djot-renderer.js +755 -0
- package/dist/djot/djot.js/src/djot-renderer.js.map +1 -0
- package/dist/djot/djot.js/src/event.d.ts +6 -0
- package/dist/djot/djot.js/src/event.js +2 -0
- package/dist/djot/djot.js/src/event.js.map +1 -0
- package/dist/djot/djot.js/src/filter.d.ts +13 -0
- package/dist/djot/djot.js/src/filter.js +159 -0
- package/dist/djot/djot.js/src/filter.js.map +1 -0
- package/dist/djot/djot.js/src/find.d.ts +7 -0
- package/dist/djot/djot.js/src/find.js +33 -0
- package/dist/djot/djot.js/src/find.js.map +1 -0
- package/dist/djot/djot.js/src/html.d.ts +40 -0
- package/dist/djot/djot.js/src/html.js +657 -0
- package/dist/djot/djot.js/src/html.js.map +1 -0
- package/dist/djot/djot.js/src/index.d.ts +9 -0
- package/dist/djot/djot.js/src/index.js +9 -0
- package/dist/djot/djot.js/src/index.js.map +1 -0
- package/dist/djot/djot.js/src/inline.d.ts +62 -0
- package/dist/djot/djot.js/src/inline.js +1032 -0
- package/dist/djot/djot.js/src/inline.js.map +1 -0
- package/dist/djot/djot.js/src/options.d.ts +13 -0
- package/dist/djot/djot.js/src/options.js +27 -0
- package/dist/djot/djot.js/src/options.js.map +1 -0
- package/dist/djot/djot.js/src/pandoc.d.ts +20 -0
- package/dist/djot/djot.js/src/pandoc.js +1110 -0
- package/dist/djot/djot.js/src/pandoc.js.map +1 -0
- package/dist/djot/djot.js/src/parse.d.ts +19 -0
- package/dist/djot/djot.js/src/parse.js +1445 -0
- package/dist/djot/djot.js/src/parse.js.map +1 -0
- package/dist/djot/djot.js/src/version.d.ts +1 -0
- package/dist/djot/djot.js/src/version.js +2 -0
- package/dist/djot/djot.js/src/version.js.map +1 -0
- package/dist/djot/index.d.ts +5 -0
- package/dist/djot/index.js +6 -0
- package/dist/djot/index.js.map +1 -0
- package/dist/djot/read.d.ts +57 -0
- package/dist/djot/read.js +146 -0
- package/dist/djot/read.js.map +1 -0
- package/dist/fonts/css.d.ts +82 -0
- package/dist/fonts/css.js +329 -0
- package/dist/fonts/css.js.map +1 -0
- package/dist/fonts/faces.d.ts +101 -0
- package/dist/fonts/faces.js +226 -0
- package/dist/fonts/faces.js.map +1 -0
- package/dist/fonts/index.d.ts +12 -0
- package/dist/fonts/index.js +13 -0
- package/dist/fonts/index.js.map +1 -0
- package/dist/fonts/lint.d.ts +58 -0
- package/dist/fonts/lint.js +209 -0
- package/dist/fonts/lint.js.map +1 -0
- package/dist/fonts/match.d.ts +36 -0
- package/dist/fonts/match.js +104 -0
- package/dist/fonts/match.js.map +1 -0
- package/dist/fonts/names.d.ts +9 -0
- package/dist/fonts/names.js +50 -0
- package/dist/fonts/names.js.map +1 -0
- package/dist/fonts/subset.d.ts +72 -0
- package/dist/fonts/subset.js +169 -0
- package/dist/fonts/subset.js.map +1 -0
- package/dist/fonts/walk.d.ts +33 -0
- package/dist/fonts/walk.js +120 -0
- package/dist/fonts/walk.js.map +1 -0
- package/dist/fonts/wasm/LICENSE-harfbuzzjs +19 -0
- package/dist/fonts/wasm/harfbuzz-subset.wasm +0 -0
- package/dist/html/check.d.ts +62 -0
- package/dist/html/check.js +186 -0
- package/dist/html/check.js.map +1 -0
- package/dist/html/counters.d.ts +32 -0
- package/dist/html/counters.js +72 -0
- package/dist/html/counters.js.map +1 -0
- package/dist/html/css.d.ts +33 -0
- package/dist/html/css.js +72 -0
- package/dist/html/css.js.map +1 -0
- package/dist/html/dom.d.ts +28 -0
- package/dist/html/dom.js +162 -0
- package/dist/html/dom.js.map +1 -0
- package/dist/html/editions.d.ts +26 -0
- package/dist/html/editions.js +57 -0
- package/dist/html/editions.js.map +1 -0
- package/dist/html/images.d.ts +13 -0
- package/dist/html/images.js +62 -0
- package/dist/html/images.js.map +1 -0
- package/dist/html/index.d.ts +14 -0
- package/dist/html/index.js +15 -0
- package/dist/html/index.js.map +1 -0
- package/dist/html/registry.d.ts +120 -0
- package/dist/html/registry.js +48 -0
- package/dist/html/registry.js.map +1 -0
- package/dist/html/render.d.ts +99 -0
- package/dist/html/render.js +694 -0
- package/dist/html/render.js.map +1 -0
- package/dist/hyphenation/NOTICE +429 -0
- package/dist/hyphenation/exceptions.d.ts +60 -0
- package/dist/hyphenation/exceptions.js +79 -0
- package/dist/hyphenation/exceptions.js.map +1 -0
- package/dist/hyphenation/hyphenator.d.ts +66 -0
- package/dist/hyphenation/hyphenator.js +245 -0
- package/dist/hyphenation/hyphenator.js.map +1 -0
- package/dist/hyphenation/index.d.ts +4 -0
- package/dist/hyphenation/index.js +5 -0
- package/dist/hyphenation/index.js.map +1 -0
- package/dist/hyphenation/languages.d.ts +20 -0
- package/dist/hyphenation/languages.js +75 -0
- package/dist/hyphenation/languages.js.map +1 -0
- package/dist/hyphenation/patterns/af.wasm +0 -0
- package/dist/hyphenation/patterns/as.wasm +0 -0
- package/dist/hyphenation/patterns/be.wasm +0 -0
- package/dist/hyphenation/patterns/bg.wasm +0 -0
- package/dist/hyphenation/patterns/bn.wasm +0 -0
- package/dist/hyphenation/patterns/ca.wasm +0 -0
- package/dist/hyphenation/patterns/cy.wasm +0 -0
- package/dist/hyphenation/patterns/da.wasm +0 -0
- package/dist/hyphenation/patterns/de.wasm +0 -0
- package/dist/hyphenation/patterns/el-monoton.wasm +0 -0
- package/dist/hyphenation/patterns/el-polyton.wasm +0 -0
- package/dist/hyphenation/patterns/en-gb.wasm +0 -0
- package/dist/hyphenation/patterns/en-us.wasm +0 -0
- package/dist/hyphenation/patterns/eo.wasm +0 -0
- package/dist/hyphenation/patterns/es.wasm +0 -0
- package/dist/hyphenation/patterns/et.wasm +0 -0
- package/dist/hyphenation/patterns/eu.wasm +0 -0
- package/dist/hyphenation/patterns/fi-x-school.wasm +0 -0
- package/dist/hyphenation/patterns/fr.wasm +0 -0
- package/dist/hyphenation/patterns/fur.wasm +0 -0
- package/dist/hyphenation/patterns/ga.wasm +0 -0
- package/dist/hyphenation/patterns/gl.wasm +0 -0
- package/dist/hyphenation/patterns/gu.wasm +0 -0
- package/dist/hyphenation/patterns/hi.wasm +0 -0
- package/dist/hyphenation/patterns/hr.wasm +0 -0
- package/dist/hyphenation/patterns/hsb.wasm +0 -0
- package/dist/hyphenation/patterns/ia.wasm +0 -0
- package/dist/hyphenation/patterns/is.wasm +0 -0
- package/dist/hyphenation/patterns/it.wasm +0 -0
- package/dist/hyphenation/patterns/ka.wasm +0 -0
- package/dist/hyphenation/patterns/kmr.wasm +0 -0
- package/dist/hyphenation/patterns/kn.wasm +0 -0
- package/dist/hyphenation/patterns/la.wasm +0 -0
- package/dist/hyphenation/patterns/lt.wasm +0 -0
- package/dist/hyphenation/patterns/ml.wasm +0 -0
- package/dist/hyphenation/patterns/mn-cyrl.wasm +0 -0
- package/dist/hyphenation/patterns/mr.wasm +0 -0
- package/dist/hyphenation/patterns/nb.wasm +0 -0
- package/dist/hyphenation/patterns/nl.wasm +0 -0
- package/dist/hyphenation/patterns/nn.wasm +0 -0
- package/dist/hyphenation/patterns/no.wasm +0 -0
- package/dist/hyphenation/patterns/oc.wasm +0 -0
- package/dist/hyphenation/patterns/or.wasm +0 -0
- package/dist/hyphenation/patterns/pa.wasm +0 -0
- package/dist/hyphenation/patterns/pi.wasm +0 -0
- package/dist/hyphenation/patterns/pl.wasm +0 -0
- package/dist/hyphenation/patterns/pms.wasm +0 -0
- package/dist/hyphenation/patterns/pt.wasm +0 -0
- package/dist/hyphenation/patterns/rm.wasm +0 -0
- package/dist/hyphenation/patterns/ru.wasm +0 -0
- package/dist/hyphenation/patterns/sh-cyrl.wasm +0 -0
- package/dist/hyphenation/patterns/sh-latn.wasm +0 -0
- package/dist/hyphenation/patterns/sk.wasm +0 -0
- package/dist/hyphenation/patterns/sl.wasm +0 -0
- package/dist/hyphenation/patterns/sq.wasm +0 -0
- package/dist/hyphenation/patterns/sv.wasm +0 -0
- package/dist/hyphenation/patterns/ta.wasm +0 -0
- package/dist/hyphenation/patterns/te.wasm +0 -0
- package/dist/hyphenation/patterns/th.wasm +0 -0
- package/dist/hyphenation/patterns/tk.wasm +0 -0
- package/dist/hyphenation/patterns/tr.wasm +0 -0
- package/dist/hyphenation/patterns/uk.wasm +0 -0
- package/dist/hyphenation/patterns/zh-latn-pinyin.wasm +0 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.js +48 -0
- package/dist/index.js.map +1 -0
- package/dist/indexes/index.d.ts +10 -0
- package/dist/indexes/index.js +11 -0
- package/dist/indexes/index.js.map +1 -0
- package/dist/indexes/layout.d.ts +30 -0
- package/dist/indexes/layout.js +83 -0
- package/dist/indexes/layout.js.map +1 -0
- package/dist/indexes/locators.d.ts +33 -0
- package/dist/indexes/locators.js +51 -0
- package/dist/indexes/locators.js.map +1 -0
- package/dist/indexes/terms.d.ts +97 -0
- package/dist/indexes/terms.js +211 -0
- package/dist/indexes/terms.js.map +1 -0
- package/dist/indexes/transform.d.ts +90 -0
- package/dist/indexes/transform.js +154 -0
- package/dist/indexes/transform.js.map +1 -0
- package/dist/layout/calibrate.d.ts +12 -0
- package/dist/layout/calibrate.js +50 -0
- package/dist/layout/calibrate.js.map +1 -0
- package/dist/layout/converge.d.ts +31 -0
- package/dist/layout/converge.js +84 -0
- package/dist/layout/converge.js.map +1 -0
- package/dist/layout/counters.d.ts +16 -0
- package/dist/layout/counters.js +62 -0
- package/dist/layout/counters.js.map +1 -0
- package/dist/layout/first-letter.d.ts +34 -0
- package/dist/layout/first-letter.js +183 -0
- package/dist/layout/first-letter.js.map +1 -0
- package/dist/layout/fonts.d.ts +67 -0
- package/dist/layout/fonts.js +110 -0
- package/dist/layout/fonts.js.map +1 -0
- package/dist/layout/generated.d.ts +9 -0
- package/dist/layout/generated.js +83 -0
- package/dist/layout/generated.js.map +1 -0
- package/dist/layout/glue.d.ts +18 -0
- package/dist/layout/glue.js +48 -0
- package/dist/layout/glue.js.map +1 -0
- package/dist/layout/index.d.ts +17 -0
- package/dist/layout/index.js +18 -0
- package/dist/layout/index.js.map +1 -0
- package/dist/layout/lists.d.ts +91 -0
- package/dist/layout/lists.js +1068 -0
- package/dist/layout/lists.js.map +1 -0
- package/dist/layout/margin-boxes.d.ts +114 -0
- package/dist/layout/margin-boxes.js +429 -0
- package/dist/layout/margin-boxes.js.map +1 -0
- package/dist/layout/minipage.d.ts +85 -0
- package/dist/layout/minipage.js +83 -0
- package/dist/layout/minipage.js.map +1 -0
- package/dist/layout/page-box.d.ts +34 -0
- package/dist/layout/page-box.js +112 -0
- package/dist/layout/page-box.js.map +1 -0
- package/dist/layout/page-rules.d.ts +49 -0
- package/dist/layout/page-rules.js +205 -0
- package/dist/layout/page-rules.js.map +1 -0
- package/dist/layout/page.d.ts +51 -0
- package/dist/layout/page.js +133 -0
- package/dist/layout/page.js.map +1 -0
- package/dist/layout/pagebuilder.d.ts +243 -0
- package/dist/layout/pagebuilder.js +591 -0
- package/dist/layout/pagebuilder.js.map +1 -0
- package/dist/layout/pages.d.ts +77 -0
- package/dist/layout/pages.js +772 -0
- package/dist/layout/pages.js.map +1 -0
- package/dist/layout/paragraph.d.ts +194 -0
- package/dist/layout/paragraph.js +1148 -0
- package/dist/layout/paragraph.js.map +1 -0
- package/dist/layout/pre.d.ts +8 -0
- package/dist/layout/pre.js +151 -0
- package/dist/layout/pre.js.map +1 -0
- package/dist/layout/region.d.ts +66 -0
- package/dist/layout/region.js +200 -0
- package/dist/layout/region.js.map +1 -0
- package/dist/layout/vlist.d.ts +218 -0
- package/dist/layout/vlist.js +72 -0
- package/dist/layout/vlist.js.map +1 -0
- package/dist/linebreak/items.d.ts +69 -0
- package/dist/linebreak/items.js +44 -0
- package/dist/linebreak/items.js.map +1 -0
- package/dist/linebreak/knuth-plass.d.ts +149 -0
- package/dist/linebreak/knuth-plass.js +461 -0
- package/dist/linebreak/knuth-plass.js.map +1 -0
- package/dist/lint/config.d.ts +48 -0
- package/dist/lint/config.js +185 -0
- package/dist/lint/config.js.map +1 -0
- package/dist/lint/context.d.ts +64 -0
- package/dist/lint/context.js +37 -0
- package/dist/lint/context.js.map +1 -0
- package/dist/lint/fix.d.ts +40 -0
- package/dist/lint/fix.js +86 -0
- package/dist/lint/fix.js.map +1 -0
- package/dist/lint/index.d.ts +14 -0
- package/dist/lint/index.js +15 -0
- package/dist/lint/index.js.map +1 -0
- package/dist/lint/linter.d.ts +59 -0
- package/dist/lint/linter.js +239 -0
- package/dist/lint/linter.js.map +1 -0
- package/dist/lint/presets.d.ts +20 -0
- package/dist/lint/presets.js +65 -0
- package/dist/lint/presets.js.map +1 -0
- package/dist/lint/project.d.ts +31 -0
- package/dist/lint/project.js +100 -0
- package/dist/lint/project.js.map +1 -0
- package/dist/lint/rules/html.d.ts +30 -0
- package/dist/lint/rules/html.js +163 -0
- package/dist/lint/rules/html.js.map +1 -0
- package/dist/lint/rules/layout.d.ts +42 -0
- package/dist/lint/rules/layout.js +428 -0
- package/dist/lint/rules/layout.js.map +1 -0
- package/dist/lint/rules/source.d.ts +67 -0
- package/dist/lint/rules/source.js +339 -0
- package/dist/lint/rules/source.js.map +1 -0
- package/dist/lint/testing.d.ts +7 -0
- package/dist/lint/testing.js +77 -0
- package/dist/lint/testing.js.map +1 -0
- package/dist/math/hast.d.ts +46 -0
- package/dist/math/hast.js +297 -0
- package/dist/math/hast.js.map +1 -0
- package/dist/math/index.d.ts +9 -0
- package/dist/math/index.js +10 -0
- package/dist/math/index.js.map +1 -0
- package/dist/math/mathjax/LICENSE-mathjax +202 -0
- package/dist/math/mathjax/LICENSE-speech-rule-engine +177 -0
- package/dist/math/mathjax/sre/af.json +146 -0
- package/dist/math/mathjax/sre/base.json +140 -0
- package/dist/math/mathjax/sre/ca.json +140 -0
- package/dist/math/mathjax/sre/da.json +140 -0
- package/dist/math/mathjax/sre/de.json +146 -0
- package/dist/math/mathjax/sre/en.json +158 -0
- package/dist/math/mathjax/sre/es.json +140 -0
- package/dist/math/mathjax/sre/euro.json +32 -0
- package/dist/math/mathjax/sre/fr.json +146 -0
- package/dist/math/mathjax/sre/hi.json +146 -0
- package/dist/math/mathjax/sre/it.json +146 -0
- package/dist/math/mathjax/sre/ko.json +146 -0
- package/dist/math/mathjax/sre/nb.json +146 -0
- package/dist/math/mathjax/sre/nemeth.json +125 -0
- package/dist/math/mathjax/sre/nn.json +146 -0
- package/dist/math/mathjax/sre/sv.json +146 -0
- package/dist/math/mathjax/svg/PUA.json +1 -0
- package/dist/math/mathjax/svg/accents-b-i.json +1 -0
- package/dist/math/mathjax/svg/accents.json +1 -0
- package/dist/math/mathjax/svg/arabic.json +1 -0
- package/dist/math/mathjax/svg/arrows.json +1 -0
- package/dist/math/mathjax/svg/braille-d.json +1 -0
- package/dist/math/mathjax/svg/braille.json +1 -0
- package/dist/math/mathjax/svg/calligraphic.json +1 -0
- package/dist/math/mathjax/svg/cherokee.json +1 -0
- package/dist/math/mathjax/svg/cyrillic-ss.json +1 -0
- package/dist/math/mathjax/svg/cyrillic.json +1 -0
- package/dist/math/mathjax/svg/devanagari.json +1 -0
- package/dist/math/mathjax/svg/double-struck.json +1 -0
- package/dist/math/mathjax/svg/fraktur.json +1 -0
- package/dist/math/mathjax/svg/greek-ss.json +1 -0
- package/dist/math/mathjax/svg/greek.json +1 -0
- package/dist/math/mathjax/svg/hebrew.json +1 -0
- package/dist/math/mathjax/svg/latin-b.json +1 -0
- package/dist/math/mathjax/svg/latin-bi.json +1 -0
- package/dist/math/mathjax/svg/latin-i.json +1 -0
- package/dist/math/mathjax/svg/latin.json +1 -0
- package/dist/math/mathjax/svg/marrows.json +1 -0
- package/dist/math/mathjax/svg/math.json +1 -0
- package/dist/math/mathjax/svg/monospace-ex.json +1 -0
- package/dist/math/mathjax/svg/monospace-l.json +1 -0
- package/dist/math/mathjax/svg/monospace.json +1 -0
- package/dist/math/mathjax/svg/mshapes.json +1 -0
- package/dist/math/mathjax/svg/phonetics-ss.json +1 -0
- package/dist/math/mathjax/svg/phonetics.json +1 -0
- package/dist/math/mathjax/svg/sans-serif-b.json +1 -0
- package/dist/math/mathjax/svg/sans-serif-bi.json +1 -0
- package/dist/math/mathjax/svg/sans-serif-ex.json +1 -0
- package/dist/math/mathjax/svg/sans-serif-i.json +1 -0
- package/dist/math/mathjax/svg/sans-serif-r.json +1 -0
- package/dist/math/mathjax/svg/sans-serif.json +1 -0
- package/dist/math/mathjax/svg/script.json +1 -0
- package/dist/math/mathjax/svg/shapes.json +1 -0
- package/dist/math/mathjax/svg/symbols-b-i.json +1 -0
- package/dist/math/mathjax/svg/symbols.json +1 -0
- package/dist/math/mathjax/svg/variants.json +1 -0
- package/dist/math/mathjax.d.ts +67 -0
- package/dist/math/mathjax.js +162 -0
- package/dist/math/mathjax.js.map +1 -0
- package/dist/math/speech.d.ts +27 -0
- package/dist/math/speech.js +87 -0
- package/dist/math/speech.js.map +1 -0
- package/dist/math/typeset.d.ts +75 -0
- package/dist/math/typeset.js +108 -0
- package/dist/math/typeset.js.map +1 -0
- package/dist/measure/css.d.ts +44 -0
- package/dist/measure/css.js +158 -0
- package/dist/measure/css.js.map +1 -0
- package/dist/measure/index.d.ts +3 -0
- package/dist/measure/index.js +4 -0
- package/dist/measure/index.js.map +1 -0
- package/dist/measure/measurer.d.ts +159 -0
- package/dist/measure/measurer.js +300 -0
- package/dist/measure/measurer.js.map +1 -0
- package/dist/measure/model.d.ts +46 -0
- package/dist/measure/model.js +47 -0
- package/dist/measure/model.js.map +1 -0
- package/dist/output/assets.d.ts +10 -0
- package/dist/output/assets.js +65 -0
- package/dist/output/assets.js.map +1 -0
- package/dist/output/index.d.ts +4 -0
- package/dist/output/index.js +5 -0
- package/dist/output/index.js.map +1 -0
- package/dist/output/output.d.ts +103 -0
- package/dist/output/output.js +86 -0
- package/dist/output/output.js.map +1 -0
- package/dist/output/stylesheets.d.ts +45 -0
- package/dist/output/stylesheets.js +50 -0
- package/dist/output/stylesheets.js.map +1 -0
- package/dist/paint/backgrounds.d.ts +56 -0
- package/dist/paint/backgrounds.js +261 -0
- package/dist/paint/backgrounds.js.map +1 -0
- package/dist/paint/blend.d.ts +61 -0
- package/dist/paint/blend.js +157 -0
- package/dist/paint/blend.js.map +1 -0
- package/dist/paint/border-image.d.ts +13 -0
- package/dist/paint/border-image.js +149 -0
- package/dist/paint/border-image.js.map +1 -0
- package/dist/paint/borders.d.ts +47 -0
- package/dist/paint/borders.js +329 -0
- package/dist/paint/borders.js.map +1 -0
- package/dist/paint/canvas.d.ts +52 -0
- package/dist/paint/canvas.js +274 -0
- package/dist/paint/canvas.js.map +1 -0
- package/dist/paint/colours.d.ts +55 -0
- package/dist/paint/colours.js +380 -0
- package/dist/paint/colours.js.map +1 -0
- package/dist/paint/columns.d.ts +11 -0
- package/dist/paint/columns.js +42 -0
- package/dist/paint/columns.js.map +1 -0
- package/dist/paint/context.d.ts +47 -0
- package/dist/paint/context.js +2 -0
- package/dist/paint/context.js.map +1 -0
- package/dist/paint/decoration.d.ts +97 -0
- package/dist/paint/decoration.js +280 -0
- package/dist/paint/decoration.js.map +1 -0
- package/dist/paint/effects.d.ts +64 -0
- package/dist/paint/effects.js +342 -0
- package/dist/paint/effects.js.map +1 -0
- package/dist/paint/emphasis.d.ts +13 -0
- package/dist/paint/emphasis.js +95 -0
- package/dist/paint/emphasis.js.map +1 -0
- package/dist/paint/flatten.d.ts +33 -0
- package/dist/paint/flatten.js +968 -0
- package/dist/paint/flatten.js.map +1 -0
- package/dist/paint/geometry.d.ts +62 -0
- package/dist/paint/geometry.js +170 -0
- package/dist/paint/geometry.js.map +1 -0
- package/dist/paint/gradients.d.ts +31 -0
- package/dist/paint/gradients.js +394 -0
- package/dist/paint/gradients.js.map +1 -0
- package/dist/paint/images.d.ts +17 -0
- package/dist/paint/images.js +80 -0
- package/dist/paint/images.js.map +1 -0
- package/dist/paint/lint.d.ts +46 -0
- package/dist/paint/lint.js +105 -0
- package/dist/paint/lint.js.map +1 -0
- package/dist/paint/overprint.d.ts +13 -0
- package/dist/paint/overprint.js +12 -0
- package/dist/paint/overprint.js.map +1 -0
- package/dist/paint/painter.d.ts +92 -0
- package/dist/paint/painter.js +281 -0
- package/dist/paint/painter.js.map +1 -0
- package/dist/paint/path.d.ts +9 -0
- package/dist/paint/path.js +173 -0
- package/dist/paint/path.js.map +1 -0
- package/dist/paint/raster.d.ts +32 -0
- package/dist/paint/raster.js +180 -0
- package/dist/paint/raster.js.map +1 -0
- package/dist/paint/shadows.d.ts +28 -0
- package/dist/paint/shadows.js +104 -0
- package/dist/paint/shadows.js.map +1 -0
- package/dist/paint/sources.d.ts +13 -0
- package/dist/paint/sources.js +17 -0
- package/dist/paint/sources.js.map +1 -0
- package/dist/paint/stacking.d.ts +75 -0
- package/dist/paint/stacking.js +327 -0
- package/dist/paint/stacking.js.map +1 -0
- package/dist/paint/svg-lint.d.ts +57 -0
- package/dist/paint/svg-lint.js +119 -0
- package/dist/paint/svg-lint.js.map +1 -0
- package/dist/paint/svg.d.ts +95 -0
- package/dist/paint/svg.js +728 -0
- package/dist/paint/svg.js.map +1 -0
- package/dist/paint/tables.d.ts +18 -0
- package/dist/paint/tables.js +178 -0
- package/dist/paint/tables.js.map +1 -0
- package/dist/paint/text-shadow.d.ts +26 -0
- package/dist/paint/text-shadow.js +187 -0
- package/dist/paint/text-shadow.js.map +1 -0
- package/dist/paint/text.d.ts +144 -0
- package/dist/paint/text.js +713 -0
- package/dist/paint/text.js.map +1 -0
- package/dist/paint/values.d.ts +24 -0
- package/dist/paint/values.js +160 -0
- package/dist/paint/values.js.map +1 -0
- package/dist/paint/vertical.d.ts +19 -0
- package/dist/paint/vertical.js +236 -0
- package/dist/paint/vertical.js.map +1 -0
- package/dist/pdf/index.d.ts +6 -0
- package/dist/pdf/index.js +7 -0
- package/dist/pdf/index.js.map +1 -0
- package/dist/pdf/pdfx.d.ts +30 -0
- package/dist/pdf/pdfx.js +18 -0
- package/dist/pdf/pdfx.js.map +1 -0
- package/dist/pdf/structure/index.d.ts +53 -0
- package/dist/pdf/structure/index.js +52 -0
- package/dist/pdf/structure/index.js.map +1 -0
- package/dist/pdf/structure/labels.d.ts +16 -0
- package/dist/pdf/structure/labels.js +45 -0
- package/dist/pdf/structure/labels.js.map +1 -0
- package/dist/pdf/structure/links.d.ts +49 -0
- package/dist/pdf/structure/links.js +136 -0
- package/dist/pdf/structure/links.js.map +1 -0
- package/dist/pdf/structure/tags.d.ts +79 -0
- package/dist/pdf/structure/tags.js +314 -0
- package/dist/pdf/structure/tags.js.map +1 -0
- package/dist/pdf/types.d.ts +551 -0
- package/dist/pdf/types.js +16 -0
- package/dist/pdf/types.js.map +1 -0
- package/dist/pdf/wasm/pulpweaver4_pdf.d.ts +41 -0
- package/dist/pdf/wasm/pulpweaver4_pdf.js +286 -0
- package/dist/pdf/wasm/pulpweaver4_pdf_bg.wasm +0 -0
- package/dist/pdf/writer.d.ts +41 -0
- package/dist/pdf/writer.js +78 -0
- package/dist/pdf/writer.js.map +1 -0
- package/dist/plugin/attributes.d.ts +10 -0
- package/dist/plugin/attributes.js +63 -0
- package/dist/plugin/attributes.js.map +1 -0
- package/dist/plugin/define.d.ts +425 -0
- package/dist/plugin/define.js +311 -0
- package/dist/plugin/define.js.map +1 -0
- package/dist/plugin/failure.d.ts +80 -0
- package/dist/plugin/failure.js +97 -0
- package/dist/plugin/failure.js.map +1 -0
- package/dist/plugin/index.d.ts +11 -0
- package/dist/plugin/index.js +12 -0
- package/dist/plugin/index.js.map +1 -0
- package/dist/plugin/load.d.ts +105 -0
- package/dist/plugin/load.js +197 -0
- package/dist/plugin/load.js.map +1 -0
- package/dist/plugin/register.d.ts +166 -0
- package/dist/plugin/register.js +306 -0
- package/dist/plugin/register.js.map +1 -0
- package/dist/plugin/render.d.ts +4 -0
- package/dist/plugin/render.js +28 -0
- package/dist/plugin/render.js.map +1 -0
- package/dist/preflight/index.d.ts +3 -0
- package/dist/preflight/index.js +4 -0
- package/dist/preflight/index.js.map +1 -0
- package/dist/preflight/pdfx.d.ts +440 -0
- package/dist/preflight/pdfx.js +1781 -0
- package/dist/preflight/pdfx.js.map +1 -0
- package/dist/preflight/reader.d.ts +126 -0
- package/dist/preflight/reader.js +832 -0
- package/dist/preflight/reader.js.map +1 -0
- package/dist/preflight/xmp.d.ts +30 -0
- package/dist/preflight/xmp.js +145 -0
- package/dist/preflight/xmp.js.map +1 -0
- package/dist/print/index.d.ts +2 -0
- package/dist/print/index.js +3 -0
- package/dist/print/index.js.map +1 -0
- package/dist/print/output.d.ts +5 -0
- package/dist/print/output.js +215 -0
- package/dist/print/output.js.map +1 -0
- package/dist/problem.d.ts +142 -0
- package/dist/problem.js +234 -0
- package/dist/problem.js.map +1 -0
- package/dist/profile/index.d.ts +10 -0
- package/dist/profile/index.js +11 -0
- package/dist/profile/index.js.map +1 -0
- package/dist/profile/lint.d.ts +69 -0
- package/dist/profile/lint.js +282 -0
- package/dist/profile/lint.js.map +1 -0
- package/dist/profile/metadata.d.ts +27 -0
- package/dist/profile/metadata.js +38 -0
- package/dist/profile/metadata.js.map +1 -0
- package/dist/profile/profile.d.ts +92 -0
- package/dist/profile/profile.js +282 -0
- package/dist/profile/profile.js.map +1 -0
- package/dist/project.d.ts +56 -0
- package/dist/project.js +137 -0
- package/dist/project.js.map +1 -0
- package/dist/reproducible/clock.d.ts +46 -0
- package/dist/reproducible/clock.js +173 -0
- package/dist/reproducible/clock.js.map +1 -0
- package/dist/reproducible/date.d.ts +42 -0
- package/dist/reproducible/date.js +82 -0
- package/dist/reproducible/date.js.map +1 -0
- package/dist/reproducible/index.d.ts +8 -0
- package/dist/reproducible/index.js +9 -0
- package/dist/reproducible/index.js.map +1 -0
- package/dist/spike/spike-page.chromium.json +330 -0
- package/dist/spike/spike.d.ts +75 -0
- package/dist/spike/spike.js +106 -0
- package/dist/spike/spike.js.map +1 -0
- package/dist/style/borders.d.ts +25 -0
- package/dist/style/borders.js +177 -0
- package/dist/style/borders.js.map +1 -0
- package/dist/style/colours.d.ts +34 -0
- package/dist/style/colours.js +138 -0
- package/dist/style/colours.js.map +1 -0
- package/dist/style/compile.d.ts +79 -0
- package/dist/style/compile.js +325 -0
- package/dist/style/compile.js.map +1 -0
- package/dist/style/defaults.d.ts +20 -0
- package/dist/style/defaults.js +45 -0
- package/dist/style/defaults.js.map +1 -0
- package/dist/style/gcpm.d.ts +22 -0
- package/dist/style/gcpm.js +86 -0
- package/dist/style/gcpm.js.map +1 -0
- package/dist/style/index.d.ts +4 -0
- package/dist/style/index.js +5 -0
- package/dist/style/index.js.map +1 -0
- package/dist/style/media.d.ts +22 -0
- package/dist/style/media.js +342 -0
- package/dist/style/media.js.map +1 -0
- package/dist/style/properties.d.ts +44 -0
- package/dist/style/properties.js +497 -0
- package/dist/style/properties.js.map +1 -0
- package/dist/style/scope.d.ts +6 -0
- package/dist/style/scope.js +134 -0
- package/dist/style/scope.js.map +1 -0
- package/dist/style/values.d.ts +45 -0
- package/dist/style/values.js +106 -0
- package/dist/style/values.js.map +1 -0
- package/dist/test/book.d.ts +180 -0
- package/dist/test/book.js +314 -0
- package/dist/test/book.js.map +1 -0
- package/dist/test/build.d.ts +58 -0
- package/dist/test/build.js +222 -0
- package/dist/test/build.js.map +1 -0
- package/dist/test/environment.d.ts +63 -0
- package/dist/test/environment.js +46 -0
- package/dist/test/environment.js.map +1 -0
- package/dist/test/index.d.ts +17 -0
- package/dist/test/index.js +18 -0
- package/dist/test/index.js.map +1 -0
- package/dist/test/indexes.d.ts +4 -0
- package/dist/test/indexes.js +48 -0
- package/dist/test/indexes.js.map +1 -0
- package/dist/test/layout.d.ts +8 -0
- package/dist/test/layout.js +121 -0
- package/dist/test/layout.js.map +1 -0
- package/dist/test/matchers.d.ts +80 -0
- package/dist/test/matchers.js +177 -0
- package/dist/test/matchers.js.map +1 -0
- package/dist/test/pipeline.d.ts +231 -0
- package/dist/test/pipeline.js +75 -0
- package/dist/test/pipeline.js.map +1 -0
- package/dist/test/plugins.d.ts +13 -0
- package/dist/test/plugins.js +22 -0
- package/dist/test/plugins.js.map +1 -0
- package/dist/test/render.d.ts +46 -0
- package/dist/test/render.js +149 -0
- package/dist/test/render.js.map +1 -0
- package/dist/test/runner.d.ts +61 -0
- package/dist/test/runner.js +256 -0
- package/dist/test/runner.js.map +1 -0
- package/dist/test/select.d.ts +54 -0
- package/dist/test/select.js +193 -0
- package/dist/test/select.js.map +1 -0
- package/dist/test/snapshot.d.ts +52 -0
- package/dist/test/snapshot.js +175 -0
- package/dist/test/snapshot.js.map +1 -0
- package/dist/test/text.d.ts +7 -0
- package/dist/test/text.js +46 -0
- package/dist/test/text.js.map +1 -0
- package/dist/test/vitest.d.ts +3 -0
- package/dist/test/vitest.js +39 -0
- package/dist/test/vitest.js.map +1 -0
- package/dist/text/index.d.ts +5 -0
- package/dist/text/index.js +6 -0
- package/dist/text/index.js.map +1 -0
- package/dist/text/output.d.ts +5 -0
- package/dist/text/output.js +39 -0
- package/dist/text/output.js.map +1 -0
- package/dist/text/render.d.ts +82 -0
- package/dist/text/render.js +583 -0
- package/dist/text/render.js.map +1 -0
- package/dist/text/width.d.ts +16 -0
- package/dist/text/width.js +90 -0
- package/dist/text/width.js.map +1 -0
- package/dist/text/wrap.d.ts +19 -0
- package/dist/text/wrap.js +151 -0
- package/dist/text/wrap.js.map +1 -0
- package/dist/transform/core.d.ts +19 -0
- package/dist/transform/core.js +22 -0
- package/dist/transform/core.js.map +1 -0
- package/dist/transform/index.d.ts +10 -0
- package/dist/transform/index.js +11 -0
- package/dist/transform/index.js.map +1 -0
- package/dist/transform/numbering.d.ts +47 -0
- package/dist/transform/numbering.js +142 -0
- package/dist/transform/numbering.js.map +1 -0
- package/dist/transform/references.d.ts +38 -0
- package/dist/transform/references.js +182 -0
- package/dist/transform/references.js.map +1 -0
- package/dist/transform/run.d.ts +32 -0
- package/dist/transform/run.js +210 -0
- package/dist/transform/run.js.map +1 -0
- package/dist/transform/store.d.ts +111 -0
- package/dist/transform/store.js +331 -0
- package/dist/transform/store.js.map +1 -0
- package/dist/transform/testing.d.ts +31 -0
- package/dist/transform/testing.js +76 -0
- package/dist/transform/testing.js.map +1 -0
- package/dist/transform/transform.d.ts +104 -0
- package/dist/transform/transform.js +89 -0
- package/dist/transform/transform.js.map +1 -0
- package/dist/vfs/fsa.d.ts +14 -0
- package/dist/vfs/fsa.js +123 -0
- package/dist/vfs/fsa.js.map +1 -0
- package/dist/vfs/index.d.ts +7 -0
- package/dist/vfs/index.js +8 -0
- package/dist/vfs/index.js.map +1 -0
- package/dist/vfs/memory.d.ts +15 -0
- package/dist/vfs/memory.js +101 -0
- package/dist/vfs/memory.js.map +1 -0
- package/dist/vfs/path.d.ts +30 -0
- package/dist/vfs/path.js +67 -0
- package/dist/vfs/path.js.map +1 -0
- package/dist/vfs/vfs.d.ts +66 -0
- package/dist/vfs/vfs.js +68 -0
- package/dist/vfs/vfs.js.map +1 -0
- package/dist/vfs/zip.d.ts +27 -0
- package/dist/vfs/zip.js +67 -0
- package/dist/vfs/zip.js.map +1 -0
- package/dist/web/css.d.ts +15 -0
- package/dist/web/css.js +80 -0
- package/dist/web/css.js.map +1 -0
- package/dist/web/hast.d.ts +44 -0
- package/dist/web/hast.js +175 -0
- package/dist/web/hast.js.map +1 -0
- package/dist/web/index.d.ts +11 -0
- package/dist/web/index.js +12 -0
- package/dist/web/index.js.map +1 -0
- package/dist/web/justify-main.d.ts +1 -0
- package/dist/web/justify-main.js +38 -0
- package/dist/web/justify-main.js.map +1 -0
- package/dist/web/justify.d.ts +46 -0
- package/dist/web/justify.js +147 -0
- package/dist/web/justify.js.map +1 -0
- package/dist/web/output.d.ts +28 -0
- package/dist/web/output.js +251 -0
- package/dist/web/output.js.map +1 -0
- package/dist/web/runtime/LICENSE-harfbuzzjs.txt +19 -0
- package/dist/web/runtime/NOTICE-patterns.txt +429 -0
- package/dist/web/runtime/harfbuzz.wasm +0 -0
- package/dist/web/runtime/justify.js.txt +2 -0
- package/dist/web/site.d.ts +53 -0
- package/dist/web/site.js +219 -0
- package/dist/web/site.js.map +1 -0
- package/docs/README.md +16 -0
- package/docs/reference/css-properties/index.md +94 -0
- package/docs/reference/css-properties/pw-adj-demerits.md +22 -0
- package/docs/reference/css-properties/pw-border-bottom-width.md +24 -0
- package/docs/reference/css-properties/pw-border-left-width.md +24 -0
- package/docs/reference/css-properties/pw-border-right-width.md +24 -0
- package/docs/reference/css-properties/pw-border-top-width.md +24 -0
- package/docs/reference/css-properties/pw-box.md +28 -0
- package/docs/reference/css-properties/pw-broken-penalty.md +22 -0
- package/docs/reference/css-properties/pw-club-penalty.md +24 -0
- package/docs/reference/css-properties/pw-column-rule-width.md +23 -0
- package/docs/reference/css-properties/pw-content-after.md +31 -0
- package/docs/reference/css-properties/pw-content-before.md +31 -0
- package/docs/reference/css-properties/pw-double-hyphen-demerits.md +23 -0
- package/docs/reference/css-properties/pw-emergency-stretch.md +28 -0
- package/docs/reference/css-properties/pw-ex-hyphen-penalty.md +22 -0
- package/docs/reference/css-properties/pw-final-hyphen-demerits.md +22 -0
- package/docs/reference/css-properties/pw-float-skip.md +22 -0
- package/docs/reference/css-properties/pw-float.md +33 -0
- package/docs/reference/css-properties/pw-footnote-max-height.md +22 -0
- package/docs/reference/css-properties/pw-footnote-skip.md +23 -0
- package/docs/reference/css-properties/pw-hyphen-penalty.md +24 -0
- package/docs/reference/css-properties/pw-inter-line-penalty.md +24 -0
- package/docs/reference/css-properties/pw-leader-space.md +22 -0
- package/docs/reference/css-properties/pw-leader.md +29 -0
- package/docs/reference/css-properties/pw-left-hyphen-min.md +23 -0
- package/docs/reference/css-properties/pw-line-breaking.md +29 -0
- package/docs/reference/css-properties/pw-line-penalty.md +23 -0
- package/docs/reference/css-properties/pw-list-indent.md +18 -0
- package/docs/reference/css-properties/pw-looseness.md +30 -0
- package/docs/reference/css-properties/pw-max-depth.md +22 -0
- package/docs/reference/css-properties/pw-minipage-footnotes.md +23 -0
- package/docs/reference/css-properties/pw-orphans.md +24 -0
- package/docs/reference/css-properties/pw-outline-width.md +23 -0
- package/docs/reference/css-properties/pw-overprint.md +26 -0
- package/docs/reference/css-properties/pw-padding-bottom.md +22 -0
- package/docs/reference/css-properties/pw-padding-left.md +22 -0
- package/docs/reference/css-properties/pw-padding-right.md +22 -0
- package/docs/reference/css-properties/pw-padding-top.md +22 -0
- package/docs/reference/css-properties/pw-page-prefix.md +28 -0
- package/docs/reference/css-properties/pw-page.md +32 -0
- package/docs/reference/css-properties/pw-penalty-after.md +23 -0
- package/docs/reference/css-properties/pw-penalty-before.md +30 -0
- package/docs/reference/css-properties/pw-pretolerance.md +23 -0
- package/docs/reference/css-properties/pw-right-hyphen-min.md +22 -0
- package/docs/reference/css-properties/pw-running.md +23 -0
- package/docs/reference/css-properties/pw-site-background.md +21 -0
- package/docs/reference/css-properties/pw-site-link.md +17 -0
- package/docs/reference/css-properties/pw-site-measure.md +17 -0
- package/docs/reference/css-properties/pw-site-muted.md +21 -0
- package/docs/reference/css-properties/pw-site-rule.md +17 -0
- package/docs/reference/css-properties/pw-site-text.md +22 -0
- package/docs/reference/css-properties/pw-space-after.md +23 -0
- package/docs/reference/css-properties/pw-space-before.md +29 -0
- package/docs/reference/css-properties/pw-string-set.md +32 -0
- package/docs/reference/css-properties/pw-tolerance.md +33 -0
- package/docs/reference/css-properties/pw-top-skip.md +22 -0
- package/docs/reference/css-properties/pw-widow-penalty.md +32 -0
- package/docs/reference/css-properties/pw-widows.md +24 -0
- package/docs/reference/css-properties/pw-word-space.md +22 -0
- package/docs/reference/css-properties/pw-xspace.md +22 -0
- package/docs/reference/index.md +17 -0
- package/docs/reference/lint-rules/black-text.md +31 -0
- package/docs/reference/lint-rules/blank-page.md +35 -0
- package/docs/reference/lint-rules/chapter-verso.md +34 -0
- package/docs/reference/lint-rules/citation-in-heading.md +24 -0
- package/docs/reference/lint-rules/consecutive-hyphens.md +34 -0
- package/docs/reference/lint-rules/empty-link.md +32 -0
- package/docs/reference/lint-rules/figure-distance.md +34 -0
- package/docs/reference/lint-rules/fonts.md +24 -0
- package/docs/reference/lint-rules/generated-text.md +24 -0
- package/docs/reference/lint-rules/heading-levels.md +30 -0
- package/docs/reference/lint-rules/ibid-across-page.md +30 -0
- package/docs/reference/lint-rules/image-alt.md +30 -0
- package/docs/reference/lint-rules/image-resolution.md +34 -0
- package/docs/reference/lint-rules/index.md +120 -0
- package/docs/reference/lint-rules/ink-limit.md +30 -0
- package/docs/reference/lint-rules/missing-field.md +37 -0
- package/docs/reference/lint-rules/orphan.md +34 -0
- package/docs/reference/lint-rules/overfull-line.md +28 -0
- package/docs/reference/lint-rules/profile.md +24 -0
- package/docs/reference/lint-rules/raw-html.md +30 -0
- package/docs/reference/lint-rules/signature.md +34 -0
- package/docs/reference/lint-rules/straight-quotes.md +33 -0
- package/docs/reference/lint-rules/svg-use-css.md +24 -0
- package/docs/reference/lint-rules/underfull-line.md +35 -0
- package/docs/reference/lint-rules/unknown-citation.md +30 -0
- package/docs/reference/lint-rules/unknown-label.md +31 -0
- package/docs/reference/lint-rules/unpaintable.md +24 -0
- package/docs/reference/lint-rules/unplaced-index.md +31 -0
- package/docs/reference/lint-rules/unused-entry.md +38 -0
- package/docs/reference/lint-rules/widow.md +34 -0
- package/docs/reference/plugin-api/assert-no-errors.md +18 -0
- package/docs/reference/plugin-api/asset-processor.md +28 -0
- package/docs/reference/plugin-api/attribute-problem.md +26 -0
- package/docs/reference/plugin-api/attribute-type.md +18 -0
- package/docs/reference/plugin-api/capabilities.md +18 -0
- package/docs/reference/plugin-api/capability.md +22 -0
- package/docs/reference/plugin-api/check-attributes.md +18 -0
- package/docs/reference/plugin-api/claim-kind.md +20 -0
- package/docs/reference/plugin-api/combine-penalties.md +17 -0
- package/docs/reference/plugin-api/command-context.md +30 -0
- package/docs/reference/plugin-api/command-definition.md +34 -0
- package/docs/reference/plugin-api/core-claims.md +18 -0
- package/docs/reference/plugin-api/define-plugin.md +20 -0
- package/docs/reference/plugin-api/define-rule.md +19 -0
- package/docs/reference/plugin-api/describe-error.md +14 -0
- package/docs/reference/plugin-api/describe-node.md +14 -0
- package/docs/reference/plugin-api/empty-registry.md +18 -0
- package/docs/reference/plugin-api/failed-on.md +32 -0
- package/docs/reference/plugin-api/fails-as.md +18 -0
- package/docs/reference/plugin-api/import-plugins.md +20 -0
- package/docs/reference/plugin-api/import-text.md +14 -0
- package/docs/reference/plugin-api/index.md +123 -0
- package/docs/reference/plugin-api/layout-definition.md +42 -0
- package/docs/reference/plugin-api/layout-slot.md +28 -0
- package/docs/reference/plugin-api/line-breaker.md +18 -0
- package/docs/reference/plugin-api/lint-context.md +48 -0
- package/docs/reference/plugin-api/lint-definition.md +32 -0
- package/docs/reference/plugin-api/lint-edition.md +38 -0
- package/docs/reference/plugin-api/lint-fix.md +36 -0
- package/docs/reference/plugin-api/lint-level.md +20 -0
- package/docs/reference/plugin-api/lint-preset.md +30 -0
- package/docs/reference/plugin-api/lint-rule.md +42 -0
- package/docs/reference/plugin-api/load-failure.md +32 -0
- package/docs/reference/plugin-api/load-plugins-options.md +32 -0
- package/docs/reference/plugin-api/load-plugins.md +20 -0
- package/docs/reference/plugin-api/loaded-plugin.md +32 -0
- package/docs/reference/plugin-api/node-claim.md +34 -0
- package/docs/reference/plugin-api/output-definition.md +28 -0
- package/docs/reference/plugin-api/owned.md +28 -0
- package/docs/reference/plugin-api/page-builder-hook.md +18 -0
- package/docs/reference/plugin-api/penalty-rule.md +34 -0
- package/docs/reference/plugin-api/plugin-api.md +18 -0
- package/docs/reference/plugin-api/plugin-definition.md +66 -0
- package/docs/reference/plugin-api/plugin-error.md +22 -0
- package/docs/reference/plugin-api/plugin-failure.md +30 -0
- package/docs/reference/plugin-api/plugin-importer.md +34 -0
- package/docs/reference/plugin-api/plugin-problem.md +30 -0
- package/docs/reference/plugin-api/plugin-registry.md +83 -0
- package/docs/reference/plugin-api/plugin-scope.md +15 -0
- package/docs/reference/plugin-api/plugin-stage.md +18 -0
- package/docs/reference/plugin-api/plugin-threw-problem.md +34 -0
- package/docs/reference/plugin-api/plugin-threw.md +21 -0
- package/docs/reference/plugin-api/plugin.md +69 -0
- package/docs/reference/plugin-api/project-with-plugins.md +36 -0
- package/docs/reference/plugin-api/read-context.md +30 -0
- package/docs/reference/plugin-api/read-failure.md +18 -0
- package/docs/reference/plugin-api/read-plugin-styles.md +22 -0
- package/docs/reference/plugin-api/reader.md +22 -0
- package/docs/reference/plugin-api/register-options.md +28 -0
- package/docs/reference/plugin-api/register-plugins.md +20 -0
- package/docs/reference/plugin-api/render-format.md +18 -0
- package/docs/reference/plugin-api/render-formats.md +18 -0
- package/docs/reference/plugin-api/renderer-registry.md +18 -0
- package/docs/reference/plugin-api/renderer-set.md +34 -0
- package/docs/reference/plugin-api/renderers.md +34 -0
- package/docs/reference/plugin-api/specifier-kind.md +14 -0
- package/docs/reference/plugin-api/style-source.md +18 -0
- package/docs/reference/plugin-api/text-context.md +28 -0
- package/docs/reference/plugin-api/text-edit.md +28 -0
- package/docs/reference/plugin-api/text-renderer.md +24 -0
- package/docs/reference/plugin-api/try-plugin-async.md +18 -0
- package/docs/reference/plugin-api/try-plugin.md +20 -0
- package/docs/reference/pulpweaver4-toml/editions.md +208 -0
- package/docs/reference/pulpweaver4-toml/index.md +195 -0
- package/docs/reference/pulpweaver4-toml/inks.md +50 -0
- package/docs/reference/pulpweaver4-toml/lint.md +36 -0
- package/docs/reference/test-matchers/index.md +33 -0
- package/docs/reference/test-matchers/to-be-recto.md +20 -0
- package/docs/reference/test-matchers/to-cite.md +22 -0
- package/docs/reference/test-matchers/to-fit-on-one-page.md +20 -0
- package/docs/reference/test-matchers/to-have-no-overfull-lines.md +20 -0
- package/docs/reference/test-matchers/to-match-html-snapshot.md +20 -0
- package/docs/reference/test-matchers/to-match-page-snapshot.md +20 -0
- package/docs/reference/test-matchers/to-match-text-snapshot.md +21 -0
- package/docs/reference/test-matchers/to-start-page.md +20 -0
- package/package.json +75 -4
- package/README.md +0 -3
|
@@ -0,0 +1,765 @@
|
|
|
1
|
+
import { didYouMean, problemAt } from '../problem.js';
|
|
2
|
+
import { dateSortKey } from './dates.js';
|
|
3
|
+
import { finish, isEmpty, leaves, plain, richText, seq, text } from './ir.js';
|
|
4
|
+
import { affixIr, affixText, hasAffix } from './affix.js';
|
|
5
|
+
import { initialize, nameSortKeys, sameName } from './names.js';
|
|
6
|
+
import { numericTokens } from './numbers.js';
|
|
7
|
+
import { inheritedNameOptions, locatorTerm, newItemState, Renderer, yearSuffixLetters, } from './render.js';
|
|
8
|
+
/**
|
|
9
|
+
* Positions in the simple sequential case: each cite against the cites
|
|
10
|
+
* before it, in the order given (“Choose”, `position`). Citations' note
|
|
11
|
+
* numbers measure `near-note` distance; one outside a note is near none.
|
|
12
|
+
*/
|
|
13
|
+
export function computePositions(citations, nearNoteDistance = 5) {
|
|
14
|
+
const firstNote = new Map();
|
|
15
|
+
const lastNote = new Map();
|
|
16
|
+
const seen = new Set();
|
|
17
|
+
const out = [];
|
|
18
|
+
let previous;
|
|
19
|
+
citations.forEach((citation) => {
|
|
20
|
+
// Outside notes, nothing is near-note (0 or no note number).
|
|
21
|
+
const note = citation.noteNumber || undefined;
|
|
22
|
+
const positions = [];
|
|
23
|
+
citation.cites.forEach((cite, k) => {
|
|
24
|
+
let position = 'first';
|
|
25
|
+
let nearNote = false;
|
|
26
|
+
if (seen.has(cite.id)) {
|
|
27
|
+
const prev = k > 0 ? citation.cites[k - 1] : previous?.length === 1 ? previous[0] : undefined;
|
|
28
|
+
position = 'subsequent';
|
|
29
|
+
if (prev && prev.id === cite.id) {
|
|
30
|
+
const same = (prev.locator ?? '') === (cite.locator ?? '') && locatorTerm(prev.label) === locatorTerm(cite.label);
|
|
31
|
+
if (!prev.locator)
|
|
32
|
+
position = cite.locator ? 'ibid-with-locator' : 'ibid';
|
|
33
|
+
else if (cite.locator)
|
|
34
|
+
position = same ? 'ibid' : 'ibid-with-locator';
|
|
35
|
+
}
|
|
36
|
+
const last = lastNote.get(cite.id);
|
|
37
|
+
nearNote = note !== undefined && last !== undefined && note - last <= nearNoteDistance;
|
|
38
|
+
}
|
|
39
|
+
positions.push({ position, nearNote, firstReferenceNoteNumber: firstNote.get(cite.id) });
|
|
40
|
+
if (note !== undefined)
|
|
41
|
+
lastNote.set(cite.id, note);
|
|
42
|
+
if (!seen.has(cite.id)) {
|
|
43
|
+
seen.add(cite.id);
|
|
44
|
+
if (note !== undefined)
|
|
45
|
+
firstNote.set(cite.id, note);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
if (citation.cites.length > 0)
|
|
49
|
+
previous = citation.cites;
|
|
50
|
+
out.push(positions);
|
|
51
|
+
});
|
|
52
|
+
return out;
|
|
53
|
+
}
|
|
54
|
+
/** A CSL processor for one style, locale and bibliography. */
|
|
55
|
+
export class CslProcessor {
|
|
56
|
+
style;
|
|
57
|
+
locale;
|
|
58
|
+
items;
|
|
59
|
+
collator;
|
|
60
|
+
defaultEnglish;
|
|
61
|
+
constructor(options) {
|
|
62
|
+
this.style = options.style;
|
|
63
|
+
this.locale = options.locale;
|
|
64
|
+
const items = options.items;
|
|
65
|
+
if (items instanceof Map)
|
|
66
|
+
this.items = items;
|
|
67
|
+
else {
|
|
68
|
+
const map = new Map();
|
|
69
|
+
for (const item of items)
|
|
70
|
+
map.set(item.id, item);
|
|
71
|
+
this.items = map;
|
|
72
|
+
}
|
|
73
|
+
let collator;
|
|
74
|
+
try {
|
|
75
|
+
collator = new Intl.Collator(options.locale.lang, { sensitivity: 'base' });
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
collator = new Intl.Collator('en-US', { sensitivity: 'base' });
|
|
79
|
+
}
|
|
80
|
+
this.collator = collator;
|
|
81
|
+
const defaultLocale = this.style.defaultLocale;
|
|
82
|
+
this.defaultEnglish = !defaultLocale || /^en\b/i.test(defaultLocale);
|
|
83
|
+
}
|
|
84
|
+
/** `missing-item`, if the bibliography has no item `id`: what a citation of it is reported with, a near id its fix. */
|
|
85
|
+
missing(id) {
|
|
86
|
+
if (this.items.has(id))
|
|
87
|
+
return undefined;
|
|
88
|
+
const near = didYouMean(id, this.items.keys());
|
|
89
|
+
return {
|
|
90
|
+
severity: 'error', code: 'missing-item', message: `no item “${id}” in the bibliography`,
|
|
91
|
+
fix: near === undefined ? 'add it to a bibliography pulpweaver4.toml names, or check the key' : `did you mean “${near}”?`,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/** Renders a document's citations, in order, and its bibliography. */
|
|
95
|
+
process(citations, options = {}) {
|
|
96
|
+
const problems = [];
|
|
97
|
+
const positions = computePositions(citations, Number(this.style.citation?.options['near-note-distance'] ?? 5));
|
|
98
|
+
// The items in order of first citation, then those listed uncited.
|
|
99
|
+
const registered = [];
|
|
100
|
+
const seen = new Set();
|
|
101
|
+
citations.forEach((c, ci) => c.cites.forEach((cite, k) => {
|
|
102
|
+
const missing = this.missing(cite.id);
|
|
103
|
+
if (missing) {
|
|
104
|
+
problems.push({ ...problemAt(cite.source, missing), citation: ci, cite: k });
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (!seen.has(cite.id)) {
|
|
108
|
+
seen.add(cite.id);
|
|
109
|
+
registered.push(cite.id);
|
|
110
|
+
}
|
|
111
|
+
}));
|
|
112
|
+
const uncited = options.uncited === 'all' ? [...this.items.keys()] : (options.uncited ?? []);
|
|
113
|
+
for (const id of uncited) {
|
|
114
|
+
if (!seen.has(id) && this.items.has(id)) {
|
|
115
|
+
seen.add(id);
|
|
116
|
+
registered.push(id);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
const states = new Map(registered.map((id) => [id, newItemState()]));
|
|
120
|
+
// Citation numbers first follow the citations, for a sort by citation number.
|
|
121
|
+
registered.forEach((id, i) => (states.get(id).citationNumber = i + 1));
|
|
122
|
+
let order = this.sortItems(registered, this.style.bibliography, 'bibliography', states);
|
|
123
|
+
order.forEach((id, i) => (states.get(id).citationNumber = i + 1));
|
|
124
|
+
const globalLevel = this.disambiguate(order, states);
|
|
125
|
+
// The bibliography's order may depend on what disambiguation added.
|
|
126
|
+
order = this.sortItems(registered, this.style.bibliography, 'bibliography', states);
|
|
127
|
+
const rendered = citations.map((citation, ci) => this.citation(citation, positions[ci], states, globalLevel));
|
|
128
|
+
const bibliography = this.style.bibliography ? this.bibliography(order, states, globalLevel) : undefined;
|
|
129
|
+
return { citations: rendered, bibliography, problems };
|
|
130
|
+
}
|
|
131
|
+
// Sorting.
|
|
132
|
+
sortItems(ids, context, area, states) {
|
|
133
|
+
if (!context?.sort || context.sort.length === 0)
|
|
134
|
+
return [...ids];
|
|
135
|
+
const keyed = ids.map((id, index) => ({ id, index, keys: context.sort.map((k) => this.sortValue(id, k, area, states.get(id))) }));
|
|
136
|
+
keyed.sort((a, b) => this.compareKeys(a.keys, b.keys, context.sort) || a.index - b.index);
|
|
137
|
+
return keyed.map((k) => k.id);
|
|
138
|
+
}
|
|
139
|
+
compareKeys(a, b, keys) {
|
|
140
|
+
for (let i = 0; i < keys.length; i++) {
|
|
141
|
+
const x = a[i];
|
|
142
|
+
const y = b[i];
|
|
143
|
+
// Empty values go last, ascending or descending.
|
|
144
|
+
if (x === undefined && y === undefined)
|
|
145
|
+
continue;
|
|
146
|
+
if (x === undefined)
|
|
147
|
+
return 1;
|
|
148
|
+
if (y === undefined)
|
|
149
|
+
return -1;
|
|
150
|
+
let c;
|
|
151
|
+
if (x.kind === 'number' && y.kind === 'number')
|
|
152
|
+
c = x.value - y.value;
|
|
153
|
+
else if (x.kind === 'raw' && y.kind === 'raw')
|
|
154
|
+
c = x.value < y.value ? -1 : x.value > y.value ? 1 : 0;
|
|
155
|
+
else
|
|
156
|
+
c = this.collator.compare(sortable(String(x.value)), sortable(String(y.value)));
|
|
157
|
+
if (c !== 0)
|
|
158
|
+
return keys[i].descending ? -c : c;
|
|
159
|
+
}
|
|
160
|
+
return 0;
|
|
161
|
+
}
|
|
162
|
+
sortValue(id, key, area, state) {
|
|
163
|
+
const item = this.items.get(id);
|
|
164
|
+
const env = {
|
|
165
|
+
style: this.style,
|
|
166
|
+
locale: this.locale,
|
|
167
|
+
area,
|
|
168
|
+
defaultEnglish: this.defaultEnglish,
|
|
169
|
+
sorting: { namesMin: key.namesMin, namesUseFirst: key.namesUseFirst, namesUseLast: key.namesUseLast },
|
|
170
|
+
};
|
|
171
|
+
if (key.macro !== undefined) {
|
|
172
|
+
const macro = this.style.macros.get(key.macro);
|
|
173
|
+
if (!macro)
|
|
174
|
+
return undefined;
|
|
175
|
+
const r = new Renderer(env, item, { position: 'first', nearNote: false }, state);
|
|
176
|
+
const s = plain(r.layout({ children: macro })).trim();
|
|
177
|
+
return s === '' ? undefined : { kind: 'text', value: s };
|
|
178
|
+
}
|
|
179
|
+
const v = key.variable;
|
|
180
|
+
if (v === undefined)
|
|
181
|
+
return undefined;
|
|
182
|
+
if (v === 'citation-number')
|
|
183
|
+
return state.citationNumber === undefined ? undefined : { kind: 'number', value: state.citationNumber };
|
|
184
|
+
// The variable as rendering sees it: a made-up citation label, editor-translator and the like.
|
|
185
|
+
const value = new Renderer(env, item, { position: 'first', nearNote: false }, state).raw(v);
|
|
186
|
+
if (value === undefined || value === '')
|
|
187
|
+
return undefined;
|
|
188
|
+
if (Array.isArray(value)) {
|
|
189
|
+
const demote = this.style.options['demote-non-dropping-particle'] ?? 'display-and-sort';
|
|
190
|
+
const names = value.filter((n) => n.literal !== 'others');
|
|
191
|
+
return { kind: 'text', value: names.map((n) => nameSortKeys(n, demote).filter(Boolean).join(' ')).join(', ') };
|
|
192
|
+
}
|
|
193
|
+
if (typeof value === 'object') {
|
|
194
|
+
const s = dateSortKey(value);
|
|
195
|
+
return s === '' ? undefined : { kind: 'raw', value: s };
|
|
196
|
+
}
|
|
197
|
+
const s = String(value);
|
|
198
|
+
const tokens = numericTokens(s);
|
|
199
|
+
const first = tokens?.find((t) => t.kind === 'number');
|
|
200
|
+
if (first && first.kind === 'number')
|
|
201
|
+
return { kind: 'number', value: first.value };
|
|
202
|
+
const text = plain(richText(s));
|
|
203
|
+
return text === '' ? undefined : { kind: 'text', value: text };
|
|
204
|
+
}
|
|
205
|
+
// Rendering.
|
|
206
|
+
defaultLabel(item, cite) {
|
|
207
|
+
if (cite.label)
|
|
208
|
+
return cite.label;
|
|
209
|
+
const pagination = item.custom?.pagination;
|
|
210
|
+
return pagination && pagination !== 'none' ? pagination : undefined;
|
|
211
|
+
}
|
|
212
|
+
/** Renders a cite: the layout for an item. */
|
|
213
|
+
renderCite(item, cite, position, state, globalLevel, extra = {}) {
|
|
214
|
+
const ctx = {
|
|
215
|
+
locator: cite.locator,
|
|
216
|
+
label: this.defaultLabel(item, cite),
|
|
217
|
+
position: position.position,
|
|
218
|
+
nearNote: position.nearNote,
|
|
219
|
+
firstReferenceNoteNumber: position.firstReferenceNoteNumber,
|
|
220
|
+
suppressAuthor: cite.suppressAuthor,
|
|
221
|
+
...extra,
|
|
222
|
+
};
|
|
223
|
+
const r = new Renderer(this.envWith('citation', globalLevel), item, ctx, state);
|
|
224
|
+
r.ir = r.layout(this.style.citation.layout);
|
|
225
|
+
if (cite.authorOnly)
|
|
226
|
+
r.ir = r.firstNames ?? text('');
|
|
227
|
+
return r;
|
|
228
|
+
}
|
|
229
|
+
envWith(area, globalLevel) {
|
|
230
|
+
return {
|
|
231
|
+
style: this.style,
|
|
232
|
+
locale: this.locale,
|
|
233
|
+
area,
|
|
234
|
+
defaultEnglish: this.defaultEnglish,
|
|
235
|
+
globalLevel: globalLevel?.fn,
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
citation(citation, positions, states, globalLevel) {
|
|
239
|
+
const context = this.style.citation;
|
|
240
|
+
const layout = context.layout;
|
|
241
|
+
const options = context.options;
|
|
242
|
+
let cites = citation.cites.map((input, index) => {
|
|
243
|
+
const item = this.items.get(input.id);
|
|
244
|
+
const state = states.get(input.id);
|
|
245
|
+
return {
|
|
246
|
+
input,
|
|
247
|
+
position: { ...positions[index], ...pick(input) },
|
|
248
|
+
item,
|
|
249
|
+
state,
|
|
250
|
+
index,
|
|
251
|
+
r: item && state ? this.renderCite(item, input, { ...positions[index], ...pick(input) }, state, globalLevel) : undefined,
|
|
252
|
+
};
|
|
253
|
+
});
|
|
254
|
+
// Sorting cites within the citation.
|
|
255
|
+
if (context.sort && context.sort.length > 0 && cites.length > 1) {
|
|
256
|
+
const keyed = cites.map((c) => ({ c, keys: c.item ? context.sort.map((k) => this.sortValue(c.input.id, k, 'citation', c.state)) : [] }));
|
|
257
|
+
keyed.sort((a, b) => this.compareKeys(a.keys, b.keys, context.sort) || a.c.index - b.c.index);
|
|
258
|
+
cites = keyed.map((k) => k.c);
|
|
259
|
+
}
|
|
260
|
+
const delimiter = layout.delimiter ?? '';
|
|
261
|
+
const collapse = options.collapse;
|
|
262
|
+
const groupDelimiter = options['cite-group-delimiter'];
|
|
263
|
+
const afterCollapse = options['after-collapse-delimiter'] ?? delimiter;
|
|
264
|
+
const capitalize = citation.capitalize ?? this.style.class === 'note';
|
|
265
|
+
const capitalizePrefix = citation.capitalize === true;
|
|
266
|
+
const withAffixes = (c, ir, initial = false) => {
|
|
267
|
+
const parts = [];
|
|
268
|
+
if (hasAffix(c.input.prefix))
|
|
269
|
+
parts.push(initial ? capitalizeFirst(affixIr(c.input.prefix)) : affixIr(c.input.prefix));
|
|
270
|
+
parts.push(ir);
|
|
271
|
+
if (hasAffix(c.input.suffix))
|
|
272
|
+
parts.push(affixIr(c.input.suffix));
|
|
273
|
+
return parts.length === 1 ? ir : seq(parts);
|
|
274
|
+
};
|
|
275
|
+
const output = (c) => {
|
|
276
|
+
if (!c.r)
|
|
277
|
+
return seq([text(c.input.id)], { formatting: { fontWeight: 'bold' } });
|
|
278
|
+
// A term that starts a sentence: at the citation's start or after a prefix that ends one.
|
|
279
|
+
const prefix = affixText(c.input.prefix).trim();
|
|
280
|
+
const startsSentence = prefix
|
|
281
|
+
? /\s\S+[.!?][”’"')\]]*$/.test(` ${prefix}`) && /\S\s+\S/.test(prefix)
|
|
282
|
+
: c === cites[0] && !hasAffix(citation.prefix);
|
|
283
|
+
if (capitalize && startsSentence) {
|
|
284
|
+
const first = leaves(c.r.ir).find((l) => l.text !== '');
|
|
285
|
+
if (first?.term)
|
|
286
|
+
first.text = first.text.charAt(0).toUpperCase() + first.text.slice(1);
|
|
287
|
+
}
|
|
288
|
+
// A prefix that starts the sentence starts with a capital.
|
|
289
|
+
return withAffixes(c, seq([c.r.ir], { role: 'cite' }), capitalizePrefix && c === cites[0] && !hasAffix(citation.prefix));
|
|
290
|
+
};
|
|
291
|
+
const flags = (c) => ({ prefixPunctuation: /^[,.;:]/.test(affixText(c.input.prefix)), suffixPunctuation: /[,.;:]\s*$/.test(affixText(c.input.suffix)) });
|
|
292
|
+
// Pieces of the citation, each with the delimiter before it.
|
|
293
|
+
const pieces = [];
|
|
294
|
+
const before = () => (pieces.length === 0 ? '' : pieces.at(-1).endsGroup ? afterCollapse : delimiter);
|
|
295
|
+
if (collapse === 'citation-number' && cites.length > 1) {
|
|
296
|
+
// Runs of three or more consecutive numbers, each cite nothing but its number, as ranges.
|
|
297
|
+
const number = (c) => c.state?.citationNumber;
|
|
298
|
+
const bare = (c) => c.r !== undefined && !c.input.locator && !hasAffix(c.input.prefix) && !hasAffix(c.input.suffix) && number(c) !== undefined;
|
|
299
|
+
let i = 0;
|
|
300
|
+
while (i < cites.length) {
|
|
301
|
+
let j = i;
|
|
302
|
+
while (j + 1 < cites.length && bare(cites[j]) && bare(cites[j + 1]) && number(cites[j + 1]) === number(cites[j]) + 1)
|
|
303
|
+
j++;
|
|
304
|
+
if (j - i >= 2)
|
|
305
|
+
pieces.push({ ir: seq([output(cites[i]), text('–'), output(cites[j])]), delimiter: before(), endsGroup: true });
|
|
306
|
+
else
|
|
307
|
+
for (let k = i; k <= j; k++)
|
|
308
|
+
pieces.push({ ir: output(cites[k]), delimiter: before(), ...flags(cites[k]) });
|
|
309
|
+
i = j + 1;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
else if ((collapse && collapse !== 'citation-number') || groupDelimiter !== undefined) {
|
|
313
|
+
// Cite grouping: cites with the same names, together where the first was.
|
|
314
|
+
const groups = [];
|
|
315
|
+
const byNames = new Map();
|
|
316
|
+
for (const c of cites) {
|
|
317
|
+
const key = c.r?.firstNames ? plain(c.r.firstNames) : '';
|
|
318
|
+
const g = key !== '' ? byNames.get(key) : undefined;
|
|
319
|
+
if (g)
|
|
320
|
+
g.push(c);
|
|
321
|
+
else {
|
|
322
|
+
groups.push([c]);
|
|
323
|
+
if (key !== '')
|
|
324
|
+
byNames.set(key, groups.at(-1));
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
const suffixes = (collapse === 'year-suffix' || collapse === 'year-suffix-ranged') && options['disambiguate-add-year-suffix'] === 'true';
|
|
328
|
+
const inGroup = groupDelimiter ?? ', ';
|
|
329
|
+
for (const g of groups) {
|
|
330
|
+
const gp = [];
|
|
331
|
+
let previousYear;
|
|
332
|
+
const afterSuffixes = options['after-collapse-delimiter'] ?? delimiter;
|
|
333
|
+
g.forEach((c, k) => {
|
|
334
|
+
const ownSuffix = suffixes && !c.input.locator ? c.state?.yearSuffix : undefined;
|
|
335
|
+
// After year suffixes, or a cite with a locator, a collapsed group goes on after the after-collapse delimiter.
|
|
336
|
+
const between = gp.at(-1)?.bare || (collapse && k > 0 && g[k - 1].input.locator) ? afterSuffixes : inGroup;
|
|
337
|
+
if (k === 0 || !collapse || !c.r) {
|
|
338
|
+
gp.push({ ir: output(c), delimiter: between, suffixOf: ownSuffix, ...flags(c) });
|
|
339
|
+
if (c.r)
|
|
340
|
+
previousYear = this.yearKey(c, globalLevel);
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
// Collapsed: the names once, for the group; a year once, for its suffixes.
|
|
344
|
+
const year = this.yearKey(c, globalLevel);
|
|
345
|
+
const suppressed = this.renderCite(c.item, c.input, c.position, c.state, globalLevel, { suppressAuthor: true });
|
|
346
|
+
const sameYear = year === previousYear && gp.at(-1)?.suffixOf !== undefined;
|
|
347
|
+
const suffix = ownSuffix && sameYear ? findRole(suppressed.ir, 'year-suffix') : undefined;
|
|
348
|
+
if (suffix)
|
|
349
|
+
gp.push({ ir: withAffixes(c, suffix), delimiter: options['year-suffix-delimiter'] ?? groupDelimiter ?? delimiter, suffixOf: ownSuffix, bare: true, ...flags(c) });
|
|
350
|
+
else
|
|
351
|
+
gp.push({ ir: withAffixes(c, suppressed.ir), delimiter: between, suffixOf: ownSuffix, ...flags(c) });
|
|
352
|
+
previousYear = year;
|
|
353
|
+
});
|
|
354
|
+
if (collapse === 'year-suffix-ranged')
|
|
355
|
+
collapseSuffixRanges(gp);
|
|
356
|
+
gp[0].delimiter = before();
|
|
357
|
+
if (g.length > 1 && collapse)
|
|
358
|
+
gp.at(-1).endsGroup = true;
|
|
359
|
+
pieces.push(...gp);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
for (const c of cites)
|
|
364
|
+
pieces.push({ ir: output(c), delimiter: before(), ...flags(c) });
|
|
365
|
+
}
|
|
366
|
+
const children = [];
|
|
367
|
+
let previousSuffixPunctuation = false;
|
|
368
|
+
for (const p of pieces) {
|
|
369
|
+
if (isEmpty(p.ir))
|
|
370
|
+
continue;
|
|
371
|
+
// A cite whose prefix starts with punctuation brings its own delimiter;
|
|
372
|
+
// after one whose suffix ends with punctuation, the delimiter's is dropped.
|
|
373
|
+
if (children.length > 0 && p.delimiter && !p.prefixPunctuation)
|
|
374
|
+
children.push(text(previousSuffixPunctuation ? p.delimiter.replace(/^[,.;:]+/, '') : p.delimiter, { affix: true }));
|
|
375
|
+
previousSuffixPunctuation = p.suffixPunctuation === true;
|
|
376
|
+
children.push(p.ir);
|
|
377
|
+
}
|
|
378
|
+
// The citation's own affixes, around all its cites.
|
|
379
|
+
if (children.length > 0 && hasAffix(citation.prefix)) {
|
|
380
|
+
children.unshift(capitalizePrefix ? capitalizeFirst(affixIr(citation.prefix)) : affixIr(citation.prefix), text(' ', { affix: true }));
|
|
381
|
+
}
|
|
382
|
+
if (children.length > 0 && hasAffix(citation.suffix)) {
|
|
383
|
+
const punctuation = /^[,.;:!?]/.test(affixText(citation.suffix));
|
|
384
|
+
children.push(text(punctuation ? '' : ' ', { affix: true }), affixIr(citation.suffix));
|
|
385
|
+
}
|
|
386
|
+
let out = seq(children);
|
|
387
|
+
// A citation of authors alone is part of the sentence, a narrative citation's: “Bauckham (1983)”, not “(Bauckham)”.
|
|
388
|
+
const narrative = citation.cites.length > 0 && citation.cites.every((c) => c.authorOnly);
|
|
389
|
+
const layoutPrefix = narrative ? undefined : layout.prefix;
|
|
390
|
+
const layoutSuffix = narrative ? undefined : citation.continues ? layout.suffix?.replace(/\.$/, '') : layout.suffix;
|
|
391
|
+
if (layout.formatting || layoutPrefix || layoutSuffix) {
|
|
392
|
+
out = seq([text(layoutPrefix ?? '', { affix: true }), out, text(layoutSuffix ?? '', { affix: true })], { formatting: layout.formatting });
|
|
393
|
+
}
|
|
394
|
+
if (isEmpty(seq(children)))
|
|
395
|
+
out = text('');
|
|
396
|
+
return {
|
|
397
|
+
id: citation.id,
|
|
398
|
+
output: finish(out, { locale: this.locale }),
|
|
399
|
+
cites: citation.cites.map((c, i) => ({ id: c.id, position: { ...positions[i], ...pick(c) }, found: this.items.has(c.id) })),
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
/** What a cite shows besides its names, without its year suffix: equal for cites of one year. */
|
|
403
|
+
yearKey(c, globalLevel) {
|
|
404
|
+
const state = { ...c.state, yearSuffix: undefined };
|
|
405
|
+
const r = this.renderCite(c.item, { ...c.input, prefix: undefined, suffix: undefined }, c.position, state, globalLevel, { suppressAuthor: true });
|
|
406
|
+
return plain(r.ir);
|
|
407
|
+
}
|
|
408
|
+
bibliography(order, states, globalLevel) {
|
|
409
|
+
const context = this.style.bibliography;
|
|
410
|
+
const layout = context.layout;
|
|
411
|
+
const options = context.options;
|
|
412
|
+
const secondField = options['second-field-align'];
|
|
413
|
+
const entries = [];
|
|
414
|
+
for (const id of order) {
|
|
415
|
+
const item = this.items.get(id);
|
|
416
|
+
const r = new Renderer(this.envWith('bibliography', globalLevel), item, undefined, states.get(id));
|
|
417
|
+
const parts = r.layout(layout).children;
|
|
418
|
+
if (parts.every(isEmpty))
|
|
419
|
+
continue;
|
|
420
|
+
let body;
|
|
421
|
+
if (secondField && parts.length > 1) {
|
|
422
|
+
const [first, ...rest] = parts;
|
|
423
|
+
body = seq([
|
|
424
|
+
seq([text(layout.prefix ?? '', { affix: true }), first], { display: 'left-margin', formatting: layout.formatting }),
|
|
425
|
+
seq([...rest, text(layout.suffix ?? '', { affix: true })], { display: 'right-inline', formatting: layout.formatting }),
|
|
426
|
+
]);
|
|
427
|
+
}
|
|
428
|
+
else {
|
|
429
|
+
// A layout ending in a display block takes its suffix inside it.
|
|
430
|
+
const last = parts[parts.length - 1];
|
|
431
|
+
const suffix = text(layout.suffix ?? '', { affix: true });
|
|
432
|
+
if (last?.t === 'seq' && last.display)
|
|
433
|
+
last.children.push(suffix);
|
|
434
|
+
body = seq([text(layout.prefix ?? '', { affix: true }), ...parts, ...(last?.t === 'seq' && last.display ? [] : [suffix])], { formatting: layout.formatting });
|
|
435
|
+
}
|
|
436
|
+
// A display block ends without the space a suffix may leave.
|
|
437
|
+
const lastBlock = body.children.at(-1);
|
|
438
|
+
if (lastBlock?.t === 'seq' && lastBlock.display)
|
|
439
|
+
trimEnd(lastBlock);
|
|
440
|
+
entries.push({ id, ir: body, names: r.firstNames });
|
|
441
|
+
}
|
|
442
|
+
const substitute = options['subsequent-author-substitute'];
|
|
443
|
+
if (substitute !== undefined)
|
|
444
|
+
subsequentAuthorSubstitute(entries, substitute, options['subsequent-author-substitute-rule'] ?? 'complete-all');
|
|
445
|
+
return {
|
|
446
|
+
entries: entries.map((e) => ({ id: e.id, output: finish(e.ir, { locale: this.locale }) })),
|
|
447
|
+
hangingIndent: options['hanging-indent'] === 'true',
|
|
448
|
+
secondFieldAlign: secondField,
|
|
449
|
+
lineSpacing: Number(options['line-spacing'] ?? 1),
|
|
450
|
+
entrySpacing: Number(options['entry-spacing'] ?? 1),
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
// Disambiguation.
|
|
454
|
+
/**
|
|
455
|
+
* Makes ambiguous cites unique (“Disambiguation”): given names expanded,
|
|
456
|
+
* more names shown, the `disambiguate` condition, and year suffixes, in
|
|
457
|
+
* that order, as the style allows.
|
|
458
|
+
*/
|
|
459
|
+
disambiguate(order, states) {
|
|
460
|
+
const citation = this.style.citation;
|
|
461
|
+
if (!citation)
|
|
462
|
+
return undefined;
|
|
463
|
+
const o = citation.options;
|
|
464
|
+
const addNames = o['disambiguate-add-names'] === 'true';
|
|
465
|
+
const addGiven = o['disambiguate-add-givenname'] === 'true';
|
|
466
|
+
const addYearSuffix = o['disambiguate-add-year-suffix'] === 'true';
|
|
467
|
+
const rule = o['givenname-disambiguation-rule'] ?? 'by-cite';
|
|
468
|
+
const usesCondition = styleUsesDisambiguate(this.style);
|
|
469
|
+
if (!addNames && !addGiven && !addYearSuffix && !usesCondition)
|
|
470
|
+
return undefined;
|
|
471
|
+
// Ambiguity is judged on the form a cite usually takes: a note style's
|
|
472
|
+
// short form, or an in-text style's first.
|
|
473
|
+
const position = { position: this.style.class === 'note' ? 'subsequent' : 'first', nearNote: false };
|
|
474
|
+
let global;
|
|
475
|
+
const render = (id) => this.renderCite(this.items.get(id), { id }, position, states.get(id), global);
|
|
476
|
+
const key = (id) => plain(render(id).ir);
|
|
477
|
+
const clashes = (ids) => {
|
|
478
|
+
const byKey = new Map();
|
|
479
|
+
for (const id of ids) {
|
|
480
|
+
const k = key(id);
|
|
481
|
+
const list = byKey.get(k);
|
|
482
|
+
if (list)
|
|
483
|
+
list.push(id);
|
|
484
|
+
else
|
|
485
|
+
byKey.set(k, [id]);
|
|
486
|
+
}
|
|
487
|
+
return [...byKey.values()].filter((s) => s.length > 1);
|
|
488
|
+
};
|
|
489
|
+
const primary = rule.startsWith('primary-name');
|
|
490
|
+
const maxLevel = rule.endsWith('with-initials') ? 1 : 2;
|
|
491
|
+
if (addGiven && rule !== 'by-cite')
|
|
492
|
+
global = this.globalNames(order, (id) => render(id).renderedNames, primary, maxLevel);
|
|
493
|
+
/** Expands the names that differ only in their given names, name by name, until the cites differ (by-cite). */
|
|
494
|
+
const expandGiven = (set) => {
|
|
495
|
+
if (!addGiven)
|
|
496
|
+
return;
|
|
497
|
+
const rendered = new Map(set.map((id) => [id, render(id).renderedNames]));
|
|
498
|
+
const keys = [...new Set([...rendered.values()].flatMap((list) => list.map((n) => n.key)))];
|
|
499
|
+
for (const k of keys) {
|
|
500
|
+
if (primary && !k.endsWith(':0'))
|
|
501
|
+
continue;
|
|
502
|
+
const entries = set
|
|
503
|
+
.map((id) => ({ id, rendered: rendered.get(id).find((n) => n.key === k) }))
|
|
504
|
+
.filter((e) => e.rendered !== undefined && e.rendered.name.literal === undefined);
|
|
505
|
+
let changed = false;
|
|
506
|
+
for (const e of entries) {
|
|
507
|
+
const name = e.rendered.name;
|
|
508
|
+
const others = entries.filter((x) => familyOf(x.rendered.name) === familyOf(name) && !sameName(x.rendered.name, name)).map((x) => x.rendered.name);
|
|
509
|
+
if (others.length === 0)
|
|
510
|
+
continue;
|
|
511
|
+
const level = givenLevel(name, others, e.rendered.initializeWith, maxLevel);
|
|
512
|
+
const state = states.get(e.id);
|
|
513
|
+
if (level > (state.givenLevels.get(k) ?? 0)) {
|
|
514
|
+
state.givenLevels.set(k, level);
|
|
515
|
+
changed = true;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
if (changed && clashes(set).length === 0)
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
521
|
+
};
|
|
522
|
+
for (const set of clashes(order))
|
|
523
|
+
expandGiven(set);
|
|
524
|
+
if (addNames) {
|
|
525
|
+
/**
|
|
526
|
+
* Shows names one more at a time to every cite of a set, expanded
|
|
527
|
+
* where that helps, until the set splits; each part that still
|
|
528
|
+
* clashes goes on from there. A set no added name splits goes back
|
|
529
|
+
* to the names it had.
|
|
530
|
+
*/
|
|
531
|
+
const addTo = (set, from) => {
|
|
532
|
+
const saved = new Map(set.map((id) => [id, { extra: states.get(id).addNames, levels: new Map(states.get(id).givenLevels) }]));
|
|
533
|
+
const max = Math.max(...set.map((id) => this.maxNames(this.items.get(id))));
|
|
534
|
+
for (let extra = from; extra <= max; extra++) {
|
|
535
|
+
for (const id of set)
|
|
536
|
+
states.get(id).addNames = extra;
|
|
537
|
+
expandGiven(set);
|
|
538
|
+
const parts = new Map();
|
|
539
|
+
for (const id of set) {
|
|
540
|
+
const k = key(id);
|
|
541
|
+
parts.set(k, [...(parts.get(k) ?? []), id]);
|
|
542
|
+
}
|
|
543
|
+
if (parts.size > 1) {
|
|
544
|
+
for (const part of parts.values())
|
|
545
|
+
if (part.length > 1)
|
|
546
|
+
addTo(part, extra + 1);
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
for (const id of set) {
|
|
551
|
+
states.get(id).addNames = saved.get(id).extra;
|
|
552
|
+
states.get(id).givenLevels = saved.get(id).levels;
|
|
553
|
+
}
|
|
554
|
+
};
|
|
555
|
+
for (const set of clashes(order))
|
|
556
|
+
addTo(set, 1);
|
|
557
|
+
}
|
|
558
|
+
if (usesCondition) {
|
|
559
|
+
// The `disambiguate` conditions test true one more at a time, until the cites differ.
|
|
560
|
+
for (const set of clashes(order)) {
|
|
561
|
+
const max = Math.max(...set.map((id) => {
|
|
562
|
+
const state = states.get(id);
|
|
563
|
+
const was = state.disambiguate;
|
|
564
|
+
state.disambiguate = Infinity;
|
|
565
|
+
const tests = render(id).disambiguateTests;
|
|
566
|
+
state.disambiguate = was;
|
|
567
|
+
return tests;
|
|
568
|
+
}));
|
|
569
|
+
let remaining = set;
|
|
570
|
+
for (let level = 1; level <= max && remaining.length > 1; level++) {
|
|
571
|
+
for (const id of remaining)
|
|
572
|
+
states.get(id).disambiguate = level;
|
|
573
|
+
remaining = clashes(remaining).flat();
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
if (addYearSuffix) {
|
|
578
|
+
for (const set of clashes(order)) {
|
|
579
|
+
const inOrder = order.filter((id) => set.includes(id));
|
|
580
|
+
inOrder.forEach((id, i) => (states.get(id).yearSuffix = yearSuffixLetters(i + 1)));
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
return global;
|
|
584
|
+
}
|
|
585
|
+
maxNames(item) {
|
|
586
|
+
let max = 0;
|
|
587
|
+
for (const v of Object.values(item))
|
|
588
|
+
if (Array.isArray(v) && v.length > 0 && typeof v[0] === 'object')
|
|
589
|
+
max = Math.max(max, v.length);
|
|
590
|
+
return max;
|
|
591
|
+
}
|
|
592
|
+
/** Given-name expansion across the document, for the rules other than `by-cite`: every name another shares a family name with. */
|
|
593
|
+
globalNames(order, namesOf, primary, maxLevel) {
|
|
594
|
+
const people = new Map();
|
|
595
|
+
for (const id of order) {
|
|
596
|
+
for (const r of namesOf(id)) {
|
|
597
|
+
if ((primary && r.index !== 0) || r.name.literal !== undefined)
|
|
598
|
+
continue;
|
|
599
|
+
const list = people.get(familyOf(r.name)) ?? [];
|
|
600
|
+
if (!list.some((p) => sameName(p.name, r.name)))
|
|
601
|
+
list.push(r);
|
|
602
|
+
people.set(familyOf(r.name), list);
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
const levels = new Map();
|
|
606
|
+
for (const list of people.values()) {
|
|
607
|
+
if (list.length < 2)
|
|
608
|
+
continue;
|
|
609
|
+
for (const r of list) {
|
|
610
|
+
const others = list.filter((o) => o !== r).map((o) => o.name);
|
|
611
|
+
levels.set(personKey(r.name), givenLevel(r.name, others, r.initializeWith, maxLevel));
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
return { fn: (name, index) => (primary && index !== 0 ? 0 : (levels.get(personKey(name)) ?? 0)) };
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
function familyOf(name) {
|
|
618
|
+
return `${name['non-dropping-particle'] ?? ''} ${name.family ?? ''}`.trim();
|
|
619
|
+
}
|
|
620
|
+
function personKey(n) {
|
|
621
|
+
return JSON.stringify([n.family, (n.given ?? '').replace(/[\s.]/g, ''), n['non-dropping-particle'], n['dropping-particle'], n.suffix]);
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* The given-name expansion that tells a name from others with its family
|
|
625
|
+
* name: 1 for initials (or, with no `initialize-with`, the given name), 2
|
|
626
|
+
* for the full given name, 0 if none does (“Expansion of Individual Names”).
|
|
627
|
+
*/
|
|
628
|
+
function givenLevel(name, others, initializeWith, maxLevel) {
|
|
629
|
+
const given = name.given ?? '';
|
|
630
|
+
if (initializeWith === undefined)
|
|
631
|
+
return others.every((o) => (o.given ?? '') !== given) ? 1 : 0;
|
|
632
|
+
const initials = (x) => initialize(x.given ?? '', initializeWith, true);
|
|
633
|
+
if (others.every((o) => initials(o) !== initials(name)))
|
|
634
|
+
return 1;
|
|
635
|
+
if (maxLevel >= 2 && others.every((o) => (o.given ?? '') !== given))
|
|
636
|
+
return 2;
|
|
637
|
+
return 0;
|
|
638
|
+
}
|
|
639
|
+
function pick(input) {
|
|
640
|
+
const out = {};
|
|
641
|
+
if (input.position !== undefined)
|
|
642
|
+
out.position = input.position;
|
|
643
|
+
if (input.nearNote !== undefined)
|
|
644
|
+
out.nearNote = input.nearNote;
|
|
645
|
+
if (input.firstReferenceNoteNumber === null)
|
|
646
|
+
out.firstReferenceNoteNumber = undefined;
|
|
647
|
+
else if (input.firstReferenceNoteNumber !== undefined)
|
|
648
|
+
out.firstReferenceNoteNumber = input.firstReferenceNoteNumber;
|
|
649
|
+
return out;
|
|
650
|
+
}
|
|
651
|
+
function findRole(ir, role) {
|
|
652
|
+
if (ir.t === 'text')
|
|
653
|
+
return undefined;
|
|
654
|
+
if (ir.role === role)
|
|
655
|
+
return ir;
|
|
656
|
+
for (const c of ir.children) {
|
|
657
|
+
const f = findRole(c, role);
|
|
658
|
+
if (f)
|
|
659
|
+
return f;
|
|
660
|
+
}
|
|
661
|
+
return undefined;
|
|
662
|
+
}
|
|
663
|
+
/** Text as it sorts: punctuation (quotation marks, brackets) ignored, spaces kept. */
|
|
664
|
+
function sortable(s) {
|
|
665
|
+
return s.replace(/[\p{P}]/gu, '').replace(/\s+/g, ' ').trim();
|
|
666
|
+
}
|
|
667
|
+
/** Drops the whitespace an entry ends with, in place. */
|
|
668
|
+
function trimEnd(ir) {
|
|
669
|
+
const all = leaves(ir);
|
|
670
|
+
for (let i = all.length - 1; i >= 0; i--) {
|
|
671
|
+
const leaf = all[i];
|
|
672
|
+
leaf.text = leaf.text.trimEnd();
|
|
673
|
+
if (leaf.text !== '')
|
|
674
|
+
break;
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
function findAll(ir, role, out = []) {
|
|
678
|
+
if (ir.t === 'text')
|
|
679
|
+
return out;
|
|
680
|
+
if (ir.role === role) {
|
|
681
|
+
out.push(ir);
|
|
682
|
+
return out;
|
|
683
|
+
}
|
|
684
|
+
for (const c of ir.children)
|
|
685
|
+
findAll(c, role, out);
|
|
686
|
+
return out;
|
|
687
|
+
}
|
|
688
|
+
/** Year suffixes in a row (“2000a, b, c”) as a range (“2000a–c”), from a full cite or a bare suffix. */
|
|
689
|
+
function collapseSuffixRanges(pieces) {
|
|
690
|
+
const code = (p) => (p?.suffixOf?.length === 1 ? p.suffixOf.charCodeAt(0) : NaN);
|
|
691
|
+
for (let i = 0; i < pieces.length; i++) {
|
|
692
|
+
if (pieces[i].suffixOf === undefined)
|
|
693
|
+
continue;
|
|
694
|
+
let j = i;
|
|
695
|
+
while (j + 1 < pieces.length && pieces[j + 1].bare && code(pieces[j + 1]) === code(pieces[j]) + 1)
|
|
696
|
+
j++;
|
|
697
|
+
if (j - i >= 2) {
|
|
698
|
+
const last = pieces[j];
|
|
699
|
+
pieces.splice(i + 1, j - i, { ir: seq([text('–'), last.ir]), delimiter: '', suffixOf: last.suffixOf, bare: true });
|
|
700
|
+
i++;
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
/**
|
|
705
|
+
* `subsequent-author-substitute` (“Reference Grouping”), on entries in
|
|
706
|
+
* order, in place: names that repeat the previous entry's are replaced,
|
|
707
|
+
* all of them or each, labels kept.
|
|
708
|
+
*/
|
|
709
|
+
function subsequentAuthorSubstitute(entries, substitute, rule) {
|
|
710
|
+
let previous;
|
|
711
|
+
for (const e of entries) {
|
|
712
|
+
// The name lists, or a substitute for names (a title) as a whole.
|
|
713
|
+
const found = e.names ? findAll(e.names, 'name-list') : [];
|
|
714
|
+
const lists = found.length > 0 ? found : e.names && e.names.t === 'seq' && !isEmpty(e.names) ? [e.names] : [];
|
|
715
|
+
if (lists.length === 0) {
|
|
716
|
+
previous = undefined;
|
|
717
|
+
continue;
|
|
718
|
+
}
|
|
719
|
+
const nameNodes = lists.flatMap((l) => findAll(l, 'name'));
|
|
720
|
+
const names = nameNodes.map((n) => plain(n));
|
|
721
|
+
const whole = lists.map((l) => plain(l)).join('\u0000');
|
|
722
|
+
const same = previous !== undefined && whole === previous.whole;
|
|
723
|
+
const before = previous?.names ?? [];
|
|
724
|
+
previous = { whole, names };
|
|
725
|
+
if (rule === 'complete-all' && same) {
|
|
726
|
+
lists[0].children = substitute ? [text(substitute)] : [];
|
|
727
|
+
for (const l of lists.slice(1))
|
|
728
|
+
l.children = [];
|
|
729
|
+
}
|
|
730
|
+
else if (rule === 'complete-each' && same) {
|
|
731
|
+
for (const n of nameNodes)
|
|
732
|
+
n.children = [text(substitute)];
|
|
733
|
+
}
|
|
734
|
+
else if (rule === 'partial-each' || rule === 'partial-first') {
|
|
735
|
+
for (let i = 0; i < nameNodes.length && i < before.length; i++) {
|
|
736
|
+
if (names[i] !== before[i])
|
|
737
|
+
break;
|
|
738
|
+
nameNodes[i].children = [text(substitute)];
|
|
739
|
+
if (rule === 'partial-first')
|
|
740
|
+
break;
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
/** Whether a style tests the `disambiguate` condition anywhere. */
|
|
746
|
+
function styleUsesDisambiguate(style) {
|
|
747
|
+
const visit = (els) => els.some((e) => e.kind === 'choose'
|
|
748
|
+
? e.branches.some((b) => b.conditions.some((c) => c.test === 'disambiguate') || visit(b.children))
|
|
749
|
+
: e.kind === 'group'
|
|
750
|
+
? visit(e.children)
|
|
751
|
+
: e.kind === 'names' && e.substitute
|
|
752
|
+
? visit(e.substitute)
|
|
753
|
+
: false);
|
|
754
|
+
if ([...style.macros.values()].some(visit))
|
|
755
|
+
return true;
|
|
756
|
+
return style.citation ? visit(style.citation.layout.children) : false;
|
|
757
|
+
}
|
|
758
|
+
/** Capitalizes the first letter of a tree's text, unless it keeps its case: a prefix that starts a sentence. */
|
|
759
|
+
function capitalizeFirst(ir) {
|
|
760
|
+
const first = leaves(ir).find((l) => /\p{L}/u.test(l.text));
|
|
761
|
+
if (first && !first.nocase)
|
|
762
|
+
first.text = first.text.replace(/\p{L}/u, (c) => c.toUpperCase());
|
|
763
|
+
return ir;
|
|
764
|
+
}
|
|
765
|
+
//# sourceMappingURL=processor.js.map
|