pulpweaver4 0.0.0-stage → 0.0.88
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 +123 -0
- package/dist/ast/djot.js +458 -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 +534 -0
- package/dist/ast/nodes.js +48 -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 +91 -0
- package/dist/citations/book.js +206 -0
- package/dist/citations/book.js.map +1 -0
- package/dist/citations/collect.d.ts +52 -0
- package/dist/citations/collect.js +125 -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 +120 -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 +135 -0
- package/dist/colour/intents.js +183 -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 +109 -0
- package/dist/config/config.js +295 -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 +209 -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 +177 -0
- package/dist/csl/processor.js +759 -0
- package/dist/csl/processor.js.map +1 -0
- package/dist/csl/project.d.ts +21 -0
- package/dist/csl/project.js +78 -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 +324 -0
- package/dist/djot/djot.js/src/ast.js +61 -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 +656 -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 +1019 -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 +1040 -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 +1436 -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 +687 -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 +32 -0
- package/dist/layout/page-box.js +110 -0
- package/dist/layout/page-box.js.map +1 -0
- package/dist/layout/page-rules.d.ts +47 -0
- package/dist/layout/page-rules.js +202 -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 +71 -0
- package/dist/layout/pages.js +741 -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 +65 -0
- package/dist/lint/rules/source.js +334 -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 +534 -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 +1779 -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 +199 -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 +120 -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 +228 -0
- package/dist/test/pipeline.js +73 -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 +36 -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 +194 -0
- package/docs/reference/pulpweaver4-toml/index.md +182 -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,1019 @@
|
|
|
1
|
+
import { AttributeParser } from "./attributes.js";
|
|
2
|
+
import { Warning } from "./options.js";
|
|
3
|
+
import { pattern, find } from "./find.js";
|
|
4
|
+
const C_TAB = 9;
|
|
5
|
+
const C_LF = 10;
|
|
6
|
+
const C_CR = 13;
|
|
7
|
+
const C_SPACE = 32;
|
|
8
|
+
const C_BANG = 33;
|
|
9
|
+
const C_DOUBLE_QUOTE = 34;
|
|
10
|
+
const C_DOLLARS = 36;
|
|
11
|
+
const C_SINGLE_QUOTE = 39;
|
|
12
|
+
const C_LEFT_PAREN = 40;
|
|
13
|
+
const C_RIGHT_PAREN = 41;
|
|
14
|
+
const C_ASTERISK = 42;
|
|
15
|
+
const C_PLUS = 43;
|
|
16
|
+
const C_HYPHEN = 45;
|
|
17
|
+
const C_PERIOD = 46;
|
|
18
|
+
const C_COLON = 58;
|
|
19
|
+
const C_SEMICOLON = 59;
|
|
20
|
+
const C_LESSTHAN = 60;
|
|
21
|
+
const C_EQUALS = 61;
|
|
22
|
+
const C_AT = 64;
|
|
23
|
+
const C_LEFT_BRACKET = 91;
|
|
24
|
+
const C_BACKSLASH = 92;
|
|
25
|
+
const C_RIGHT_BRACKET = 93;
|
|
26
|
+
const C_HAT = 94;
|
|
27
|
+
const C_UNDERSCORE = 95;
|
|
28
|
+
const C_BACKTICK = 96;
|
|
29
|
+
const C_LEFT_BRACE = 123;
|
|
30
|
+
const C_RIGHT_BRACE = 125;
|
|
31
|
+
const C_TILDE = 126;
|
|
32
|
+
const reSpecial = /[\r\n"'()*+.:<=[\\\]^_`${}~-]/g;
|
|
33
|
+
// Inside brackets '@' and ';' are special too: they make citations.
|
|
34
|
+
const reSpecialInBrackets = /[\r\n"'()*+.:;<=@[\\\]^_`${}~-]/g;
|
|
35
|
+
// Which characters a regex such as reSpecial matches, one entry per code
|
|
36
|
+
// unit. Derived from the regex itself so the two cannot drift apart.
|
|
37
|
+
// Every special character is ASCII, so a code unit past the end of the
|
|
38
|
+
// table is never special.
|
|
39
|
+
const specialTable = function (re) {
|
|
40
|
+
const table = new Uint8Array(128);
|
|
41
|
+
for (let c = 0; c < table.length; c++) {
|
|
42
|
+
re.lastIndex = 0;
|
|
43
|
+
if (re.test(String.fromCharCode(c))) {
|
|
44
|
+
table[c] = 1;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
re.lastIndex = 0;
|
|
48
|
+
return table;
|
|
49
|
+
};
|
|
50
|
+
const isSpecial = specialTable(reSpecial);
|
|
51
|
+
const isSpecialInBrackets = specialTable(reSpecialInBrackets);
|
|
52
|
+
// How far findSpecial looks before handing over to the regex.
|
|
53
|
+
const specialLookahead = 32;
|
|
54
|
+
// find first special character starting from startpos, and not
|
|
55
|
+
// going beyond endpos, or null if none found.
|
|
56
|
+
const findSpecial = function (s, startpos, endpos, inBrackets) {
|
|
57
|
+
const table = inBrackets ? isSpecialInBrackets : isSpecial;
|
|
58
|
+
const re = inBrackets ? reSpecialInBrackets : reSpecial;
|
|
59
|
+
// The next special character is usually only a few away, and for such a
|
|
60
|
+
// short distance reading the characters costs less than the regex does to
|
|
61
|
+
// start up. Beyond that the regex's native scan is the faster of the two,
|
|
62
|
+
// so it takes over where this leaves off.
|
|
63
|
+
const stop = Math.min(endpos, startpos + specialLookahead);
|
|
64
|
+
for (let i = startpos; i <= stop; i++) {
|
|
65
|
+
const c = s.charCodeAt(i);
|
|
66
|
+
if (c < 128 && table[c] === 1) {
|
|
67
|
+
return i;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (stop === endpos) {
|
|
71
|
+
return null; // nothing special in the whole range
|
|
72
|
+
}
|
|
73
|
+
re.lastIndex = stop + 1;
|
|
74
|
+
const result = re.exec(s);
|
|
75
|
+
if (result && result.index <= endpos) {
|
|
76
|
+
return result.index;
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
// Whether there is a character at pos and it is none of space, tab, CR or
|
|
83
|
+
// LF. Its two callers below only want that yes or no, and on a document of
|
|
84
|
+
// many inline delimiters they account for most of the searches made during a
|
|
85
|
+
// parse, so the character is read rather than matched against a pattern.
|
|
86
|
+
const isNonspaceAt = function (subject, pos) {
|
|
87
|
+
if (pos >= subject.length) {
|
|
88
|
+
return false; // nothing there
|
|
89
|
+
}
|
|
90
|
+
const c = subject.charCodeAt(pos);
|
|
91
|
+
return c !== C_SPACE && c !== C_TAB && c !== C_CR && c !== C_LF;
|
|
92
|
+
};
|
|
93
|
+
// Whether c is a space, tab, CR or LF.
|
|
94
|
+
const isSpaceCode = function (c) {
|
|
95
|
+
return c === C_SPACE || c === C_TAB || c === C_CR || c === C_LF;
|
|
96
|
+
};
|
|
97
|
+
// A character that `{` can mark as an explicit opener, as in `{*bold*}`.
|
|
98
|
+
const isDelimChar = function (c) {
|
|
99
|
+
return c === C_ASTERISK || c === C_PLUS || c === C_HYPHEN ||
|
|
100
|
+
c === C_EQUALS || c === C_HAT || c === C_UNDERSCORE ||
|
|
101
|
+
c === C_TILDE || c === C_SINGLE_QUOTE || c === C_DOUBLE_QUOTE;
|
|
102
|
+
};
|
|
103
|
+
const pattLineEnd = pattern("[ \\t]*\\r?\\n");
|
|
104
|
+
const pattPunctuation = pattern("['!\"#$%&\\\\'()\\*+,\\-\\.\\/:;<=>?@\\[\\]\\^_`{|}~']");
|
|
105
|
+
const pattAutolink = pattern("[<][^<>\\s]+[>]");
|
|
106
|
+
const pattEmail = pattern("[^:]+@");
|
|
107
|
+
const pattUrl = pattern("[a-zA-Z0-9+.-]+:");
|
|
108
|
+
const pattSymbol = pattern(":[\\w_+-]+:");
|
|
109
|
+
const pattBackticks0 = pattern("`*");
|
|
110
|
+
const pattBackticks1 = pattern("`+");
|
|
111
|
+
const pattRawAttribute = pattern("\\{=[^\\s{}`]+\\}");
|
|
112
|
+
// A citation key, after its '@': a letter, digit or _, then letters,
|
|
113
|
+
// digits and internal punctuation, each followed by a letter or digit, as
|
|
114
|
+
// in pandoc. `doe:1999`, `doe.1999` and `doe-1999` are keys; in `@doe.`
|
|
115
|
+
// the period ends the sentence, not the key. Unlike pandoc, _ is
|
|
116
|
+
// punctuation too, so that a key can't take the _ that closes emphasis.
|
|
117
|
+
// The '/' of `//` is internal, for URLs.
|
|
118
|
+
const pattCiteKey = new RegExp("[\\p{L}\\p{N}_](?:[\\p{L}\\p{N}]|[:.#$%&+?<>~/_-](?=[\\p{L}\\p{N}])|[:/](?=/))*", "uy");
|
|
119
|
+
const hasBrace = function (self, pos) {
|
|
120
|
+
return ((pos > 0 && self.subject.codePointAt(pos - 1) === C_LEFT_BRACE) ||
|
|
121
|
+
self.subject.codePointAt(pos + 1) === C_RIGHT_BRACE);
|
|
122
|
+
};
|
|
123
|
+
const alwaysTrue = function () { return true; };
|
|
124
|
+
const betweenMatched = function (c, annotation, defaultmatch, opentest) {
|
|
125
|
+
return function (self, pos, endpos) {
|
|
126
|
+
const subject = self.subject;
|
|
127
|
+
let can_open = isNonspaceAt(subject, pos + 1) && opentest(self, pos);
|
|
128
|
+
// The sticky pattern this replaces clamped a negative start to 0, so at
|
|
129
|
+
// the very start of the subject it looked at the delimiter itself, which
|
|
130
|
+
// is never a space. Keep that.
|
|
131
|
+
let can_close = isNonspaceAt(subject, pos > 0 ? pos - 1 : 0);
|
|
132
|
+
const lastmatch = self.matches[self.matches.length - 1];
|
|
133
|
+
const has_open_marker = lastmatch && lastmatch.annot === "open_marker";
|
|
134
|
+
const has_close_marker = pos + 1 <= endpos &&
|
|
135
|
+
subject.codePointAt(pos + 1) === C_RIGHT_BRACE;
|
|
136
|
+
let endcloser = pos;
|
|
137
|
+
let startopener = pos;
|
|
138
|
+
// Allow explicit open/close markers to override:
|
|
139
|
+
if (has_open_marker) {
|
|
140
|
+
can_open = true;
|
|
141
|
+
can_close = false;
|
|
142
|
+
startopener = pos - 1;
|
|
143
|
+
}
|
|
144
|
+
if (!has_open_marker && has_close_marker) {
|
|
145
|
+
can_close = true;
|
|
146
|
+
can_open = false;
|
|
147
|
+
endcloser = pos + 1;
|
|
148
|
+
}
|
|
149
|
+
// NB. assigning to `defaultmatch` here would outlive the call: it is
|
|
150
|
+
// captured from betweenMatched, and the matchers table is built once.
|
|
151
|
+
let match = defaultmatch;
|
|
152
|
+
if (has_open_marker && match.match(/^right/)) {
|
|
153
|
+
match = match.replace(/^right/, "left");
|
|
154
|
+
}
|
|
155
|
+
else if (has_close_marker && match.match(/^left/)) {
|
|
156
|
+
match = match.replace(/^left/, "right");
|
|
157
|
+
}
|
|
158
|
+
let d = c;
|
|
159
|
+
if (has_close_marker) {
|
|
160
|
+
d = "{" + d;
|
|
161
|
+
}
|
|
162
|
+
const openers = self.openers[d];
|
|
163
|
+
if (can_close && openers && openers.length > 0) {
|
|
164
|
+
// check openers for a match
|
|
165
|
+
const opener = openers[openers.length - 1];
|
|
166
|
+
if (opener.endpos !== pos - 1) { // exclude empty emph
|
|
167
|
+
// When inside a link destination, don't match openers from outside
|
|
168
|
+
// the link construct (before the [ that started this link)
|
|
169
|
+
if (self.destination) {
|
|
170
|
+
const linkOpeners = self.openers["["];
|
|
171
|
+
if (linkOpeners && linkOpeners.length > 0) {
|
|
172
|
+
const linkOpener = linkOpeners[linkOpeners.length - 1];
|
|
173
|
+
if (linkOpener.annot === "explicit_link" &&
|
|
174
|
+
opener.startpos < linkOpener.startpos) {
|
|
175
|
+
// opener is outside the link, don't match
|
|
176
|
+
self.addMatch(pos, endcloser, match);
|
|
177
|
+
return endcloser + 1;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
self.clearOpeners(opener.startpos, pos);
|
|
182
|
+
self.nestCiteParts(opener.startpos);
|
|
183
|
+
self.addMatch(opener.startpos, opener.endpos, "+" + annotation, opener.matchIndex);
|
|
184
|
+
self.addMatch(pos, endcloser, "-" + annotation);
|
|
185
|
+
return endcloser + 1;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
// If we get here, we didn't match an opener:
|
|
189
|
+
if (can_open) {
|
|
190
|
+
let e = c;
|
|
191
|
+
if (has_open_marker) {
|
|
192
|
+
e = "{" + e;
|
|
193
|
+
}
|
|
194
|
+
self.addOpener(e, startopener, pos, match);
|
|
195
|
+
return pos + 1;
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
self.addMatch(pos, endcloser, match);
|
|
199
|
+
return endcloser + 1;
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
// handlers for specific code points:
|
|
204
|
+
const matchers = {
|
|
205
|
+
[C_BACKTICK]: function (self, pos, endpos) {
|
|
206
|
+
const subject = self.subject;
|
|
207
|
+
const m = find(subject, pattBackticks0, pos, endpos);
|
|
208
|
+
if (m === null) {
|
|
209
|
+
return null;
|
|
210
|
+
}
|
|
211
|
+
const endchar = m.endpos;
|
|
212
|
+
// a $ immediately before the backticks is a math prefix, unless
|
|
213
|
+
// it was backslash-escaped (in which case the preceding match is
|
|
214
|
+
// an "escape" at the backslash's position):
|
|
215
|
+
const prevMatch = self.matches[self.matches.length - 2];
|
|
216
|
+
const dollarEscaped = prevMatch !== undefined &&
|
|
217
|
+
prevMatch.annot === "escape" && prevMatch.endpos === pos - 2;
|
|
218
|
+
if (pos >= 2 && subject.charCodeAt(pos - 2) === C_DOLLARS &&
|
|
219
|
+
subject.charCodeAt(pos - 1) === C_DOLLARS &&
|
|
220
|
+
!(pos >= 3 && subject.charCodeAt(pos - 3) === C_BACKSLASH)) {
|
|
221
|
+
self.matches.pop(); // remove first $
|
|
222
|
+
self.matches.pop(); // remove second $
|
|
223
|
+
self.addMatch(pos - 2, endchar, "+display_math");
|
|
224
|
+
self.verbatimType = "display_math";
|
|
225
|
+
}
|
|
226
|
+
else if (pos >= 1 && subject.charCodeAt(pos - 1) === C_DOLLARS &&
|
|
227
|
+
!dollarEscaped) {
|
|
228
|
+
self.matches.pop(); // remove $
|
|
229
|
+
self.addMatch(pos - 1, endchar, "+inline_math");
|
|
230
|
+
self.verbatimType = "inline_math";
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
self.addMatch(pos, endchar, "+verbatim");
|
|
234
|
+
self.verbatimType = "verbatim";
|
|
235
|
+
}
|
|
236
|
+
self.verbatim = endchar - pos + 1;
|
|
237
|
+
return endchar + 1;
|
|
238
|
+
},
|
|
239
|
+
[C_BACKSLASH]: function (self, pos, endpos) {
|
|
240
|
+
const subject = self.subject;
|
|
241
|
+
const mLineEnd = find(subject, pattLineEnd, pos + 1, endpos);
|
|
242
|
+
if (mLineEnd !== null) {
|
|
243
|
+
// see if there were preceding spaces and remove them
|
|
244
|
+
if (self.matches.length > 0) {
|
|
245
|
+
const lastmatch = self.matches[self.matches.length - 1];
|
|
246
|
+
if (lastmatch.annot === "str") {
|
|
247
|
+
let ep = lastmatch.endpos;
|
|
248
|
+
const sp = lastmatch.startpos;
|
|
249
|
+
while (ep >= sp &&
|
|
250
|
+
(subject.codePointAt(ep) === C_SPACE ||
|
|
251
|
+
subject.codePointAt(ep) === C_TAB)) {
|
|
252
|
+
ep = ep - 1;
|
|
253
|
+
}
|
|
254
|
+
if (ep < sp) {
|
|
255
|
+
self.matches.pop();
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
lastmatch.endpos = ep;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
self.addMatch(pos, pos, "escape");
|
|
263
|
+
self.addMatch(pos + 1, mLineEnd.endpos, "hard_break");
|
|
264
|
+
return mLineEnd.endpos + 1;
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
const mPunct = find(subject, pattPunctuation, pos + 1, endpos);
|
|
268
|
+
if (mPunct !== null) {
|
|
269
|
+
self.addMatch(pos, pos, "escape");
|
|
270
|
+
self.addMatch(mPunct.startpos, mPunct.endpos, "str");
|
|
271
|
+
return mPunct.endpos + 1;
|
|
272
|
+
}
|
|
273
|
+
else if (pos + 1 <= endpos &&
|
|
274
|
+
subject.codePointAt(pos + 1) === C_SPACE) {
|
|
275
|
+
self.addMatch(pos, pos, "escape");
|
|
276
|
+
self.addMatch(pos + 1, pos + 1, "non_breaking_space");
|
|
277
|
+
return pos + 2;
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
self.addMatch(pos, pos, "str");
|
|
281
|
+
return pos + 1;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
[C_LESSTHAN]: function (self, pos, endpos) {
|
|
286
|
+
const subject = self.subject;
|
|
287
|
+
const m = find(subject, pattAutolink, pos, endpos);
|
|
288
|
+
if (m === null) {
|
|
289
|
+
return null;
|
|
290
|
+
}
|
|
291
|
+
const endurl = m.endpos;
|
|
292
|
+
const starturl = m.startpos;
|
|
293
|
+
let isEmail = find(subject, pattEmail, pos + 1, endurl);
|
|
294
|
+
let isUrl = find(subject, pattUrl, pos + 1, endurl);
|
|
295
|
+
if (isEmail) {
|
|
296
|
+
self.addMatch(starturl, starturl, "+email");
|
|
297
|
+
self.addMatch(starturl + 1, endurl - 1, "str");
|
|
298
|
+
self.addMatch(endurl, endurl, "-email");
|
|
299
|
+
return endurl + 1;
|
|
300
|
+
}
|
|
301
|
+
else if (isUrl) {
|
|
302
|
+
self.addMatch(starturl, starturl, "+url");
|
|
303
|
+
self.addMatch(starturl + 1, endurl - 1, "str");
|
|
304
|
+
self.addMatch(endurl, endurl, "-url");
|
|
305
|
+
return endurl + 1;
|
|
306
|
+
}
|
|
307
|
+
return null;
|
|
308
|
+
},
|
|
309
|
+
[C_TILDE]: betweenMatched('~', 'subscript', 'str', alwaysTrue),
|
|
310
|
+
[C_HAT]: betweenMatched('^', 'superscript', 'str', alwaysTrue),
|
|
311
|
+
[C_UNDERSCORE]: betweenMatched('_', 'emph', 'str', alwaysTrue),
|
|
312
|
+
[C_ASTERISK]: betweenMatched('*', 'strong', 'str', alwaysTrue),
|
|
313
|
+
[C_PLUS]: betweenMatched("+", "insert", "str", hasBrace),
|
|
314
|
+
[C_EQUALS]: betweenMatched("=", "mark", "str", hasBrace),
|
|
315
|
+
[C_SINGLE_QUOTE]: betweenMatched("'", "single_quoted", "right_single_quote", function (self, pos) {
|
|
316
|
+
if (pos === 0) {
|
|
317
|
+
return true;
|
|
318
|
+
}
|
|
319
|
+
else {
|
|
320
|
+
const cp = self.subject.codePointAt(pos - 1);
|
|
321
|
+
return (cp === C_SPACE ||
|
|
322
|
+
cp === C_TAB ||
|
|
323
|
+
cp === C_CR ||
|
|
324
|
+
cp === C_LF ||
|
|
325
|
+
cp === C_DOUBLE_QUOTE ||
|
|
326
|
+
cp === C_SINGLE_QUOTE ||
|
|
327
|
+
cp === C_HYPHEN ||
|
|
328
|
+
cp === C_LEFT_PAREN ||
|
|
329
|
+
cp === C_LEFT_BRACKET);
|
|
330
|
+
}
|
|
331
|
+
}),
|
|
332
|
+
[C_DOUBLE_QUOTE]: betweenMatched('"', "double_quoted", "left_double_quote", alwaysTrue),
|
|
333
|
+
[C_LEFT_BRACE]: function (self, pos, endpos) {
|
|
334
|
+
if (pos + 1 <= endpos && isDelimChar(self.subject.charCodeAt(pos + 1))) {
|
|
335
|
+
self.addMatch(pos, pos, "open_marker");
|
|
336
|
+
return pos + 1;
|
|
337
|
+
}
|
|
338
|
+
else if (self.allowAttributes) {
|
|
339
|
+
self.attributeParser = new AttributeParser(self.subject);
|
|
340
|
+
self.attributeStart = pos;
|
|
341
|
+
self.attributeSlices = [];
|
|
342
|
+
return pos;
|
|
343
|
+
}
|
|
344
|
+
else {
|
|
345
|
+
self.addMatch(pos, pos, "str");
|
|
346
|
+
return pos + 1;
|
|
347
|
+
}
|
|
348
|
+
},
|
|
349
|
+
[C_COLON]: function (self, pos, endpos) {
|
|
350
|
+
const m = find(self.subject, pattSymbol, pos, endpos);
|
|
351
|
+
if (m) {
|
|
352
|
+
self.addMatch(m.startpos, m.endpos, "symb");
|
|
353
|
+
return m.endpos + 1;
|
|
354
|
+
}
|
|
355
|
+
else {
|
|
356
|
+
self.addMatch(pos, pos, "str");
|
|
357
|
+
return pos + 1;
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
[C_PERIOD]: function (self, pos, endpos) {
|
|
361
|
+
if (pos + 2 <= endpos &&
|
|
362
|
+
self.subject.charCodeAt(pos + 1) === C_PERIOD &&
|
|
363
|
+
self.subject.charCodeAt(pos + 2) === C_PERIOD) {
|
|
364
|
+
self.addMatch(pos, pos + 2, "ellipses");
|
|
365
|
+
return pos + 3;
|
|
366
|
+
}
|
|
367
|
+
else {
|
|
368
|
+
return null;
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
// A citation key, `@doe99`, or with a '-' to suppress the author,
|
|
372
|
+
// `-@doe99`, where it starts a word inside brackets. It is parsed as str
|
|
373
|
+
// and noted on the '[', and becomes a key only if the brackets close as a
|
|
374
|
+
// citation (see addCitation). Lexing it here rather than then keeps the
|
|
375
|
+
// key's punctuation from opening emphasis, `@doe_99`, or a symbol.
|
|
376
|
+
[C_AT]: function (self, pos, endpos) {
|
|
377
|
+
const openers = self.openers["["];
|
|
378
|
+
if (!openers || openers.length === 0 || self.destination) {
|
|
379
|
+
return null;
|
|
380
|
+
}
|
|
381
|
+
const opener = openers[openers.length - 1];
|
|
382
|
+
const subject = self.subject;
|
|
383
|
+
let startpos = pos;
|
|
384
|
+
if (subject.charCodeAt(pos - 1) === C_HYPHEN) {
|
|
385
|
+
startpos = pos - 1; // suppress author
|
|
386
|
+
}
|
|
387
|
+
// the key, with its '-', must follow the '[', a space or a ';':
|
|
388
|
+
if (startpos - 1 !== opener.startpos &&
|
|
389
|
+
!isSpaceCode(subject.charCodeAt(startpos - 1)) &&
|
|
390
|
+
subject.charCodeAt(startpos - 1) !== C_SEMICOLON) {
|
|
391
|
+
return null;
|
|
392
|
+
}
|
|
393
|
+
const m = find(subject, pattCiteKey, pos + 1, endpos);
|
|
394
|
+
if (m === null) {
|
|
395
|
+
return null;
|
|
396
|
+
}
|
|
397
|
+
if (startpos < pos) {
|
|
398
|
+
// the '-' is a match of its own, which the key now takes in
|
|
399
|
+
const lastmatch = self.matches[self.matches.length - 1];
|
|
400
|
+
if (!lastmatch || lastmatch.annot !== "str" ||
|
|
401
|
+
lastmatch.startpos !== startpos || lastmatch.endpos !== startpos) {
|
|
402
|
+
return null;
|
|
403
|
+
}
|
|
404
|
+
self.matches.pop();
|
|
405
|
+
}
|
|
406
|
+
self.addMatch(startpos, m.endpos, "str");
|
|
407
|
+
self.addCitePart(opener, true);
|
|
408
|
+
return m.endpos + 1;
|
|
409
|
+
},
|
|
410
|
+
// A ';' inside brackets, which separates the items of a citation if the
|
|
411
|
+
// brackets close as one.
|
|
412
|
+
[C_SEMICOLON]: function (self, pos, endpos) {
|
|
413
|
+
const openers = self.openers["["];
|
|
414
|
+
if (!openers || openers.length === 0 || self.destination) {
|
|
415
|
+
return null;
|
|
416
|
+
}
|
|
417
|
+
self.addMatch(pos, pos, "str");
|
|
418
|
+
self.addCitePart(openers[openers.length - 1], false);
|
|
419
|
+
return pos + 1;
|
|
420
|
+
},
|
|
421
|
+
[C_LEFT_BRACKET]: function (self, pos, endpos) {
|
|
422
|
+
self.addOpener("[", pos, pos, "str");
|
|
423
|
+
return pos + 1;
|
|
424
|
+
},
|
|
425
|
+
[C_RIGHT_BRACKET]: function (self, pos, endpos) {
|
|
426
|
+
const openers = self.openers["["];
|
|
427
|
+
const subject = self.subject;
|
|
428
|
+
if (openers && openers.length > 0) {
|
|
429
|
+
const opener = openers[openers.length - 1];
|
|
430
|
+
const isNoteRef = subject.codePointAt(opener.startpos + 1) === C_HAT;
|
|
431
|
+
if (isNoteRef) {
|
|
432
|
+
// remove matches back to start
|
|
433
|
+
let i = self.matches.length - 1;
|
|
434
|
+
while (i > 0 && self.matches[i].startpos > opener.startpos) {
|
|
435
|
+
self.matches.pop();
|
|
436
|
+
i--;
|
|
437
|
+
}
|
|
438
|
+
self.clearOpeners(opener.startpos, pos);
|
|
439
|
+
self.matches[i].annot = "footnote_reference";
|
|
440
|
+
self.matches[i].endpos = pos;
|
|
441
|
+
return pos + 1;
|
|
442
|
+
}
|
|
443
|
+
else if (opener.annot === "reference_link") {
|
|
444
|
+
// found a reference link
|
|
445
|
+
// convert all matches inside reference to str
|
|
446
|
+
self.strMatches((opener.subendpos || opener.endpos) + 1, pos - 1);
|
|
447
|
+
// add the matches
|
|
448
|
+
const isImage = subject.codePointAt(opener.startpos - 1) === C_BANG &&
|
|
449
|
+
subject.codePointAt(opener.startpos - 2) !== C_BACKSLASH;
|
|
450
|
+
if (isImage) {
|
|
451
|
+
self.addImageMarker(opener);
|
|
452
|
+
self.addMatch(opener.startpos, opener.endpos, "+imagetext", opener.matchIndex);
|
|
453
|
+
self.addMatch(opener.substartpos || opener.startpos, opener.substartpos || opener.startpos, "-imagetext", opener.subMatchIndex);
|
|
454
|
+
}
|
|
455
|
+
else {
|
|
456
|
+
self.addMatch(opener.startpos, opener.endpos, "+linktext", opener.matchIndex);
|
|
457
|
+
self.addMatch(opener.substartpos || opener.startpos, opener.substartpos || opener.startpos, "-linktext", opener.subMatchIndex);
|
|
458
|
+
}
|
|
459
|
+
self.addMatch(opener.subendpos || opener.endpos, opener.subendpos || opener.endpos, "+reference", opener.subMatchIndex + 1);
|
|
460
|
+
self.addMatch(pos, pos, "-reference");
|
|
461
|
+
// remove from openers
|
|
462
|
+
self.clearOpeners(opener.startpos, pos);
|
|
463
|
+
return pos + 1;
|
|
464
|
+
}
|
|
465
|
+
else if (pos + 1 <= endpos &&
|
|
466
|
+
subject.codePointAt(pos + 1) === C_LEFT_BRACKET) {
|
|
467
|
+
opener.annot = "reference_link";
|
|
468
|
+
self.addMatch(pos, pos, "str");
|
|
469
|
+
opener.subMatchIndex = self.matches.length - 1;
|
|
470
|
+
self.addMatch(pos + 1, pos + 1, "str");
|
|
471
|
+
opener.substartpos = pos; // intermediate ]
|
|
472
|
+
opener.subendpos = pos + 1; // intermediate [
|
|
473
|
+
// remove any openers between [ and ]
|
|
474
|
+
self.clearOpeners(opener.startpos + 1, pos - 1);
|
|
475
|
+
return pos + 2;
|
|
476
|
+
}
|
|
477
|
+
else if (pos + 1 <= endpos &&
|
|
478
|
+
subject.codePointAt(pos + 1) === C_LEFT_PAREN) {
|
|
479
|
+
self.openers["("] = []; // clear ( openers
|
|
480
|
+
opener.annot = "explicit_link";
|
|
481
|
+
self.addMatch(pos, pos, "str"); // ]
|
|
482
|
+
opener.subMatchIndex = self.matches.length - 1;
|
|
483
|
+
self.addMatch(pos + 1, pos + 1, "str"); // (
|
|
484
|
+
opener.substartpos = pos; // intermediate ]
|
|
485
|
+
opener.subendpos = pos + 1; // intermediate (
|
|
486
|
+
self.destination = true;
|
|
487
|
+
// remove any openers between [ and ]
|
|
488
|
+
self.clearOpeners(opener.startpos + 1, pos - 1);
|
|
489
|
+
return pos + 2;
|
|
490
|
+
}
|
|
491
|
+
else if (opener.citeParts !== null && self.addCitation(opener, pos)) {
|
|
492
|
+
return pos + 1;
|
|
493
|
+
}
|
|
494
|
+
else if (pos + 1 <= endpos &&
|
|
495
|
+
subject.codePointAt(pos + 1) === C_LEFT_BRACE) {
|
|
496
|
+
// assume this is attributes, bracketed span
|
|
497
|
+
self.addMatch(opener.startpos, opener.endpos, "+span", opener.matchIndex);
|
|
498
|
+
self.addMatch(pos, pos, "-span");
|
|
499
|
+
if (self.allowAttributes) {
|
|
500
|
+
// speculative: revert to literal brackets if the attribute
|
|
501
|
+
// parse that must follow fails
|
|
502
|
+
self.pendingSpan = { openMatchIndex: opener.matchIndex,
|
|
503
|
+
closeMatchIndex: self.matches.length - 1 };
|
|
504
|
+
}
|
|
505
|
+
// remove any openers between [ and ]
|
|
506
|
+
self.clearOpeners(opener.startpos, pos);
|
|
507
|
+
return pos + 1;
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
return null;
|
|
511
|
+
},
|
|
512
|
+
[C_LEFT_PAREN]: function (self, pos, endpos) {
|
|
513
|
+
if (!self.destination) {
|
|
514
|
+
return null;
|
|
515
|
+
}
|
|
516
|
+
self.addOpener("(", pos, pos, "str");
|
|
517
|
+
return pos + 1;
|
|
518
|
+
},
|
|
519
|
+
[C_RIGHT_PAREN]: function (self, pos, endpos) {
|
|
520
|
+
if (!self.destination) {
|
|
521
|
+
return null;
|
|
522
|
+
}
|
|
523
|
+
const parens = self.openers["("];
|
|
524
|
+
if (parens && parens.length > 0) {
|
|
525
|
+
parens.pop(); // clear opener
|
|
526
|
+
self.addMatch(pos, pos, "str");
|
|
527
|
+
return pos + 1;
|
|
528
|
+
}
|
|
529
|
+
else {
|
|
530
|
+
const subject = self.subject;
|
|
531
|
+
const openers = self.openers["["];
|
|
532
|
+
const opener = openers[openers.length - 1];
|
|
533
|
+
if (openers && openers.length > 0 && opener.annot === "explicit_link") {
|
|
534
|
+
// we have inline link
|
|
535
|
+
// convert all matches inside destination to str
|
|
536
|
+
self.strMatches((opener.subendpos || opener.endpos) + 1, pos - 1);
|
|
537
|
+
const isImage = subject.codePointAt(opener.startpos - 1) === C_BANG &&
|
|
538
|
+
subject.codePointAt(opener.startpos - 2) !== C_BACKSLASH;
|
|
539
|
+
if (isImage) {
|
|
540
|
+
self.addImageMarker(opener);
|
|
541
|
+
self.addMatch(opener.startpos, opener.endpos, "+imagetext", opener.matchIndex);
|
|
542
|
+
self.addMatch(opener.substartpos || opener.startpos, opener.substartpos || opener.startpos, "-imagetext", opener.subMatchIndex);
|
|
543
|
+
}
|
|
544
|
+
else {
|
|
545
|
+
self.addMatch(opener.startpos, opener.endpos, "+linktext", opener.matchIndex);
|
|
546
|
+
self.addMatch(opener.substartpos || opener.startpos, opener.substartpos || opener.startpos, "-linktext", opener.subMatchIndex);
|
|
547
|
+
}
|
|
548
|
+
self.addMatch(opener.subendpos || opener.endpos, opener.subendpos || opener.endpos, "+destination", opener.subMatchIndex + 1);
|
|
549
|
+
self.addMatch(pos, pos, "-destination");
|
|
550
|
+
self.destination = false;
|
|
551
|
+
// remove from openers
|
|
552
|
+
self.clearOpeners(opener.startpos, pos);
|
|
553
|
+
return pos + 1;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
return null;
|
|
557
|
+
},
|
|
558
|
+
[C_HYPHEN]: function (self, pos, endpos) {
|
|
559
|
+
const subject = self.subject;
|
|
560
|
+
if (subject.codePointAt(pos - 1) === C_LEFT_BRACE ||
|
|
561
|
+
subject.codePointAt(pos + 1) === C_RIGHT_BRACE) {
|
|
562
|
+
const newpos = betweenMatched("-", "delete", "str", hasBrace)(self, pos, endpos);
|
|
563
|
+
if (newpos) {
|
|
564
|
+
return newpos;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
// didn't match a del, try for smart hyphens:
|
|
568
|
+
let ep = pos;
|
|
569
|
+
let hyphens = 0;
|
|
570
|
+
while (ep <= endpos && subject.codePointAt(ep) === C_HYPHEN) {
|
|
571
|
+
ep++;
|
|
572
|
+
hyphens++;
|
|
573
|
+
}
|
|
574
|
+
if (subject.codePointAt(ep) === C_RIGHT_BRACE) {
|
|
575
|
+
hyphens--; // last hyphen is close del
|
|
576
|
+
}
|
|
577
|
+
if (hyphens === 0) { // this means we have '-}'
|
|
578
|
+
self.addMatch(pos, pos + 1, "str");
|
|
579
|
+
return pos + 2;
|
|
580
|
+
}
|
|
581
|
+
// Try to construct a homogeneous sequence of dashes
|
|
582
|
+
const all_em = hyphens % 3 === 0;
|
|
583
|
+
const all_en = hyphens % 2 === 0;
|
|
584
|
+
while (hyphens > 0) {
|
|
585
|
+
if (all_em) {
|
|
586
|
+
self.addMatch(pos, pos + 2, "em_dash");
|
|
587
|
+
pos = pos + 3;
|
|
588
|
+
hyphens = hyphens - 3;
|
|
589
|
+
}
|
|
590
|
+
else if (all_en) {
|
|
591
|
+
self.addMatch(pos, pos + 1, "en_dash");
|
|
592
|
+
pos = pos + 2;
|
|
593
|
+
hyphens = hyphens - 2;
|
|
594
|
+
}
|
|
595
|
+
else if (hyphens >= 3 && (hyphens % 2 !== 0 || hyphens > 4)) {
|
|
596
|
+
self.addMatch(pos, pos + 2, "em_dash");
|
|
597
|
+
pos = pos + 3;
|
|
598
|
+
hyphens = hyphens - 3;
|
|
599
|
+
}
|
|
600
|
+
else if (hyphens >= 2) {
|
|
601
|
+
self.addMatch(pos, pos + 1, "en_dash");
|
|
602
|
+
pos = pos + 2;
|
|
603
|
+
hyphens = hyphens - 2;
|
|
604
|
+
}
|
|
605
|
+
else {
|
|
606
|
+
self.addMatch(pos, pos, "str");
|
|
607
|
+
pos = pos + 1;
|
|
608
|
+
hyphens = hyphens - 1;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
return pos;
|
|
612
|
+
}
|
|
613
|
+
};
|
|
614
|
+
class InlineParser {
|
|
615
|
+
options;
|
|
616
|
+
warn;
|
|
617
|
+
subject;
|
|
618
|
+
matches;
|
|
619
|
+
openers; // map from opener type to Opener[] in reverse order
|
|
620
|
+
verbatim; // parsing a verbatim span to be ended by N backticks
|
|
621
|
+
verbatimType; // math or regular
|
|
622
|
+
destination; // parsing link destination?
|
|
623
|
+
firstpos; // position of first slice
|
|
624
|
+
lastpos; // position of last slice
|
|
625
|
+
allowAttributes; // allow parsing of attributes
|
|
626
|
+
attributeParser; // attribute parser
|
|
627
|
+
attributeStart; // start pos of potential attribute
|
|
628
|
+
attributeSlices; // slices we've tried to parse as attributes
|
|
629
|
+
pendingSpan; // span awaiting attribute confirmation
|
|
630
|
+
matchers; // functions to handle different code points
|
|
631
|
+
constructor(subject, options = {}) {
|
|
632
|
+
this.options = options;
|
|
633
|
+
this.warn = options.warn || (() => { });
|
|
634
|
+
this.subject = subject;
|
|
635
|
+
this.matches = []; // array of matches
|
|
636
|
+
this.openers = {};
|
|
637
|
+
this.verbatim = 0;
|
|
638
|
+
this.verbatimType = "";
|
|
639
|
+
this.destination = false;
|
|
640
|
+
this.firstpos = -1;
|
|
641
|
+
this.lastpos = 0;
|
|
642
|
+
this.allowAttributes = true;
|
|
643
|
+
this.attributeParser = null;
|
|
644
|
+
this.attributeStart = null;
|
|
645
|
+
this.attributeSlices = null;
|
|
646
|
+
this.pendingSpan = null;
|
|
647
|
+
this.matchers = matchers;
|
|
648
|
+
}
|
|
649
|
+
addMatch(startpos, endpos, annot, matchIndex) {
|
|
650
|
+
const match = { startpos: startpos, endpos: endpos, annot: annot };
|
|
651
|
+
if (matchIndex !== undefined) {
|
|
652
|
+
// insert into the proper place, replacing placeholder
|
|
653
|
+
this.matches.splice(matchIndex, 1, match);
|
|
654
|
+
}
|
|
655
|
+
else {
|
|
656
|
+
this.matches.push(match);
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
addImageMarker(opener) {
|
|
660
|
+
const prevIdx = opener.matchIndex - 1;
|
|
661
|
+
const prevMatch = this.matches[prevIdx];
|
|
662
|
+
if (prevMatch && prevMatch.annot === "str" &&
|
|
663
|
+
prevMatch.startpos < opener.startpos - 1) {
|
|
664
|
+
// '!' is grouped with preceding text in a single str match.
|
|
665
|
+
// Truncate the str to end before '!' and insert image_marker.
|
|
666
|
+
prevMatch.endpos = opener.startpos - 2;
|
|
667
|
+
this.matches.splice(prevIdx + 1, 0, {
|
|
668
|
+
startpos: opener.startpos - 1,
|
|
669
|
+
endpos: opener.startpos - 1,
|
|
670
|
+
annot: "image_marker"
|
|
671
|
+
});
|
|
672
|
+
// Adjust indices since we inserted a new element
|
|
673
|
+
opener.matchIndex += 1;
|
|
674
|
+
opener.subMatchIndex += 1;
|
|
675
|
+
}
|
|
676
|
+
else {
|
|
677
|
+
// '!' is alone in its str match, replace it directly
|
|
678
|
+
this.addMatch(opener.startpos - 1, opener.startpos - 1, "image_marker", prevIdx);
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
inVerbatim() {
|
|
682
|
+
return (this.verbatim > 0);
|
|
683
|
+
}
|
|
684
|
+
singleChar(pos) {
|
|
685
|
+
this.addMatch(pos, pos, "str");
|
|
686
|
+
return pos + 1;
|
|
687
|
+
}
|
|
688
|
+
reparseAttributes() {
|
|
689
|
+
// Reparse attributeSlices that we tried to parse as an attribute
|
|
690
|
+
const slices = this.attributeSlices;
|
|
691
|
+
if (slices === null) {
|
|
692
|
+
return;
|
|
693
|
+
}
|
|
694
|
+
const pendingSpan = this.pendingSpan;
|
|
695
|
+
if (pendingSpan) {
|
|
696
|
+
// a span is only a span when followed by a valid attribute;
|
|
697
|
+
// make the brackets literal again
|
|
698
|
+
this.matches[pendingSpan.openMatchIndex].annot = "str";
|
|
699
|
+
this.matches[pendingSpan.closeMatchIndex].annot = "str";
|
|
700
|
+
this.pendingSpan = null;
|
|
701
|
+
}
|
|
702
|
+
this.allowAttributes = false;
|
|
703
|
+
this.attributeParser = null;
|
|
704
|
+
this.attributeStart = null;
|
|
705
|
+
if (slices !== null) {
|
|
706
|
+
for (const slice of slices) {
|
|
707
|
+
this.feed(slice.startpos, slice.endpos);
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
this.allowAttributes = true;
|
|
711
|
+
this.attributeSlices = null;
|
|
712
|
+
}
|
|
713
|
+
getMatches() {
|
|
714
|
+
const subject = this.subject;
|
|
715
|
+
if (this.attributeParser) {
|
|
716
|
+
// we're still in an attribute parse
|
|
717
|
+
this.reparseAttributes();
|
|
718
|
+
}
|
|
719
|
+
let i = this.matches.length - 1;
|
|
720
|
+
// remove trailing softbreak and any spaces
|
|
721
|
+
if (this.matches[i] && this.matches[i].annot === "soft_break") {
|
|
722
|
+
this.matches.pop();
|
|
723
|
+
const match = this.matches[this.matches.length - 1];
|
|
724
|
+
if (match && match.annot === "str" &&
|
|
725
|
+
subject.codePointAt(match.endpos) === 32) {
|
|
726
|
+
while (match.endpos >= match.startpos &&
|
|
727
|
+
subject.codePointAt(match.endpos) === 32) {
|
|
728
|
+
match.endpos = match.endpos - 1;
|
|
729
|
+
}
|
|
730
|
+
if (match.endpos < match.startpos) {
|
|
731
|
+
this.matches.pop();
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
// add -verbatim if needed
|
|
736
|
+
if (this.matches.length > 0 && this.verbatim > 0) { // unclosed verbatim
|
|
737
|
+
const last = this.matches[this.matches.length - 1];
|
|
738
|
+
this.warn(new Warning("Unclosed verbatim", last.endpos));
|
|
739
|
+
this.matches.push({
|
|
740
|
+
startpos: last.endpos,
|
|
741
|
+
endpos: last.endpos,
|
|
742
|
+
annot: "-" + this.verbatimType
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
return this.matches;
|
|
746
|
+
}
|
|
747
|
+
addOpener(name, startpos, endpos, defaultAnnot) {
|
|
748
|
+
if (!this.openers[name]) {
|
|
749
|
+
this.openers[name] = [];
|
|
750
|
+
}
|
|
751
|
+
this.openers[name].push({ matchIndex: this.matches.length,
|
|
752
|
+
startpos: startpos,
|
|
753
|
+
endpos: endpos,
|
|
754
|
+
annot: null,
|
|
755
|
+
subMatchIndex: this.matches.length,
|
|
756
|
+
substartpos: null,
|
|
757
|
+
subendpos: null,
|
|
758
|
+
citeParts: null });
|
|
759
|
+
// add default match (to be used if we don't match the opener)
|
|
760
|
+
this.addMatch(startpos, endpos, defaultAnnot);
|
|
761
|
+
}
|
|
762
|
+
clearOpeners(startpos, endpos) {
|
|
763
|
+
// Remove other openers in between the matches
|
|
764
|
+
for (const k in this.openers) {
|
|
765
|
+
const v = this.openers[k];
|
|
766
|
+
let i = v.length - 1;
|
|
767
|
+
while (v[i]) {
|
|
768
|
+
const opener = v[i];
|
|
769
|
+
if (opener.startpos >= startpos && opener.endpos <= endpos) {
|
|
770
|
+
v.splice(i, 1);
|
|
771
|
+
}
|
|
772
|
+
else if ((opener.substartpos && opener.substartpos >= startpos) &&
|
|
773
|
+
(opener.subendpos && opener.subendpos <= endpos)) {
|
|
774
|
+
v[i].substartpos = null;
|
|
775
|
+
v[i].subendpos = null;
|
|
776
|
+
v[i].annot = null;
|
|
777
|
+
}
|
|
778
|
+
else {
|
|
779
|
+
break;
|
|
780
|
+
}
|
|
781
|
+
i--;
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
// Note the last match, a citation key or a ';', on the '[' it is
|
|
786
|
+
// directly inside.
|
|
787
|
+
addCitePart(opener, isKey) {
|
|
788
|
+
if (opener.citeParts === null) {
|
|
789
|
+
opener.citeParts = [];
|
|
790
|
+
}
|
|
791
|
+
const parts = opener.citeParts;
|
|
792
|
+
const last = parts[parts.length - 1];
|
|
793
|
+
const part = { match: this.matches[this.matches.length - 1],
|
|
794
|
+
keys: last ? last.keys : 0,
|
|
795
|
+
itemKeys: last ? last.itemKeys : 0,
|
|
796
|
+
first: last ? last.first : true,
|
|
797
|
+
invalid: last ? last.invalid : false };
|
|
798
|
+
if (isKey) {
|
|
799
|
+
part.keys++;
|
|
800
|
+
part.itemKeys++;
|
|
801
|
+
if (part.itemKeys > 1) {
|
|
802
|
+
part.invalid = true; // an item with two keys
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
else {
|
|
806
|
+
if (part.itemKeys === 0 && !part.first) {
|
|
807
|
+
part.invalid = true; // an item in the middle with no key
|
|
808
|
+
}
|
|
809
|
+
part.itemKeys = 0;
|
|
810
|
+
part.first = false;
|
|
811
|
+
}
|
|
812
|
+
parts.push(part);
|
|
813
|
+
}
|
|
814
|
+
// Emphasis or the like starting at startpos has just closed: the keys
|
|
815
|
+
// and ';'s inside it are not directly inside the '[' around it.
|
|
816
|
+
nestCiteParts(startpos) {
|
|
817
|
+
const openers = this.openers["["];
|
|
818
|
+
if (openers && openers.length > 0) {
|
|
819
|
+
const parts = openers[openers.length - 1].citeParts;
|
|
820
|
+
while (parts && parts.length > 0 &&
|
|
821
|
+
parts[parts.length - 1].match.startpos > startpos) {
|
|
822
|
+
parts.pop();
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
// Make the brackets from opener to the ']' at closepos a citation, if
|
|
827
|
+
// what is directly inside them (not inside emphasis, a span and so on)
|
|
828
|
+
// is one: items separated by ';', each with one key, except that the
|
|
829
|
+
// first and last may have none, and are then the prefix and suffix of the
|
|
830
|
+
// whole citation:
|
|
831
|
+
//
|
|
832
|
+
// [see also; the brilliant @doe99, p. 33; -@roe00; among others]
|
|
833
|
+
//
|
|
834
|
+
// The '[' becomes +citation and the ']' -citation, each ';' a
|
|
835
|
+
// citation_separator and each key a citation_key; the spaces around them
|
|
836
|
+
// are left to the parser to trim. Return whether it did.
|
|
837
|
+
addCitation(opener, closepos) {
|
|
838
|
+
const parts = opener.citeParts;
|
|
839
|
+
const last = parts && parts[parts.length - 1];
|
|
840
|
+
if (!parts || !last || last.keys === 0 || last.invalid) {
|
|
841
|
+
return false;
|
|
842
|
+
}
|
|
843
|
+
for (const part of parts) {
|
|
844
|
+
part.match.annot = part.match.startpos === part.match.endpos &&
|
|
845
|
+
this.subject.charCodeAt(part.match.startpos) === C_SEMICOLON ?
|
|
846
|
+
"citation_separator" : "citation_key";
|
|
847
|
+
}
|
|
848
|
+
this.addMatch(opener.startpos, opener.endpos, "+citation", opener.matchIndex);
|
|
849
|
+
this.addMatch(closepos, closepos, "-citation");
|
|
850
|
+
this.clearOpeners(opener.startpos, closepos);
|
|
851
|
+
return true;
|
|
852
|
+
}
|
|
853
|
+
strMatches(startpos, endpos) {
|
|
854
|
+
// convert matches between startpos and endpos to str
|
|
855
|
+
let i = this.matches.length - 1;
|
|
856
|
+
// backup to startpos
|
|
857
|
+
while (i > 0 && this.matches[i].startpos >= startpos) {
|
|
858
|
+
i--;
|
|
859
|
+
}
|
|
860
|
+
if (this.matches[i].startpos < startpos) {
|
|
861
|
+
i++;
|
|
862
|
+
}
|
|
863
|
+
while (this.matches[i] && this.matches[i].endpos <= endpos) {
|
|
864
|
+
const m = this.matches[i];
|
|
865
|
+
// An open marker is already included in the following delimiter match.
|
|
866
|
+
if (m.annot !== "escape" && m.annot !== "str" &&
|
|
867
|
+
m.annot !== "open_marker") {
|
|
868
|
+
m.annot = "str";
|
|
869
|
+
}
|
|
870
|
+
i++;
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
feed(startpos, endpos) {
|
|
874
|
+
// Feed a slice to the parser, updating state.
|
|
875
|
+
const subject = this.subject;
|
|
876
|
+
if (this.firstpos === -1 || startpos < this.firstpos) {
|
|
877
|
+
this.firstpos = startpos;
|
|
878
|
+
}
|
|
879
|
+
if (this.lastpos === 0 || endpos > this.lastpos) {
|
|
880
|
+
this.lastpos = endpos;
|
|
881
|
+
}
|
|
882
|
+
let pos = startpos;
|
|
883
|
+
while (pos <= endpos) {
|
|
884
|
+
if (this.attributeParser !== null) {
|
|
885
|
+
const sp = pos;
|
|
886
|
+
const nextSpecial = findSpecial(subject, pos, endpos, false);
|
|
887
|
+
let ep2;
|
|
888
|
+
if (nextSpecial === null) {
|
|
889
|
+
ep2 = endpos;
|
|
890
|
+
}
|
|
891
|
+
else {
|
|
892
|
+
ep2 = nextSpecial;
|
|
893
|
+
}
|
|
894
|
+
const result = this.attributeParser.feed(sp, ep2);
|
|
895
|
+
const ep = result.position;
|
|
896
|
+
if (result.status === "done") {
|
|
897
|
+
const attributeStart = this.attributeStart;
|
|
898
|
+
// add attribute matches
|
|
899
|
+
if (attributeStart !== null) {
|
|
900
|
+
this.addMatch(attributeStart, attributeStart, "+attributes");
|
|
901
|
+
}
|
|
902
|
+
const attrMatches = this.attributeParser.matches;
|
|
903
|
+
// add attribute matches
|
|
904
|
+
for (const match of attrMatches) {
|
|
905
|
+
this.addMatch(match.startpos, match.endpos, match.annot);
|
|
906
|
+
}
|
|
907
|
+
this.addMatch(ep, ep, "-attributes");
|
|
908
|
+
// restore state to prior to adding attribute parser
|
|
909
|
+
this.attributeParser = null;
|
|
910
|
+
this.attributeStart = null;
|
|
911
|
+
this.attributeSlices = null;
|
|
912
|
+
this.pendingSpan = null;
|
|
913
|
+
pos = ep + 1;
|
|
914
|
+
}
|
|
915
|
+
else if (result.status === "fail") {
|
|
916
|
+
this.reparseAttributes();
|
|
917
|
+
pos = sp;
|
|
918
|
+
// as no slice was added for it
|
|
919
|
+
}
|
|
920
|
+
else if (result.status === "continue") {
|
|
921
|
+
if (this.attributeSlices === null) {
|
|
922
|
+
this.attributeSlices = [];
|
|
923
|
+
}
|
|
924
|
+
this.attributeSlices.push({ startpos: sp, endpos: ep });
|
|
925
|
+
pos = ep + 1;
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
else {
|
|
929
|
+
// find next interesting character:
|
|
930
|
+
const brackets = this.openers["["];
|
|
931
|
+
const nextSpecial = findSpecial(subject, pos, endpos, brackets !== undefined && brackets.length > 0);
|
|
932
|
+
let newpos;
|
|
933
|
+
if (nextSpecial === null) {
|
|
934
|
+
newpos = endpos + 1;
|
|
935
|
+
}
|
|
936
|
+
else {
|
|
937
|
+
newpos = nextSpecial;
|
|
938
|
+
}
|
|
939
|
+
if (newpos > pos) {
|
|
940
|
+
this.addMatch(pos, newpos - 1, "str");
|
|
941
|
+
pos = newpos;
|
|
942
|
+
if (pos > endpos) {
|
|
943
|
+
break; // otherwise, fall through:
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
// if we get here, then newpos = pos,
|
|
947
|
+
// i.e. we have something interesting at pos
|
|
948
|
+
const c = subject.codePointAt(pos);
|
|
949
|
+
if (c === undefined) {
|
|
950
|
+
throw (new Error("Code point at " + pos + " is undefined."));
|
|
951
|
+
}
|
|
952
|
+
if (c === C_CR || c === C_LF) { // cr or lf
|
|
953
|
+
if (c === C_CR && subject.codePointAt(pos + 1) === C_LF &&
|
|
954
|
+
pos + 1 <= endpos) {
|
|
955
|
+
this.addMatch(pos, pos + 1, "soft_break");
|
|
956
|
+
pos = pos + 2;
|
|
957
|
+
}
|
|
958
|
+
else {
|
|
959
|
+
this.addMatch(pos, pos, "soft_break");
|
|
960
|
+
pos = pos + 1;
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
else if (this.verbatim > 0) {
|
|
964
|
+
if (c === 96) {
|
|
965
|
+
const m = find(subject, pattBackticks1, pos, endpos);
|
|
966
|
+
if (m) {
|
|
967
|
+
const endchar = m.endpos;
|
|
968
|
+
if (m.endpos - pos + 1 === this.verbatim) {
|
|
969
|
+
// check for raw attribute
|
|
970
|
+
const m2 = find(subject, pattRawAttribute, endchar + 1, endpos);
|
|
971
|
+
if (m2 && this.verbatimType === "verbatim") { // raw
|
|
972
|
+
this.addMatch(pos, endchar, "-" + this.verbatimType);
|
|
973
|
+
this.addMatch(m2.startpos, m2.endpos, "raw_format");
|
|
974
|
+
pos = m2.endpos + 1;
|
|
975
|
+
}
|
|
976
|
+
else {
|
|
977
|
+
this.addMatch(pos, endchar, "-" + this.verbatimType);
|
|
978
|
+
pos = endchar + 1;
|
|
979
|
+
}
|
|
980
|
+
this.verbatim = 0;
|
|
981
|
+
this.verbatimType = "verbatim";
|
|
982
|
+
}
|
|
983
|
+
else {
|
|
984
|
+
this.addMatch(pos, endchar, "str");
|
|
985
|
+
pos = endchar + 1;
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
else {
|
|
989
|
+
this.addMatch(pos, endpos, "str");
|
|
990
|
+
pos = endpos + 1;
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
else {
|
|
994
|
+
this.addMatch(pos, pos, "str");
|
|
995
|
+
pos = pos + 1;
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
else {
|
|
999
|
+
const matcher = this.matchers[c];
|
|
1000
|
+
if (matcher) {
|
|
1001
|
+
const res = matcher(this, pos, endpos);
|
|
1002
|
+
if (res === null) {
|
|
1003
|
+
pos = this.singleChar(pos);
|
|
1004
|
+
}
|
|
1005
|
+
else {
|
|
1006
|
+
pos = res;
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
else {
|
|
1010
|
+
pos = this.singleChar(pos);
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
return;
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
export { InlineParser };
|
|
1019
|
+
//# sourceMappingURL=inline.js.map
|