pulpweaver4 0.0.0-stage → 0.0.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ast/djot.d.ts +124 -0
- package/dist/ast/djot.js +464 -0
- package/dist/ast/djot.js.map +1 -0
- package/dist/ast/index.d.ts +10 -0
- package/dist/ast/index.js +11 -0
- package/dist/ast/index.js.map +1 -0
- package/dist/ast/locator.d.ts +27 -0
- package/dist/ast/locator.js +77 -0
- package/dist/ast/locator.js.map +1 -0
- package/dist/ast/nodes.d.ts +543 -0
- package/dist/ast/nodes.js +56 -0
- package/dist/ast/nodes.js.map +1 -0
- package/dist/ast/position.d.ts +88 -0
- package/dist/ast/position.js +98 -0
- package/dist/ast/position.js.map +1 -0
- package/dist/ast/traverse.d.ts +12 -0
- package/dist/ast/traverse.js +37 -0
- package/dist/ast/traverse.js.map +1 -0
- package/dist/bibliography/biblatex.d.ts +13 -0
- package/dist/bibliography/biblatex.js +849 -0
- package/dist/bibliography/biblatex.js.map +1 -0
- package/dist/bibliography/bibtex.d.ts +39 -0
- package/dist/bibliography/bibtex.js +259 -0
- package/dist/bibliography/bibtex.js.map +1 -0
- package/dist/bibliography/csl.d.ts +9 -0
- package/dist/bibliography/csl.js +241 -0
- package/dist/bibliography/csl.js.map +1 -0
- package/dist/bibliography/dates.d.ts +33 -0
- package/dist/bibliography/dates.js +223 -0
- package/dist/bibliography/dates.js.map +1 -0
- package/dist/bibliography/index.d.ts +8 -0
- package/dist/bibliography/index.js +9 -0
- package/dist/bibliography/index.js.map +1 -0
- package/dist/bibliography/item.d.ts +142 -0
- package/dist/bibliography/item.js +181 -0
- package/dist/bibliography/item.js.map +1 -0
- package/dist/bibliography/latex.d.ts +21 -0
- package/dist/bibliography/latex.js +586 -0
- package/dist/bibliography/latex.js.map +1 -0
- package/dist/bibliography/names.d.ts +23 -0
- package/dist/bibliography/names.js +244 -0
- package/dist/bibliography/names.js.map +1 -0
- package/dist/bibliography/read.d.ts +24 -0
- package/dist/bibliography/read.js +50 -0
- package/dist/bibliography/read.js.map +1 -0
- package/dist/citations/book.d.ts +93 -0
- package/dist/citations/book.js +217 -0
- package/dist/citations/book.js.map +1 -0
- package/dist/citations/collect.d.ts +56 -0
- package/dist/citations/collect.js +129 -0
- package/dist/citations/collect.js.map +1 -0
- package/dist/citations/hast.d.ts +12 -0
- package/dist/citations/hast.js +49 -0
- package/dist/citations/hast.js.map +1 -0
- package/dist/citations/index.d.ts +14 -0
- package/dist/citations/index.js +15 -0
- package/dist/citations/index.js.map +1 -0
- package/dist/citations/lint.d.ts +70 -0
- package/dist/citations/lint.js +92 -0
- package/dist/citations/lint.js.map +1 -0
- package/dist/citations/notes.d.ts +11 -0
- package/dist/citations/notes.js +163 -0
- package/dist/citations/notes.js.map +1 -0
- package/dist/citations/positions.d.ts +34 -0
- package/dist/citations/positions.js +90 -0
- package/dist/citations/positions.js.map +1 -0
- package/dist/citations/project.d.ts +7 -0
- package/dist/citations/project.js +24 -0
- package/dist/citations/project.js.map +1 -0
- package/dist/colour/cmyk.d.ts +71 -0
- package/dist/colour/cmyk.js +210 -0
- package/dist/colour/cmyk.js.map +1 -0
- package/dist/colour/images.d.ts +36 -0
- package/dist/colour/images.js +106 -0
- package/dist/colour/images.js.map +1 -0
- package/dist/colour/index.d.ts +7 -0
- package/dist/colour/index.js +8 -0
- package/dist/colour/index.js.map +1 -0
- package/dist/colour/ink-limit.d.ts +68 -0
- package/dist/colour/ink-limit.js +109 -0
- package/dist/colour/ink-limit.js.map +1 -0
- package/dist/colour/intents.d.ts +145 -0
- package/dist/colour/intents.js +193 -0
- package/dist/colour/intents.js.map +1 -0
- package/dist/colour/lcms.d.ts +79 -0
- package/dist/colour/lcms.js +229 -0
- package/dist/colour/lcms.js.map +1 -0
- package/dist/colour/previews.d.ts +49 -0
- package/dist/colour/previews.js +116 -0
- package/dist/colour/previews.js.map +1 -0
- package/dist/colour/wasm/LICENSE-lcms2 +22 -0
- package/dist/colour/wasm/lcms2.wasm +0 -0
- package/dist/config/config.d.ts +114 -0
- package/dist/config/config.js +309 -0
- package/dist/config/config.js.map +1 -0
- package/dist/config/index.d.ts +6 -0
- package/dist/config/index.js +7 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/page.d.ts +42 -0
- package/dist/config/page.js +95 -0
- package/dist/config/page.js.map +1 -0
- package/dist/config/project-schema.d.ts +23 -0
- package/dist/config/project-schema.js +223 -0
- package/dist/config/project-schema.js.map +1 -0
- package/dist/config/schema.d.ts +68 -0
- package/dist/config/schema.js +333 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/toml.d.ts +54 -0
- package/dist/config/toml.js +238 -0
- package/dist/config/toml.js.map +1 -0
- package/dist/contents/index.d.ts +8 -0
- package/dist/contents/index.js +9 -0
- package/dist/contents/index.js.map +1 -0
- package/dist/contents/transform.d.ts +64 -0
- package/dist/contents/transform.js +149 -0
- package/dist/contents/transform.js.map +1 -0
- package/dist/csl/affix.d.ts +16 -0
- package/dist/csl/affix.js +74 -0
- package/dist/csl/affix.js.map +1 -0
- package/dist/csl/data/chicago-author-date.d.ts +2 -0
- package/dist/csl/data/chicago-author-date.js +3 -0
- package/dist/csl/data/chicago-author-date.js.map +1 -0
- package/dist/csl/data/chicago-notes-bibliography.d.ts +2 -0
- package/dist/csl/data/chicago-notes-bibliography.js +3 -0
- package/dist/csl/data/chicago-notes-bibliography.js.map +1 -0
- package/dist/csl/data/locales-en-GB.d.ts +2 -0
- package/dist/csl/data/locales-en-GB.js +3 -0
- package/dist/csl/data/locales-en-GB.js.map +1 -0
- package/dist/csl/data/locales-en-US.d.ts +2 -0
- package/dist/csl/data/locales-en-US.js +3 -0
- package/dist/csl/data/locales-en-US.js.map +1 -0
- package/dist/csl/dates.d.ts +30 -0
- package/dist/csl/dates.js +223 -0
- package/dist/csl/dates.js.map +1 -0
- package/dist/csl/format.d.ts +29 -0
- package/dist/csl/format.js +157 -0
- package/dist/csl/format.js.map +1 -0
- package/dist/csl/index.d.ts +26 -0
- package/dist/csl/index.js +16 -0
- package/dist/csl/index.js.map +1 -0
- package/dist/csl/ir.d.ts +103 -0
- package/dist/csl/ir.js +549 -0
- package/dist/csl/ir.js.map +1 -0
- package/dist/csl/load.d.ts +98 -0
- package/dist/csl/load.js +163 -0
- package/dist/csl/load.js.map +1 -0
- package/dist/csl/locale.d.ts +90 -0
- package/dist/csl/locale.js +251 -0
- package/dist/csl/locale.js.map +1 -0
- package/dist/csl/names.d.ts +41 -0
- package/dist/csl/names.js +203 -0
- package/dist/csl/names.js.map +1 -0
- package/dist/csl/numbers.d.ts +48 -0
- package/dist/csl/numbers.js +170 -0
- package/dist/csl/numbers.js.map +1 -0
- package/dist/csl/processor.d.ts +179 -0
- package/dist/csl/processor.js +765 -0
- package/dist/csl/processor.js.map +1 -0
- package/dist/csl/project.d.ts +21 -0
- package/dist/csl/project.js +85 -0
- package/dist/csl/project.js.map +1 -0
- package/dist/csl/render.d.ts +130 -0
- package/dist/csl/render.js +748 -0
- package/dist/csl/render.js.map +1 -0
- package/dist/csl/style.d.ts +168 -0
- package/dist/csl/style.js +262 -0
- package/dist/csl/style.js.map +1 -0
- package/dist/csl/xml.d.ts +28 -0
- package/dist/csl/xml.js +162 -0
- package/dist/csl/xml.js.map +1 -0
- package/dist/djot/djot.js/LICENSE +20 -0
- package/dist/djot/djot.js/src/ast.d.ts +327 -0
- package/dist/djot/djot.js/src/ast.js +68 -0
- package/dist/djot/djot.js/src/ast.js.map +1 -0
- package/dist/djot/djot.js/src/attributes.d.ts +31 -0
- package/dist/djot/djot.js/src/attributes.js +300 -0
- package/dist/djot/djot.js/src/attributes.js.map +1 -0
- package/dist/djot/djot.js/src/block.d.ts +87 -0
- package/dist/djot/djot.js/src/block.js +1201 -0
- package/dist/djot/djot.js/src/block.js.map +1 -0
- package/dist/djot/djot.js/src/djot-renderer.d.ts +8 -0
- package/dist/djot/djot.js/src/djot-renderer.js +755 -0
- package/dist/djot/djot.js/src/djot-renderer.js.map +1 -0
- package/dist/djot/djot.js/src/event.d.ts +6 -0
- package/dist/djot/djot.js/src/event.js +2 -0
- package/dist/djot/djot.js/src/event.js.map +1 -0
- package/dist/djot/djot.js/src/filter.d.ts +13 -0
- package/dist/djot/djot.js/src/filter.js +159 -0
- package/dist/djot/djot.js/src/filter.js.map +1 -0
- package/dist/djot/djot.js/src/find.d.ts +7 -0
- package/dist/djot/djot.js/src/find.js +33 -0
- package/dist/djot/djot.js/src/find.js.map +1 -0
- package/dist/djot/djot.js/src/html.d.ts +40 -0
- package/dist/djot/djot.js/src/html.js +657 -0
- package/dist/djot/djot.js/src/html.js.map +1 -0
- package/dist/djot/djot.js/src/index.d.ts +9 -0
- package/dist/djot/djot.js/src/index.js +9 -0
- package/dist/djot/djot.js/src/index.js.map +1 -0
- package/dist/djot/djot.js/src/inline.d.ts +62 -0
- package/dist/djot/djot.js/src/inline.js +1032 -0
- package/dist/djot/djot.js/src/inline.js.map +1 -0
- package/dist/djot/djot.js/src/options.d.ts +13 -0
- package/dist/djot/djot.js/src/options.js +27 -0
- package/dist/djot/djot.js/src/options.js.map +1 -0
- package/dist/djot/djot.js/src/pandoc.d.ts +20 -0
- package/dist/djot/djot.js/src/pandoc.js +1110 -0
- package/dist/djot/djot.js/src/pandoc.js.map +1 -0
- package/dist/djot/djot.js/src/parse.d.ts +19 -0
- package/dist/djot/djot.js/src/parse.js +1445 -0
- package/dist/djot/djot.js/src/parse.js.map +1 -0
- package/dist/djot/djot.js/src/version.d.ts +1 -0
- package/dist/djot/djot.js/src/version.js +2 -0
- package/dist/djot/djot.js/src/version.js.map +1 -0
- package/dist/djot/index.d.ts +5 -0
- package/dist/djot/index.js +6 -0
- package/dist/djot/index.js.map +1 -0
- package/dist/djot/read.d.ts +57 -0
- package/dist/djot/read.js +146 -0
- package/dist/djot/read.js.map +1 -0
- package/dist/fonts/css.d.ts +82 -0
- package/dist/fonts/css.js +329 -0
- package/dist/fonts/css.js.map +1 -0
- package/dist/fonts/faces.d.ts +101 -0
- package/dist/fonts/faces.js +226 -0
- package/dist/fonts/faces.js.map +1 -0
- package/dist/fonts/index.d.ts +12 -0
- package/dist/fonts/index.js +13 -0
- package/dist/fonts/index.js.map +1 -0
- package/dist/fonts/lint.d.ts +58 -0
- package/dist/fonts/lint.js +209 -0
- package/dist/fonts/lint.js.map +1 -0
- package/dist/fonts/match.d.ts +36 -0
- package/dist/fonts/match.js +104 -0
- package/dist/fonts/match.js.map +1 -0
- package/dist/fonts/names.d.ts +9 -0
- package/dist/fonts/names.js +50 -0
- package/dist/fonts/names.js.map +1 -0
- package/dist/fonts/subset.d.ts +72 -0
- package/dist/fonts/subset.js +169 -0
- package/dist/fonts/subset.js.map +1 -0
- package/dist/fonts/walk.d.ts +33 -0
- package/dist/fonts/walk.js +120 -0
- package/dist/fonts/walk.js.map +1 -0
- package/dist/fonts/wasm/LICENSE-harfbuzzjs +19 -0
- package/dist/fonts/wasm/harfbuzz-subset.wasm +0 -0
- package/dist/html/check.d.ts +62 -0
- package/dist/html/check.js +186 -0
- package/dist/html/check.js.map +1 -0
- package/dist/html/counters.d.ts +32 -0
- package/dist/html/counters.js +72 -0
- package/dist/html/counters.js.map +1 -0
- package/dist/html/css.d.ts +33 -0
- package/dist/html/css.js +72 -0
- package/dist/html/css.js.map +1 -0
- package/dist/html/dom.d.ts +28 -0
- package/dist/html/dom.js +162 -0
- package/dist/html/dom.js.map +1 -0
- package/dist/html/editions.d.ts +26 -0
- package/dist/html/editions.js +57 -0
- package/dist/html/editions.js.map +1 -0
- package/dist/html/images.d.ts +13 -0
- package/dist/html/images.js +62 -0
- package/dist/html/images.js.map +1 -0
- package/dist/html/index.d.ts +14 -0
- package/dist/html/index.js +15 -0
- package/dist/html/index.js.map +1 -0
- package/dist/html/registry.d.ts +120 -0
- package/dist/html/registry.js +48 -0
- package/dist/html/registry.js.map +1 -0
- package/dist/html/render.d.ts +99 -0
- package/dist/html/render.js +694 -0
- package/dist/html/render.js.map +1 -0
- package/dist/hyphenation/NOTICE +429 -0
- package/dist/hyphenation/exceptions.d.ts +60 -0
- package/dist/hyphenation/exceptions.js +79 -0
- package/dist/hyphenation/exceptions.js.map +1 -0
- package/dist/hyphenation/hyphenator.d.ts +66 -0
- package/dist/hyphenation/hyphenator.js +245 -0
- package/dist/hyphenation/hyphenator.js.map +1 -0
- package/dist/hyphenation/index.d.ts +4 -0
- package/dist/hyphenation/index.js +5 -0
- package/dist/hyphenation/index.js.map +1 -0
- package/dist/hyphenation/languages.d.ts +20 -0
- package/dist/hyphenation/languages.js +75 -0
- package/dist/hyphenation/languages.js.map +1 -0
- package/dist/hyphenation/patterns/af.wasm +0 -0
- package/dist/hyphenation/patterns/as.wasm +0 -0
- package/dist/hyphenation/patterns/be.wasm +0 -0
- package/dist/hyphenation/patterns/bg.wasm +0 -0
- package/dist/hyphenation/patterns/bn.wasm +0 -0
- package/dist/hyphenation/patterns/ca.wasm +0 -0
- package/dist/hyphenation/patterns/cy.wasm +0 -0
- package/dist/hyphenation/patterns/da.wasm +0 -0
- package/dist/hyphenation/patterns/de.wasm +0 -0
- package/dist/hyphenation/patterns/el-monoton.wasm +0 -0
- package/dist/hyphenation/patterns/el-polyton.wasm +0 -0
- package/dist/hyphenation/patterns/en-gb.wasm +0 -0
- package/dist/hyphenation/patterns/en-us.wasm +0 -0
- package/dist/hyphenation/patterns/eo.wasm +0 -0
- package/dist/hyphenation/patterns/es.wasm +0 -0
- package/dist/hyphenation/patterns/et.wasm +0 -0
- package/dist/hyphenation/patterns/eu.wasm +0 -0
- package/dist/hyphenation/patterns/fi-x-school.wasm +0 -0
- package/dist/hyphenation/patterns/fr.wasm +0 -0
- package/dist/hyphenation/patterns/fur.wasm +0 -0
- package/dist/hyphenation/patterns/ga.wasm +0 -0
- package/dist/hyphenation/patterns/gl.wasm +0 -0
- package/dist/hyphenation/patterns/gu.wasm +0 -0
- package/dist/hyphenation/patterns/hi.wasm +0 -0
- package/dist/hyphenation/patterns/hr.wasm +0 -0
- package/dist/hyphenation/patterns/hsb.wasm +0 -0
- package/dist/hyphenation/patterns/ia.wasm +0 -0
- package/dist/hyphenation/patterns/is.wasm +0 -0
- package/dist/hyphenation/patterns/it.wasm +0 -0
- package/dist/hyphenation/patterns/ka.wasm +0 -0
- package/dist/hyphenation/patterns/kmr.wasm +0 -0
- package/dist/hyphenation/patterns/kn.wasm +0 -0
- package/dist/hyphenation/patterns/la.wasm +0 -0
- package/dist/hyphenation/patterns/lt.wasm +0 -0
- package/dist/hyphenation/patterns/ml.wasm +0 -0
- package/dist/hyphenation/patterns/mn-cyrl.wasm +0 -0
- package/dist/hyphenation/patterns/mr.wasm +0 -0
- package/dist/hyphenation/patterns/nb.wasm +0 -0
- package/dist/hyphenation/patterns/nl.wasm +0 -0
- package/dist/hyphenation/patterns/nn.wasm +0 -0
- package/dist/hyphenation/patterns/no.wasm +0 -0
- package/dist/hyphenation/patterns/oc.wasm +0 -0
- package/dist/hyphenation/patterns/or.wasm +0 -0
- package/dist/hyphenation/patterns/pa.wasm +0 -0
- package/dist/hyphenation/patterns/pi.wasm +0 -0
- package/dist/hyphenation/patterns/pl.wasm +0 -0
- package/dist/hyphenation/patterns/pms.wasm +0 -0
- package/dist/hyphenation/patterns/pt.wasm +0 -0
- package/dist/hyphenation/patterns/rm.wasm +0 -0
- package/dist/hyphenation/patterns/ru.wasm +0 -0
- package/dist/hyphenation/patterns/sh-cyrl.wasm +0 -0
- package/dist/hyphenation/patterns/sh-latn.wasm +0 -0
- package/dist/hyphenation/patterns/sk.wasm +0 -0
- package/dist/hyphenation/patterns/sl.wasm +0 -0
- package/dist/hyphenation/patterns/sq.wasm +0 -0
- package/dist/hyphenation/patterns/sv.wasm +0 -0
- package/dist/hyphenation/patterns/ta.wasm +0 -0
- package/dist/hyphenation/patterns/te.wasm +0 -0
- package/dist/hyphenation/patterns/th.wasm +0 -0
- package/dist/hyphenation/patterns/tk.wasm +0 -0
- package/dist/hyphenation/patterns/tr.wasm +0 -0
- package/dist/hyphenation/patterns/uk.wasm +0 -0
- package/dist/hyphenation/patterns/zh-latn-pinyin.wasm +0 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.js +48 -0
- package/dist/index.js.map +1 -0
- package/dist/indexes/index.d.ts +10 -0
- package/dist/indexes/index.js +11 -0
- package/dist/indexes/index.js.map +1 -0
- package/dist/indexes/layout.d.ts +30 -0
- package/dist/indexes/layout.js +83 -0
- package/dist/indexes/layout.js.map +1 -0
- package/dist/indexes/locators.d.ts +33 -0
- package/dist/indexes/locators.js +51 -0
- package/dist/indexes/locators.js.map +1 -0
- package/dist/indexes/terms.d.ts +97 -0
- package/dist/indexes/terms.js +211 -0
- package/dist/indexes/terms.js.map +1 -0
- package/dist/indexes/transform.d.ts +90 -0
- package/dist/indexes/transform.js +154 -0
- package/dist/indexes/transform.js.map +1 -0
- package/dist/layout/calibrate.d.ts +12 -0
- package/dist/layout/calibrate.js +50 -0
- package/dist/layout/calibrate.js.map +1 -0
- package/dist/layout/converge.d.ts +31 -0
- package/dist/layout/converge.js +84 -0
- package/dist/layout/converge.js.map +1 -0
- package/dist/layout/counters.d.ts +16 -0
- package/dist/layout/counters.js +62 -0
- package/dist/layout/counters.js.map +1 -0
- package/dist/layout/first-letter.d.ts +34 -0
- package/dist/layout/first-letter.js +183 -0
- package/dist/layout/first-letter.js.map +1 -0
- package/dist/layout/fonts.d.ts +67 -0
- package/dist/layout/fonts.js +110 -0
- package/dist/layout/fonts.js.map +1 -0
- package/dist/layout/generated.d.ts +9 -0
- package/dist/layout/generated.js +83 -0
- package/dist/layout/generated.js.map +1 -0
- package/dist/layout/glue.d.ts +18 -0
- package/dist/layout/glue.js +48 -0
- package/dist/layout/glue.js.map +1 -0
- package/dist/layout/index.d.ts +17 -0
- package/dist/layout/index.js +18 -0
- package/dist/layout/index.js.map +1 -0
- package/dist/layout/lists.d.ts +91 -0
- package/dist/layout/lists.js +1068 -0
- package/dist/layout/lists.js.map +1 -0
- package/dist/layout/margin-boxes.d.ts +114 -0
- package/dist/layout/margin-boxes.js +429 -0
- package/dist/layout/margin-boxes.js.map +1 -0
- package/dist/layout/minipage.d.ts +85 -0
- package/dist/layout/minipage.js +83 -0
- package/dist/layout/minipage.js.map +1 -0
- package/dist/layout/page-box.d.ts +34 -0
- package/dist/layout/page-box.js +112 -0
- package/dist/layout/page-box.js.map +1 -0
- package/dist/layout/page-rules.d.ts +49 -0
- package/dist/layout/page-rules.js +205 -0
- package/dist/layout/page-rules.js.map +1 -0
- package/dist/layout/page.d.ts +51 -0
- package/dist/layout/page.js +133 -0
- package/dist/layout/page.js.map +1 -0
- package/dist/layout/pagebuilder.d.ts +243 -0
- package/dist/layout/pagebuilder.js +591 -0
- package/dist/layout/pagebuilder.js.map +1 -0
- package/dist/layout/pages.d.ts +77 -0
- package/dist/layout/pages.js +772 -0
- package/dist/layout/pages.js.map +1 -0
- package/dist/layout/paragraph.d.ts +194 -0
- package/dist/layout/paragraph.js +1148 -0
- package/dist/layout/paragraph.js.map +1 -0
- package/dist/layout/pre.d.ts +8 -0
- package/dist/layout/pre.js +151 -0
- package/dist/layout/pre.js.map +1 -0
- package/dist/layout/region.d.ts +66 -0
- package/dist/layout/region.js +200 -0
- package/dist/layout/region.js.map +1 -0
- package/dist/layout/vlist.d.ts +218 -0
- package/dist/layout/vlist.js +72 -0
- package/dist/layout/vlist.js.map +1 -0
- package/dist/linebreak/items.d.ts +69 -0
- package/dist/linebreak/items.js +44 -0
- package/dist/linebreak/items.js.map +1 -0
- package/dist/linebreak/knuth-plass.d.ts +149 -0
- package/dist/linebreak/knuth-plass.js +461 -0
- package/dist/linebreak/knuth-plass.js.map +1 -0
- package/dist/lint/config.d.ts +48 -0
- package/dist/lint/config.js +185 -0
- package/dist/lint/config.js.map +1 -0
- package/dist/lint/context.d.ts +64 -0
- package/dist/lint/context.js +37 -0
- package/dist/lint/context.js.map +1 -0
- package/dist/lint/fix.d.ts +40 -0
- package/dist/lint/fix.js +86 -0
- package/dist/lint/fix.js.map +1 -0
- package/dist/lint/index.d.ts +14 -0
- package/dist/lint/index.js +15 -0
- package/dist/lint/index.js.map +1 -0
- package/dist/lint/linter.d.ts +59 -0
- package/dist/lint/linter.js +239 -0
- package/dist/lint/linter.js.map +1 -0
- package/dist/lint/presets.d.ts +20 -0
- package/dist/lint/presets.js +65 -0
- package/dist/lint/presets.js.map +1 -0
- package/dist/lint/project.d.ts +31 -0
- package/dist/lint/project.js +100 -0
- package/dist/lint/project.js.map +1 -0
- package/dist/lint/rules/html.d.ts +30 -0
- package/dist/lint/rules/html.js +163 -0
- package/dist/lint/rules/html.js.map +1 -0
- package/dist/lint/rules/layout.d.ts +42 -0
- package/dist/lint/rules/layout.js +428 -0
- package/dist/lint/rules/layout.js.map +1 -0
- package/dist/lint/rules/source.d.ts +67 -0
- package/dist/lint/rules/source.js +339 -0
- package/dist/lint/rules/source.js.map +1 -0
- package/dist/lint/testing.d.ts +7 -0
- package/dist/lint/testing.js +77 -0
- package/dist/lint/testing.js.map +1 -0
- package/dist/math/hast.d.ts +46 -0
- package/dist/math/hast.js +297 -0
- package/dist/math/hast.js.map +1 -0
- package/dist/math/index.d.ts +9 -0
- package/dist/math/index.js +10 -0
- package/dist/math/index.js.map +1 -0
- package/dist/math/mathjax/LICENSE-mathjax +202 -0
- package/dist/math/mathjax/LICENSE-speech-rule-engine +177 -0
- package/dist/math/mathjax/sre/af.json +146 -0
- package/dist/math/mathjax/sre/base.json +140 -0
- package/dist/math/mathjax/sre/ca.json +140 -0
- package/dist/math/mathjax/sre/da.json +140 -0
- package/dist/math/mathjax/sre/de.json +146 -0
- package/dist/math/mathjax/sre/en.json +158 -0
- package/dist/math/mathjax/sre/es.json +140 -0
- package/dist/math/mathjax/sre/euro.json +32 -0
- package/dist/math/mathjax/sre/fr.json +146 -0
- package/dist/math/mathjax/sre/hi.json +146 -0
- package/dist/math/mathjax/sre/it.json +146 -0
- package/dist/math/mathjax/sre/ko.json +146 -0
- package/dist/math/mathjax/sre/nb.json +146 -0
- package/dist/math/mathjax/sre/nemeth.json +125 -0
- package/dist/math/mathjax/sre/nn.json +146 -0
- package/dist/math/mathjax/sre/sv.json +146 -0
- package/dist/math/mathjax/svg/PUA.json +1 -0
- package/dist/math/mathjax/svg/accents-b-i.json +1 -0
- package/dist/math/mathjax/svg/accents.json +1 -0
- package/dist/math/mathjax/svg/arabic.json +1 -0
- package/dist/math/mathjax/svg/arrows.json +1 -0
- package/dist/math/mathjax/svg/braille-d.json +1 -0
- package/dist/math/mathjax/svg/braille.json +1 -0
- package/dist/math/mathjax/svg/calligraphic.json +1 -0
- package/dist/math/mathjax/svg/cherokee.json +1 -0
- package/dist/math/mathjax/svg/cyrillic-ss.json +1 -0
- package/dist/math/mathjax/svg/cyrillic.json +1 -0
- package/dist/math/mathjax/svg/devanagari.json +1 -0
- package/dist/math/mathjax/svg/double-struck.json +1 -0
- package/dist/math/mathjax/svg/fraktur.json +1 -0
- package/dist/math/mathjax/svg/greek-ss.json +1 -0
- package/dist/math/mathjax/svg/greek.json +1 -0
- package/dist/math/mathjax/svg/hebrew.json +1 -0
- package/dist/math/mathjax/svg/latin-b.json +1 -0
- package/dist/math/mathjax/svg/latin-bi.json +1 -0
- package/dist/math/mathjax/svg/latin-i.json +1 -0
- package/dist/math/mathjax/svg/latin.json +1 -0
- package/dist/math/mathjax/svg/marrows.json +1 -0
- package/dist/math/mathjax/svg/math.json +1 -0
- package/dist/math/mathjax/svg/monospace-ex.json +1 -0
- package/dist/math/mathjax/svg/monospace-l.json +1 -0
- package/dist/math/mathjax/svg/monospace.json +1 -0
- package/dist/math/mathjax/svg/mshapes.json +1 -0
- package/dist/math/mathjax/svg/phonetics-ss.json +1 -0
- package/dist/math/mathjax/svg/phonetics.json +1 -0
- package/dist/math/mathjax/svg/sans-serif-b.json +1 -0
- package/dist/math/mathjax/svg/sans-serif-bi.json +1 -0
- package/dist/math/mathjax/svg/sans-serif-ex.json +1 -0
- package/dist/math/mathjax/svg/sans-serif-i.json +1 -0
- package/dist/math/mathjax/svg/sans-serif-r.json +1 -0
- package/dist/math/mathjax/svg/sans-serif.json +1 -0
- package/dist/math/mathjax/svg/script.json +1 -0
- package/dist/math/mathjax/svg/shapes.json +1 -0
- package/dist/math/mathjax/svg/symbols-b-i.json +1 -0
- package/dist/math/mathjax/svg/symbols.json +1 -0
- package/dist/math/mathjax/svg/variants.json +1 -0
- package/dist/math/mathjax.d.ts +67 -0
- package/dist/math/mathjax.js +162 -0
- package/dist/math/mathjax.js.map +1 -0
- package/dist/math/speech.d.ts +27 -0
- package/dist/math/speech.js +87 -0
- package/dist/math/speech.js.map +1 -0
- package/dist/math/typeset.d.ts +75 -0
- package/dist/math/typeset.js +108 -0
- package/dist/math/typeset.js.map +1 -0
- package/dist/measure/css.d.ts +44 -0
- package/dist/measure/css.js +158 -0
- package/dist/measure/css.js.map +1 -0
- package/dist/measure/index.d.ts +3 -0
- package/dist/measure/index.js +4 -0
- package/dist/measure/index.js.map +1 -0
- package/dist/measure/measurer.d.ts +159 -0
- package/dist/measure/measurer.js +300 -0
- package/dist/measure/measurer.js.map +1 -0
- package/dist/measure/model.d.ts +46 -0
- package/dist/measure/model.js +47 -0
- package/dist/measure/model.js.map +1 -0
- package/dist/output/assets.d.ts +10 -0
- package/dist/output/assets.js +65 -0
- package/dist/output/assets.js.map +1 -0
- package/dist/output/index.d.ts +4 -0
- package/dist/output/index.js +5 -0
- package/dist/output/index.js.map +1 -0
- package/dist/output/output.d.ts +103 -0
- package/dist/output/output.js +86 -0
- package/dist/output/output.js.map +1 -0
- package/dist/output/stylesheets.d.ts +45 -0
- package/dist/output/stylesheets.js +50 -0
- package/dist/output/stylesheets.js.map +1 -0
- package/dist/paint/backgrounds.d.ts +56 -0
- package/dist/paint/backgrounds.js +261 -0
- package/dist/paint/backgrounds.js.map +1 -0
- package/dist/paint/blend.d.ts +61 -0
- package/dist/paint/blend.js +157 -0
- package/dist/paint/blend.js.map +1 -0
- package/dist/paint/border-image.d.ts +13 -0
- package/dist/paint/border-image.js +149 -0
- package/dist/paint/border-image.js.map +1 -0
- package/dist/paint/borders.d.ts +47 -0
- package/dist/paint/borders.js +329 -0
- package/dist/paint/borders.js.map +1 -0
- package/dist/paint/canvas.d.ts +52 -0
- package/dist/paint/canvas.js +274 -0
- package/dist/paint/canvas.js.map +1 -0
- package/dist/paint/colours.d.ts +55 -0
- package/dist/paint/colours.js +380 -0
- package/dist/paint/colours.js.map +1 -0
- package/dist/paint/columns.d.ts +11 -0
- package/dist/paint/columns.js +42 -0
- package/dist/paint/columns.js.map +1 -0
- package/dist/paint/context.d.ts +47 -0
- package/dist/paint/context.js +2 -0
- package/dist/paint/context.js.map +1 -0
- package/dist/paint/decoration.d.ts +97 -0
- package/dist/paint/decoration.js +280 -0
- package/dist/paint/decoration.js.map +1 -0
- package/dist/paint/effects.d.ts +64 -0
- package/dist/paint/effects.js +342 -0
- package/dist/paint/effects.js.map +1 -0
- package/dist/paint/emphasis.d.ts +13 -0
- package/dist/paint/emphasis.js +95 -0
- package/dist/paint/emphasis.js.map +1 -0
- package/dist/paint/flatten.d.ts +33 -0
- package/dist/paint/flatten.js +968 -0
- package/dist/paint/flatten.js.map +1 -0
- package/dist/paint/geometry.d.ts +62 -0
- package/dist/paint/geometry.js +170 -0
- package/dist/paint/geometry.js.map +1 -0
- package/dist/paint/gradients.d.ts +31 -0
- package/dist/paint/gradients.js +394 -0
- package/dist/paint/gradients.js.map +1 -0
- package/dist/paint/images.d.ts +17 -0
- package/dist/paint/images.js +80 -0
- package/dist/paint/images.js.map +1 -0
- package/dist/paint/lint.d.ts +46 -0
- package/dist/paint/lint.js +105 -0
- package/dist/paint/lint.js.map +1 -0
- package/dist/paint/overprint.d.ts +13 -0
- package/dist/paint/overprint.js +12 -0
- package/dist/paint/overprint.js.map +1 -0
- package/dist/paint/painter.d.ts +92 -0
- package/dist/paint/painter.js +281 -0
- package/dist/paint/painter.js.map +1 -0
- package/dist/paint/path.d.ts +9 -0
- package/dist/paint/path.js +173 -0
- package/dist/paint/path.js.map +1 -0
- package/dist/paint/raster.d.ts +32 -0
- package/dist/paint/raster.js +180 -0
- package/dist/paint/raster.js.map +1 -0
- package/dist/paint/shadows.d.ts +28 -0
- package/dist/paint/shadows.js +104 -0
- package/dist/paint/shadows.js.map +1 -0
- package/dist/paint/sources.d.ts +13 -0
- package/dist/paint/sources.js +17 -0
- package/dist/paint/sources.js.map +1 -0
- package/dist/paint/stacking.d.ts +75 -0
- package/dist/paint/stacking.js +327 -0
- package/dist/paint/stacking.js.map +1 -0
- package/dist/paint/svg-lint.d.ts +57 -0
- package/dist/paint/svg-lint.js +119 -0
- package/dist/paint/svg-lint.js.map +1 -0
- package/dist/paint/svg.d.ts +95 -0
- package/dist/paint/svg.js +728 -0
- package/dist/paint/svg.js.map +1 -0
- package/dist/paint/tables.d.ts +18 -0
- package/dist/paint/tables.js +178 -0
- package/dist/paint/tables.js.map +1 -0
- package/dist/paint/text-shadow.d.ts +26 -0
- package/dist/paint/text-shadow.js +187 -0
- package/dist/paint/text-shadow.js.map +1 -0
- package/dist/paint/text.d.ts +144 -0
- package/dist/paint/text.js +713 -0
- package/dist/paint/text.js.map +1 -0
- package/dist/paint/values.d.ts +24 -0
- package/dist/paint/values.js +160 -0
- package/dist/paint/values.js.map +1 -0
- package/dist/paint/vertical.d.ts +19 -0
- package/dist/paint/vertical.js +236 -0
- package/dist/paint/vertical.js.map +1 -0
- package/dist/pdf/index.d.ts +6 -0
- package/dist/pdf/index.js +7 -0
- package/dist/pdf/index.js.map +1 -0
- package/dist/pdf/pdfx.d.ts +30 -0
- package/dist/pdf/pdfx.js +18 -0
- package/dist/pdf/pdfx.js.map +1 -0
- package/dist/pdf/structure/index.d.ts +53 -0
- package/dist/pdf/structure/index.js +52 -0
- package/dist/pdf/structure/index.js.map +1 -0
- package/dist/pdf/structure/labels.d.ts +16 -0
- package/dist/pdf/structure/labels.js +45 -0
- package/dist/pdf/structure/labels.js.map +1 -0
- package/dist/pdf/structure/links.d.ts +49 -0
- package/dist/pdf/structure/links.js +136 -0
- package/dist/pdf/structure/links.js.map +1 -0
- package/dist/pdf/structure/tags.d.ts +79 -0
- package/dist/pdf/structure/tags.js +314 -0
- package/dist/pdf/structure/tags.js.map +1 -0
- package/dist/pdf/types.d.ts +551 -0
- package/dist/pdf/types.js +16 -0
- package/dist/pdf/types.js.map +1 -0
- package/dist/pdf/wasm/pulpweaver4_pdf.d.ts +41 -0
- package/dist/pdf/wasm/pulpweaver4_pdf.js +286 -0
- package/dist/pdf/wasm/pulpweaver4_pdf_bg.wasm +0 -0
- package/dist/pdf/writer.d.ts +41 -0
- package/dist/pdf/writer.js +78 -0
- package/dist/pdf/writer.js.map +1 -0
- package/dist/plugin/attributes.d.ts +10 -0
- package/dist/plugin/attributes.js +63 -0
- package/dist/plugin/attributes.js.map +1 -0
- package/dist/plugin/define.d.ts +425 -0
- package/dist/plugin/define.js +311 -0
- package/dist/plugin/define.js.map +1 -0
- package/dist/plugin/failure.d.ts +80 -0
- package/dist/plugin/failure.js +97 -0
- package/dist/plugin/failure.js.map +1 -0
- package/dist/plugin/index.d.ts +11 -0
- package/dist/plugin/index.js +12 -0
- package/dist/plugin/index.js.map +1 -0
- package/dist/plugin/load.d.ts +105 -0
- package/dist/plugin/load.js +197 -0
- package/dist/plugin/load.js.map +1 -0
- package/dist/plugin/register.d.ts +166 -0
- package/dist/plugin/register.js +306 -0
- package/dist/plugin/register.js.map +1 -0
- package/dist/plugin/render.d.ts +4 -0
- package/dist/plugin/render.js +28 -0
- package/dist/plugin/render.js.map +1 -0
- package/dist/preflight/index.d.ts +3 -0
- package/dist/preflight/index.js +4 -0
- package/dist/preflight/index.js.map +1 -0
- package/dist/preflight/pdfx.d.ts +440 -0
- package/dist/preflight/pdfx.js +1781 -0
- package/dist/preflight/pdfx.js.map +1 -0
- package/dist/preflight/reader.d.ts +126 -0
- package/dist/preflight/reader.js +832 -0
- package/dist/preflight/reader.js.map +1 -0
- package/dist/preflight/xmp.d.ts +30 -0
- package/dist/preflight/xmp.js +145 -0
- package/dist/preflight/xmp.js.map +1 -0
- package/dist/print/index.d.ts +2 -0
- package/dist/print/index.js +3 -0
- package/dist/print/index.js.map +1 -0
- package/dist/print/output.d.ts +5 -0
- package/dist/print/output.js +215 -0
- package/dist/print/output.js.map +1 -0
- package/dist/problem.d.ts +142 -0
- package/dist/problem.js +234 -0
- package/dist/problem.js.map +1 -0
- package/dist/profile/index.d.ts +10 -0
- package/dist/profile/index.js +11 -0
- package/dist/profile/index.js.map +1 -0
- package/dist/profile/lint.d.ts +69 -0
- package/dist/profile/lint.js +282 -0
- package/dist/profile/lint.js.map +1 -0
- package/dist/profile/metadata.d.ts +27 -0
- package/dist/profile/metadata.js +38 -0
- package/dist/profile/metadata.js.map +1 -0
- package/dist/profile/profile.d.ts +92 -0
- package/dist/profile/profile.js +282 -0
- package/dist/profile/profile.js.map +1 -0
- package/dist/project.d.ts +56 -0
- package/dist/project.js +137 -0
- package/dist/project.js.map +1 -0
- package/dist/reproducible/clock.d.ts +46 -0
- package/dist/reproducible/clock.js +173 -0
- package/dist/reproducible/clock.js.map +1 -0
- package/dist/reproducible/date.d.ts +42 -0
- package/dist/reproducible/date.js +82 -0
- package/dist/reproducible/date.js.map +1 -0
- package/dist/reproducible/index.d.ts +8 -0
- package/dist/reproducible/index.js +9 -0
- package/dist/reproducible/index.js.map +1 -0
- package/dist/spike/spike-page.chromium.json +330 -0
- package/dist/spike/spike.d.ts +75 -0
- package/dist/spike/spike.js +106 -0
- package/dist/spike/spike.js.map +1 -0
- package/dist/style/borders.d.ts +25 -0
- package/dist/style/borders.js +177 -0
- package/dist/style/borders.js.map +1 -0
- package/dist/style/colours.d.ts +34 -0
- package/dist/style/colours.js +138 -0
- package/dist/style/colours.js.map +1 -0
- package/dist/style/compile.d.ts +79 -0
- package/dist/style/compile.js +325 -0
- package/dist/style/compile.js.map +1 -0
- package/dist/style/defaults.d.ts +20 -0
- package/dist/style/defaults.js +45 -0
- package/dist/style/defaults.js.map +1 -0
- package/dist/style/gcpm.d.ts +22 -0
- package/dist/style/gcpm.js +86 -0
- package/dist/style/gcpm.js.map +1 -0
- package/dist/style/index.d.ts +4 -0
- package/dist/style/index.js +5 -0
- package/dist/style/index.js.map +1 -0
- package/dist/style/media.d.ts +22 -0
- package/dist/style/media.js +342 -0
- package/dist/style/media.js.map +1 -0
- package/dist/style/properties.d.ts +44 -0
- package/dist/style/properties.js +497 -0
- package/dist/style/properties.js.map +1 -0
- package/dist/style/scope.d.ts +6 -0
- package/dist/style/scope.js +134 -0
- package/dist/style/scope.js.map +1 -0
- package/dist/style/values.d.ts +45 -0
- package/dist/style/values.js +106 -0
- package/dist/style/values.js.map +1 -0
- package/dist/test/book.d.ts +180 -0
- package/dist/test/book.js +314 -0
- package/dist/test/book.js.map +1 -0
- package/dist/test/build.d.ts +58 -0
- package/dist/test/build.js +222 -0
- package/dist/test/build.js.map +1 -0
- package/dist/test/environment.d.ts +63 -0
- package/dist/test/environment.js +46 -0
- package/dist/test/environment.js.map +1 -0
- package/dist/test/index.d.ts +17 -0
- package/dist/test/index.js +18 -0
- package/dist/test/index.js.map +1 -0
- package/dist/test/indexes.d.ts +4 -0
- package/dist/test/indexes.js +48 -0
- package/dist/test/indexes.js.map +1 -0
- package/dist/test/layout.d.ts +8 -0
- package/dist/test/layout.js +121 -0
- package/dist/test/layout.js.map +1 -0
- package/dist/test/matchers.d.ts +80 -0
- package/dist/test/matchers.js +177 -0
- package/dist/test/matchers.js.map +1 -0
- package/dist/test/pipeline.d.ts +231 -0
- package/dist/test/pipeline.js +75 -0
- package/dist/test/pipeline.js.map +1 -0
- package/dist/test/plugins.d.ts +13 -0
- package/dist/test/plugins.js +22 -0
- package/dist/test/plugins.js.map +1 -0
- package/dist/test/render.d.ts +46 -0
- package/dist/test/render.js +149 -0
- package/dist/test/render.js.map +1 -0
- package/dist/test/runner.d.ts +61 -0
- package/dist/test/runner.js +256 -0
- package/dist/test/runner.js.map +1 -0
- package/dist/test/select.d.ts +54 -0
- package/dist/test/select.js +193 -0
- package/dist/test/select.js.map +1 -0
- package/dist/test/snapshot.d.ts +52 -0
- package/dist/test/snapshot.js +175 -0
- package/dist/test/snapshot.js.map +1 -0
- package/dist/test/text.d.ts +7 -0
- package/dist/test/text.js +46 -0
- package/dist/test/text.js.map +1 -0
- package/dist/test/vitest.d.ts +3 -0
- package/dist/test/vitest.js +39 -0
- package/dist/test/vitest.js.map +1 -0
- package/dist/text/index.d.ts +5 -0
- package/dist/text/index.js +6 -0
- package/dist/text/index.js.map +1 -0
- package/dist/text/output.d.ts +5 -0
- package/dist/text/output.js +39 -0
- package/dist/text/output.js.map +1 -0
- package/dist/text/render.d.ts +82 -0
- package/dist/text/render.js +583 -0
- package/dist/text/render.js.map +1 -0
- package/dist/text/width.d.ts +16 -0
- package/dist/text/width.js +90 -0
- package/dist/text/width.js.map +1 -0
- package/dist/text/wrap.d.ts +19 -0
- package/dist/text/wrap.js +151 -0
- package/dist/text/wrap.js.map +1 -0
- package/dist/transform/core.d.ts +19 -0
- package/dist/transform/core.js +22 -0
- package/dist/transform/core.js.map +1 -0
- package/dist/transform/index.d.ts +10 -0
- package/dist/transform/index.js +11 -0
- package/dist/transform/index.js.map +1 -0
- package/dist/transform/numbering.d.ts +47 -0
- package/dist/transform/numbering.js +142 -0
- package/dist/transform/numbering.js.map +1 -0
- package/dist/transform/references.d.ts +38 -0
- package/dist/transform/references.js +182 -0
- package/dist/transform/references.js.map +1 -0
- package/dist/transform/run.d.ts +32 -0
- package/dist/transform/run.js +210 -0
- package/dist/transform/run.js.map +1 -0
- package/dist/transform/store.d.ts +111 -0
- package/dist/transform/store.js +331 -0
- package/dist/transform/store.js.map +1 -0
- package/dist/transform/testing.d.ts +31 -0
- package/dist/transform/testing.js +76 -0
- package/dist/transform/testing.js.map +1 -0
- package/dist/transform/transform.d.ts +104 -0
- package/dist/transform/transform.js +89 -0
- package/dist/transform/transform.js.map +1 -0
- package/dist/vfs/fsa.d.ts +14 -0
- package/dist/vfs/fsa.js +123 -0
- package/dist/vfs/fsa.js.map +1 -0
- package/dist/vfs/index.d.ts +7 -0
- package/dist/vfs/index.js +8 -0
- package/dist/vfs/index.js.map +1 -0
- package/dist/vfs/memory.d.ts +15 -0
- package/dist/vfs/memory.js +101 -0
- package/dist/vfs/memory.js.map +1 -0
- package/dist/vfs/path.d.ts +30 -0
- package/dist/vfs/path.js +67 -0
- package/dist/vfs/path.js.map +1 -0
- package/dist/vfs/vfs.d.ts +66 -0
- package/dist/vfs/vfs.js +68 -0
- package/dist/vfs/vfs.js.map +1 -0
- package/dist/vfs/zip.d.ts +27 -0
- package/dist/vfs/zip.js +67 -0
- package/dist/vfs/zip.js.map +1 -0
- package/dist/web/css.d.ts +15 -0
- package/dist/web/css.js +80 -0
- package/dist/web/css.js.map +1 -0
- package/dist/web/hast.d.ts +44 -0
- package/dist/web/hast.js +175 -0
- package/dist/web/hast.js.map +1 -0
- package/dist/web/index.d.ts +11 -0
- package/dist/web/index.js +12 -0
- package/dist/web/index.js.map +1 -0
- package/dist/web/justify-main.d.ts +1 -0
- package/dist/web/justify-main.js +38 -0
- package/dist/web/justify-main.js.map +1 -0
- package/dist/web/justify.d.ts +46 -0
- package/dist/web/justify.js +147 -0
- package/dist/web/justify.js.map +1 -0
- package/dist/web/output.d.ts +28 -0
- package/dist/web/output.js +251 -0
- package/dist/web/output.js.map +1 -0
- package/dist/web/runtime/LICENSE-harfbuzzjs.txt +19 -0
- package/dist/web/runtime/NOTICE-patterns.txt +429 -0
- package/dist/web/runtime/harfbuzz.wasm +0 -0
- package/dist/web/runtime/justify.js.txt +2 -0
- package/dist/web/site.d.ts +53 -0
- package/dist/web/site.js +219 -0
- package/dist/web/site.js.map +1 -0
- package/docs/README.md +16 -0
- package/docs/reference/css-properties/index.md +94 -0
- package/docs/reference/css-properties/pw-adj-demerits.md +22 -0
- package/docs/reference/css-properties/pw-border-bottom-width.md +24 -0
- package/docs/reference/css-properties/pw-border-left-width.md +24 -0
- package/docs/reference/css-properties/pw-border-right-width.md +24 -0
- package/docs/reference/css-properties/pw-border-top-width.md +24 -0
- package/docs/reference/css-properties/pw-box.md +28 -0
- package/docs/reference/css-properties/pw-broken-penalty.md +22 -0
- package/docs/reference/css-properties/pw-club-penalty.md +24 -0
- package/docs/reference/css-properties/pw-column-rule-width.md +23 -0
- package/docs/reference/css-properties/pw-content-after.md +31 -0
- package/docs/reference/css-properties/pw-content-before.md +31 -0
- package/docs/reference/css-properties/pw-double-hyphen-demerits.md +23 -0
- package/docs/reference/css-properties/pw-emergency-stretch.md +28 -0
- package/docs/reference/css-properties/pw-ex-hyphen-penalty.md +22 -0
- package/docs/reference/css-properties/pw-final-hyphen-demerits.md +22 -0
- package/docs/reference/css-properties/pw-float-skip.md +22 -0
- package/docs/reference/css-properties/pw-float.md +33 -0
- package/docs/reference/css-properties/pw-footnote-max-height.md +22 -0
- package/docs/reference/css-properties/pw-footnote-skip.md +23 -0
- package/docs/reference/css-properties/pw-hyphen-penalty.md +24 -0
- package/docs/reference/css-properties/pw-inter-line-penalty.md +24 -0
- package/docs/reference/css-properties/pw-leader-space.md +22 -0
- package/docs/reference/css-properties/pw-leader.md +29 -0
- package/docs/reference/css-properties/pw-left-hyphen-min.md +23 -0
- package/docs/reference/css-properties/pw-line-breaking.md +29 -0
- package/docs/reference/css-properties/pw-line-penalty.md +23 -0
- package/docs/reference/css-properties/pw-list-indent.md +18 -0
- package/docs/reference/css-properties/pw-looseness.md +30 -0
- package/docs/reference/css-properties/pw-max-depth.md +22 -0
- package/docs/reference/css-properties/pw-minipage-footnotes.md +23 -0
- package/docs/reference/css-properties/pw-orphans.md +24 -0
- package/docs/reference/css-properties/pw-outline-width.md +23 -0
- package/docs/reference/css-properties/pw-overprint.md +26 -0
- package/docs/reference/css-properties/pw-padding-bottom.md +22 -0
- package/docs/reference/css-properties/pw-padding-left.md +22 -0
- package/docs/reference/css-properties/pw-padding-right.md +22 -0
- package/docs/reference/css-properties/pw-padding-top.md +22 -0
- package/docs/reference/css-properties/pw-page-prefix.md +28 -0
- package/docs/reference/css-properties/pw-page.md +32 -0
- package/docs/reference/css-properties/pw-penalty-after.md +23 -0
- package/docs/reference/css-properties/pw-penalty-before.md +30 -0
- package/docs/reference/css-properties/pw-pretolerance.md +23 -0
- package/docs/reference/css-properties/pw-right-hyphen-min.md +22 -0
- package/docs/reference/css-properties/pw-running.md +23 -0
- package/docs/reference/css-properties/pw-site-background.md +21 -0
- package/docs/reference/css-properties/pw-site-link.md +17 -0
- package/docs/reference/css-properties/pw-site-measure.md +17 -0
- package/docs/reference/css-properties/pw-site-muted.md +21 -0
- package/docs/reference/css-properties/pw-site-rule.md +17 -0
- package/docs/reference/css-properties/pw-site-text.md +22 -0
- package/docs/reference/css-properties/pw-space-after.md +23 -0
- package/docs/reference/css-properties/pw-space-before.md +29 -0
- package/docs/reference/css-properties/pw-string-set.md +32 -0
- package/docs/reference/css-properties/pw-tolerance.md +33 -0
- package/docs/reference/css-properties/pw-top-skip.md +22 -0
- package/docs/reference/css-properties/pw-widow-penalty.md +32 -0
- package/docs/reference/css-properties/pw-widows.md +24 -0
- package/docs/reference/css-properties/pw-word-space.md +22 -0
- package/docs/reference/css-properties/pw-xspace.md +22 -0
- package/docs/reference/index.md +17 -0
- package/docs/reference/lint-rules/black-text.md +31 -0
- package/docs/reference/lint-rules/blank-page.md +35 -0
- package/docs/reference/lint-rules/chapter-verso.md +34 -0
- package/docs/reference/lint-rules/citation-in-heading.md +24 -0
- package/docs/reference/lint-rules/consecutive-hyphens.md +34 -0
- package/docs/reference/lint-rules/empty-link.md +32 -0
- package/docs/reference/lint-rules/figure-distance.md +34 -0
- package/docs/reference/lint-rules/fonts.md +24 -0
- package/docs/reference/lint-rules/generated-text.md +24 -0
- package/docs/reference/lint-rules/heading-levels.md +30 -0
- package/docs/reference/lint-rules/ibid-across-page.md +30 -0
- package/docs/reference/lint-rules/image-alt.md +30 -0
- package/docs/reference/lint-rules/image-resolution.md +34 -0
- package/docs/reference/lint-rules/index.md +120 -0
- package/docs/reference/lint-rules/ink-limit.md +30 -0
- package/docs/reference/lint-rules/missing-field.md +37 -0
- package/docs/reference/lint-rules/orphan.md +34 -0
- package/docs/reference/lint-rules/overfull-line.md +28 -0
- package/docs/reference/lint-rules/profile.md +24 -0
- package/docs/reference/lint-rules/raw-html.md +30 -0
- package/docs/reference/lint-rules/signature.md +34 -0
- package/docs/reference/lint-rules/straight-quotes.md +33 -0
- package/docs/reference/lint-rules/svg-use-css.md +24 -0
- package/docs/reference/lint-rules/underfull-line.md +35 -0
- package/docs/reference/lint-rules/unknown-citation.md +30 -0
- package/docs/reference/lint-rules/unknown-label.md +31 -0
- package/docs/reference/lint-rules/unpaintable.md +24 -0
- package/docs/reference/lint-rules/unplaced-index.md +31 -0
- package/docs/reference/lint-rules/unused-entry.md +38 -0
- package/docs/reference/lint-rules/widow.md +34 -0
- package/docs/reference/plugin-api/assert-no-errors.md +18 -0
- package/docs/reference/plugin-api/asset-processor.md +28 -0
- package/docs/reference/plugin-api/attribute-problem.md +26 -0
- package/docs/reference/plugin-api/attribute-type.md +18 -0
- package/docs/reference/plugin-api/capabilities.md +18 -0
- package/docs/reference/plugin-api/capability.md +22 -0
- package/docs/reference/plugin-api/check-attributes.md +18 -0
- package/docs/reference/plugin-api/claim-kind.md +20 -0
- package/docs/reference/plugin-api/combine-penalties.md +17 -0
- package/docs/reference/plugin-api/command-context.md +30 -0
- package/docs/reference/plugin-api/command-definition.md +34 -0
- package/docs/reference/plugin-api/core-claims.md +18 -0
- package/docs/reference/plugin-api/define-plugin.md +20 -0
- package/docs/reference/plugin-api/define-rule.md +19 -0
- package/docs/reference/plugin-api/describe-error.md +14 -0
- package/docs/reference/plugin-api/describe-node.md +14 -0
- package/docs/reference/plugin-api/empty-registry.md +18 -0
- package/docs/reference/plugin-api/failed-on.md +32 -0
- package/docs/reference/plugin-api/fails-as.md +18 -0
- package/docs/reference/plugin-api/import-plugins.md +20 -0
- package/docs/reference/plugin-api/import-text.md +14 -0
- package/docs/reference/plugin-api/index.md +123 -0
- package/docs/reference/plugin-api/layout-definition.md +42 -0
- package/docs/reference/plugin-api/layout-slot.md +28 -0
- package/docs/reference/plugin-api/line-breaker.md +18 -0
- package/docs/reference/plugin-api/lint-context.md +48 -0
- package/docs/reference/plugin-api/lint-definition.md +32 -0
- package/docs/reference/plugin-api/lint-edition.md +38 -0
- package/docs/reference/plugin-api/lint-fix.md +36 -0
- package/docs/reference/plugin-api/lint-level.md +20 -0
- package/docs/reference/plugin-api/lint-preset.md +30 -0
- package/docs/reference/plugin-api/lint-rule.md +42 -0
- package/docs/reference/plugin-api/load-failure.md +32 -0
- package/docs/reference/plugin-api/load-plugins-options.md +32 -0
- package/docs/reference/plugin-api/load-plugins.md +20 -0
- package/docs/reference/plugin-api/loaded-plugin.md +32 -0
- package/docs/reference/plugin-api/node-claim.md +34 -0
- package/docs/reference/plugin-api/output-definition.md +28 -0
- package/docs/reference/plugin-api/owned.md +28 -0
- package/docs/reference/plugin-api/page-builder-hook.md +18 -0
- package/docs/reference/plugin-api/penalty-rule.md +34 -0
- package/docs/reference/plugin-api/plugin-api.md +18 -0
- package/docs/reference/plugin-api/plugin-definition.md +66 -0
- package/docs/reference/plugin-api/plugin-error.md +22 -0
- package/docs/reference/plugin-api/plugin-failure.md +30 -0
- package/docs/reference/plugin-api/plugin-importer.md +34 -0
- package/docs/reference/plugin-api/plugin-problem.md +30 -0
- package/docs/reference/plugin-api/plugin-registry.md +83 -0
- package/docs/reference/plugin-api/plugin-scope.md +15 -0
- package/docs/reference/plugin-api/plugin-stage.md +18 -0
- package/docs/reference/plugin-api/plugin-threw-problem.md +34 -0
- package/docs/reference/plugin-api/plugin-threw.md +21 -0
- package/docs/reference/plugin-api/plugin.md +69 -0
- package/docs/reference/plugin-api/project-with-plugins.md +36 -0
- package/docs/reference/plugin-api/read-context.md +30 -0
- package/docs/reference/plugin-api/read-failure.md +18 -0
- package/docs/reference/plugin-api/read-plugin-styles.md +22 -0
- package/docs/reference/plugin-api/reader.md +22 -0
- package/docs/reference/plugin-api/register-options.md +28 -0
- package/docs/reference/plugin-api/register-plugins.md +20 -0
- package/docs/reference/plugin-api/render-format.md +18 -0
- package/docs/reference/plugin-api/render-formats.md +18 -0
- package/docs/reference/plugin-api/renderer-registry.md +18 -0
- package/docs/reference/plugin-api/renderer-set.md +34 -0
- package/docs/reference/plugin-api/renderers.md +34 -0
- package/docs/reference/plugin-api/specifier-kind.md +14 -0
- package/docs/reference/plugin-api/style-source.md +18 -0
- package/docs/reference/plugin-api/text-context.md +28 -0
- package/docs/reference/plugin-api/text-edit.md +28 -0
- package/docs/reference/plugin-api/text-renderer.md +24 -0
- package/docs/reference/plugin-api/try-plugin-async.md +18 -0
- package/docs/reference/plugin-api/try-plugin.md +20 -0
- package/docs/reference/pulpweaver4-toml/editions.md +208 -0
- package/docs/reference/pulpweaver4-toml/index.md +195 -0
- package/docs/reference/pulpweaver4-toml/inks.md +50 -0
- package/docs/reference/pulpweaver4-toml/lint.md +36 -0
- package/docs/reference/test-matchers/index.md +33 -0
- package/docs/reference/test-matchers/to-be-recto.md +20 -0
- package/docs/reference/test-matchers/to-cite.md +22 -0
- package/docs/reference/test-matchers/to-fit-on-one-page.md +20 -0
- package/docs/reference/test-matchers/to-have-no-overfull-lines.md +20 -0
- package/docs/reference/test-matchers/to-match-html-snapshot.md +20 -0
- package/docs/reference/test-matchers/to-match-page-snapshot.md +20 -0
- package/docs/reference/test-matchers/to-match-text-snapshot.md +21 -0
- package/docs/reference/test-matchers/to-start-page.md +20 -0
- package/package.json +75 -4
- package/README.md +0 -3
|
@@ -0,0 +1,1445 @@
|
|
|
1
|
+
import { parseEvents } from "./block.js";
|
|
2
|
+
import { Warning } from "./options.js";
|
|
3
|
+
import { isRow, isBlock, isCaption, isInline } from "./ast.js";
|
|
4
|
+
const getStringContent = function (node) {
|
|
5
|
+
const buffer = [];
|
|
6
|
+
addStringContent(node, buffer);
|
|
7
|
+
return buffer.join("");
|
|
8
|
+
};
|
|
9
|
+
// Uses an explicit stack rather than recursion, so that deeply nested
|
|
10
|
+
// content cannot overflow the JS call stack. Siblings are stacked in
|
|
11
|
+
// reverse, so that they come back off in document order; the node being
|
|
12
|
+
// visited is held in `current` rather than on the stack, which keeps a
|
|
13
|
+
// leaf or a single chain of only children from touching it at all.
|
|
14
|
+
const addStringContent = function (node, buffer) {
|
|
15
|
+
const stack = [];
|
|
16
|
+
let top = 0;
|
|
17
|
+
let current = node;
|
|
18
|
+
for (;;) {
|
|
19
|
+
if ("tag" in current && current.tag === "footnote_reference") {
|
|
20
|
+
// excluded from heading IDs
|
|
21
|
+
}
|
|
22
|
+
else if ("text" in current) {
|
|
23
|
+
buffer.push(current.text);
|
|
24
|
+
}
|
|
25
|
+
else if ("tag" in current &&
|
|
26
|
+
(current.tag === "soft_break" || current.tag === "hard_break")) {
|
|
27
|
+
buffer.push("\n");
|
|
28
|
+
}
|
|
29
|
+
else if ("children" in current) {
|
|
30
|
+
const children = current.children;
|
|
31
|
+
let i = children.length;
|
|
32
|
+
if (i > 0) {
|
|
33
|
+
// descend into the first child directly, stacking only the rest
|
|
34
|
+
while (--i > 0) {
|
|
35
|
+
stack[top++] = children[i];
|
|
36
|
+
}
|
|
37
|
+
current = children[0];
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (top === 0) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
current = stack[--top];
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
// in verbatim text, trim one space next to ` at beginning or end:
|
|
48
|
+
const trimVerbatim = function (s) {
|
|
49
|
+
return s
|
|
50
|
+
.replace(/^ `/, "`")
|
|
51
|
+
.replace(/` $/, "`");
|
|
52
|
+
};
|
|
53
|
+
const romanDigits = {
|
|
54
|
+
i: 1,
|
|
55
|
+
v: 5,
|
|
56
|
+
x: 10,
|
|
57
|
+
l: 50,
|
|
58
|
+
c: 100,
|
|
59
|
+
d: 500,
|
|
60
|
+
m: 1000,
|
|
61
|
+
I: 1,
|
|
62
|
+
V: 5,
|
|
63
|
+
X: 10,
|
|
64
|
+
L: 50,
|
|
65
|
+
C: 100,
|
|
66
|
+
D: 500,
|
|
67
|
+
M: 1000
|
|
68
|
+
};
|
|
69
|
+
const romanToNumber = function (s) {
|
|
70
|
+
// go backwards through the digits
|
|
71
|
+
let total = 0;
|
|
72
|
+
let prevdigit = 0;
|
|
73
|
+
let i = s.length - 1;
|
|
74
|
+
while (i >= 0) {
|
|
75
|
+
const c = s.charAt(i);
|
|
76
|
+
const n = romanDigits[c];
|
|
77
|
+
if (!n) {
|
|
78
|
+
throw (new Error("Encountered bad character in roman numeral " + s));
|
|
79
|
+
}
|
|
80
|
+
if (n < prevdigit) { // e.g. ix
|
|
81
|
+
total = total - n;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
total = total + n;
|
|
85
|
+
}
|
|
86
|
+
prevdigit = n;
|
|
87
|
+
i = i - 1;
|
|
88
|
+
}
|
|
89
|
+
return total;
|
|
90
|
+
};
|
|
91
|
+
const getListStart = function (marker, style) {
|
|
92
|
+
const numtype = style.replace(/[().]/g, "");
|
|
93
|
+
const s = marker.replace(/[().]/g, "");
|
|
94
|
+
switch (numtype) {
|
|
95
|
+
case "1": return parseInt(s, 10);
|
|
96
|
+
case "A": return ((s.codePointAt(0) || 65) - 65 + 1); // 65 = "A"
|
|
97
|
+
case "a": return ((s.codePointAt(0) || 97) - 97 + 1); // 97 = "a"
|
|
98
|
+
case "I": return romanToNumber(s);
|
|
99
|
+
case "i": return romanToNumber(s);
|
|
100
|
+
}
|
|
101
|
+
return undefined;
|
|
102
|
+
};
|
|
103
|
+
// Parsing context:
|
|
104
|
+
var Context;
|
|
105
|
+
(function (Context) {
|
|
106
|
+
Context[Context["Normal"] = 0] = "Normal";
|
|
107
|
+
Context[Context["Verbatim"] = 1] = "Verbatim";
|
|
108
|
+
Context[Context["Literal"] = 2] = "Literal"; // gather str, soft_break, hard_break in accumulatedText
|
|
109
|
+
})(Context || (Context = {}));
|
|
110
|
+
// A citation's prefix or suffix, or an item's, around the inlines given,
|
|
111
|
+
// which (when there are positions) say where it is.
|
|
112
|
+
const citationPart = function (tag, children) {
|
|
113
|
+
const part = { tag: tag, children: children };
|
|
114
|
+
const first = children[0].pos;
|
|
115
|
+
const last = children[children.length - 1].pos;
|
|
116
|
+
if (first && last) {
|
|
117
|
+
part.pos = { start: first.start, end: last.end };
|
|
118
|
+
}
|
|
119
|
+
return part;
|
|
120
|
+
};
|
|
121
|
+
// The inlines of a part of a citation, without the spaces and line breaks
|
|
122
|
+
// at its start (if start) and end (if end), which belong to the brackets
|
|
123
|
+
// and separators around it.
|
|
124
|
+
const trimCitationPart = function (inlines, start, end) {
|
|
125
|
+
while (start && inlines.length > 0) {
|
|
126
|
+
const first = inlines[0];
|
|
127
|
+
if (first.tag === "soft_break") {
|
|
128
|
+
inlines.shift();
|
|
129
|
+
}
|
|
130
|
+
else if (first.tag === "str" && /^[ \t]/.test(first.text)) {
|
|
131
|
+
const text = first.text.replace(/^[ \t]+/, "");
|
|
132
|
+
const n = first.text.length - text.length;
|
|
133
|
+
if (text === "") {
|
|
134
|
+
inlines.shift();
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
first.text = text;
|
|
138
|
+
if (first.pos) {
|
|
139
|
+
const s = first.pos.start;
|
|
140
|
+
first.pos = { start: { line: s.line, col: s.col + n,
|
|
141
|
+
offset: s.offset + n },
|
|
142
|
+
end: first.pos.end };
|
|
143
|
+
}
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
while (end && inlines.length > 0) {
|
|
152
|
+
const last = inlines[inlines.length - 1];
|
|
153
|
+
if (last.tag === "soft_break") {
|
|
154
|
+
inlines.pop();
|
|
155
|
+
}
|
|
156
|
+
else if (last.tag === "str" && /[ \t]$/.test(last.text)) {
|
|
157
|
+
const text = last.text.replace(/[ \t]+$/, "");
|
|
158
|
+
const n = last.text.length - text.length;
|
|
159
|
+
if (text === "") {
|
|
160
|
+
inlines.pop();
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
last.text = text;
|
|
164
|
+
if (last.pos) {
|
|
165
|
+
const e = last.pos.end;
|
|
166
|
+
last.pos = { start: last.pos.start,
|
|
167
|
+
end: { line: e.line, col: e.col - n,
|
|
168
|
+
offset: e.offset - n } };
|
|
169
|
+
}
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return inlines;
|
|
178
|
+
};
|
|
179
|
+
const normalizeLabel = function (label) {
|
|
180
|
+
return label.trim().replace(/[ \t\r\n]+/g, " ");
|
|
181
|
+
};
|
|
182
|
+
// `events` is only ever walked front to back, so it is enough for it to
|
|
183
|
+
// be iterable; accepting any iterable lets parse hand over the block
|
|
184
|
+
// parser itself instead of first collecting every event into an array.
|
|
185
|
+
// Arrays are iterable, so existing callers are unaffected.
|
|
186
|
+
const parseFromEvents = function (events, input, options = {}) {
|
|
187
|
+
const linestarts = [-1];
|
|
188
|
+
if (options.sourcePositions) { // construct map of newline positions
|
|
189
|
+
for (let i = 0; i < input.length; i++) {
|
|
190
|
+
if (input[i] === "\n") {
|
|
191
|
+
linestarts.push(i);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
// use binary search on linestarts to find line number and col
|
|
196
|
+
const getSourceLoc = function (pos) {
|
|
197
|
+
const numlines = linestarts.length;
|
|
198
|
+
let bottom = 0;
|
|
199
|
+
let top = numlines - 1;
|
|
200
|
+
let line = 0;
|
|
201
|
+
let col = 0;
|
|
202
|
+
while (!line) {
|
|
203
|
+
const mid = bottom + ~~((top - bottom) / 2);
|
|
204
|
+
if (linestarts[mid] > pos) {
|
|
205
|
+
top = mid;
|
|
206
|
+
}
|
|
207
|
+
else if (linestarts[mid] <= pos) {
|
|
208
|
+
if (mid === top || linestarts[mid + 1] > pos) {
|
|
209
|
+
line = mid + 1;
|
|
210
|
+
col = pos - linestarts[mid];
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
if (bottom === mid && bottom < top) {
|
|
214
|
+
bottom = mid + 1;
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
bottom = mid;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return { line: line, col: col, offset: pos };
|
|
223
|
+
};
|
|
224
|
+
let context = Context.Normal;
|
|
225
|
+
let accumulatedText = "";
|
|
226
|
+
// Use null-prototype objects for maps with user-supplied keys, so
|
|
227
|
+
// that labels like "constructor" or "__proto__" don't hit inherited
|
|
228
|
+
// Object.prototype properties:
|
|
229
|
+
const references = Object.create(null);
|
|
230
|
+
const autoReferences = Object.create(null);
|
|
231
|
+
const footnotes = Object.create(null);
|
|
232
|
+
const identifiers = Object.create(null); // identifiers used
|
|
233
|
+
const blockAttributes = {}; // accumulated block attributes
|
|
234
|
+
let listDepth = 0;
|
|
235
|
+
const warn = options.warn || (() => { });
|
|
236
|
+
const addBlockAttributes = function (container) {
|
|
237
|
+
if (Object.keys(blockAttributes).length > 0) {
|
|
238
|
+
container.attributes = container.attributes || {};
|
|
239
|
+
for (const k in blockAttributes) {
|
|
240
|
+
container.attributes[k] = blockAttributes[k];
|
|
241
|
+
delete blockAttributes[k];
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
const getUniqueIdentifier = function (s) {
|
|
246
|
+
const base = s.replace(/[\]\[~!@#$%^&*(){}`,.<>\\|=+/?\s]+/g, " ")
|
|
247
|
+
.trim()
|
|
248
|
+
.replace(/ +/g, "-");
|
|
249
|
+
let i = 0;
|
|
250
|
+
let ident = base;
|
|
251
|
+
// generate unique id
|
|
252
|
+
while (!ident || identifiers[ident]) {
|
|
253
|
+
i = i + 1;
|
|
254
|
+
ident = (base || "s") + "-" + i;
|
|
255
|
+
}
|
|
256
|
+
return ident;
|
|
257
|
+
};
|
|
258
|
+
const pushContainer = function (pos) {
|
|
259
|
+
const container = {
|
|
260
|
+
children: [],
|
|
261
|
+
data: {},
|
|
262
|
+
pos: pos,
|
|
263
|
+
attributes: undefined
|
|
264
|
+
};
|
|
265
|
+
addBlockAttributes(container);
|
|
266
|
+
containers.push(container);
|
|
267
|
+
};
|
|
268
|
+
const popContainer = function (pos) {
|
|
269
|
+
const node = containers.pop();
|
|
270
|
+
if (!node) {
|
|
271
|
+
throw (new Error("Container stack is empty (popContainer)"));
|
|
272
|
+
}
|
|
273
|
+
if (pos && node.pos) {
|
|
274
|
+
node.pos = {
|
|
275
|
+
start: node.pos.start,
|
|
276
|
+
end: pos.end,
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
return node;
|
|
280
|
+
};
|
|
281
|
+
const topContainer = function () {
|
|
282
|
+
if (containers.length > 0) {
|
|
283
|
+
return containers[containers.length - 1];
|
|
284
|
+
}
|
|
285
|
+
else {
|
|
286
|
+
throw (new Error("Container stack is empty (topContainer)"));
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
// points to last child of top container, or top container if
|
|
290
|
+
// it doesn't have children
|
|
291
|
+
const getTip = function () {
|
|
292
|
+
const top = topContainer();
|
|
293
|
+
if (top.children.length > 0) {
|
|
294
|
+
return top.children[top.children.length - 1];
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
return top;
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
const addChildToTip = function (child) {
|
|
301
|
+
if (containers.length > 0) {
|
|
302
|
+
const tip = containers[containers.length - 1];
|
|
303
|
+
tip.children.push(child);
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
const tightenContainerEnd = function (node) {
|
|
307
|
+
const lastChild = node.children[node.children.length - 1];
|
|
308
|
+
if (node.pos && lastChild && lastChild.pos) {
|
|
309
|
+
node.pos.end = lastChild.pos.end;
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
const handlers = { str: (suffixes, startpos, endpos, pos) => {
|
|
313
|
+
const txt = input.substring(startpos, endpos + 1);
|
|
314
|
+
if (context === Context.Normal) {
|
|
315
|
+
addChildToTip({ tag: "str", text: txt, pos: pos });
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
accumulatedText += txt;
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
soft_break: (suffixes, startpos, endpos, pos) => {
|
|
322
|
+
if (context === Context.Normal) {
|
|
323
|
+
addChildToTip({ tag: "soft_break", pos: pos });
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
accumulatedText += "\n";
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
escape: (suffixes, startpos, endpos, pos) => {
|
|
330
|
+
if (context === Context.Verbatim) {
|
|
331
|
+
accumulatedText += "\\";
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
hard_break: (suffixes, startpos, endpos, pos) => {
|
|
335
|
+
if (context === Context.Normal) {
|
|
336
|
+
addChildToTip({ tag: "hard_break", pos: pos });
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
accumulatedText += "\n";
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
non_breaking_space: (suffixes, startpos, endpos, pos) => {
|
|
343
|
+
if (context === Context.Verbatim) {
|
|
344
|
+
accumulatedText += "\\ ";
|
|
345
|
+
}
|
|
346
|
+
else {
|
|
347
|
+
addChildToTip({ tag: "non_breaking_space", pos: pos });
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
symb: (suffixes, startpos, endpos, pos) => {
|
|
351
|
+
if (context === Context.Normal) {
|
|
352
|
+
const alias = input.substring(startpos + 1, endpos);
|
|
353
|
+
addChildToTip({ tag: "symb", alias: alias, pos: pos });
|
|
354
|
+
}
|
|
355
|
+
else {
|
|
356
|
+
const txt = input.substring(startpos, endpos + 1);
|
|
357
|
+
accumulatedText += txt;
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
footnote_reference: (suffixes, startpos, endpos, pos) => {
|
|
361
|
+
const fnref = input.substring(startpos + 2, endpos);
|
|
362
|
+
addChildToTip({ tag: "footnote_reference",
|
|
363
|
+
text: normalizeLabel(fnref), pos: pos });
|
|
364
|
+
},
|
|
365
|
+
["+reference_definition"]: (suffixes, startpos, endpos, pos) => {
|
|
366
|
+
pushContainer(pos);
|
|
367
|
+
},
|
|
368
|
+
["-reference_definition"]: (suffixes, startpos, endpos, pos) => {
|
|
369
|
+
const node = popContainer(pos);
|
|
370
|
+
const lab = normalizeLabel(node.data.key);
|
|
371
|
+
const r = {
|
|
372
|
+
tag: "reference",
|
|
373
|
+
label: lab,
|
|
374
|
+
destination: node.data.value || "",
|
|
375
|
+
attributes: node.attributes,
|
|
376
|
+
pos: node.pos,
|
|
377
|
+
};
|
|
378
|
+
if (node.data.key) {
|
|
379
|
+
references[lab] = r;
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
reference_key: (suffixes, startpos, endpos, pos) => {
|
|
383
|
+
topContainer().data.key = input.substring(startpos + 1, endpos);
|
|
384
|
+
topContainer().data.value = "";
|
|
385
|
+
},
|
|
386
|
+
reference_value: (suffixes, startpos, endpos, pos) => {
|
|
387
|
+
topContainer().data.value =
|
|
388
|
+
topContainer().data.value + input.substring(startpos, endpos + 1);
|
|
389
|
+
},
|
|
390
|
+
["+emph"]: (suffixes, startpos, endpos, pos) => {
|
|
391
|
+
pushContainer(pos);
|
|
392
|
+
},
|
|
393
|
+
["-emph"]: (suffixes, startpos, endpos, pos) => {
|
|
394
|
+
const node = popContainer(pos);
|
|
395
|
+
addChildToTip({ tag: "emph", children: node.children, pos: node.pos });
|
|
396
|
+
},
|
|
397
|
+
["+strong"]: (suffixes, startpos, endpos, pos) => {
|
|
398
|
+
pushContainer(pos);
|
|
399
|
+
},
|
|
400
|
+
["-strong"]: (suffixes, startpos, endpos, pos) => {
|
|
401
|
+
const node = popContainer(pos);
|
|
402
|
+
addChildToTip({ tag: "strong", children: node.children, pos: node.pos });
|
|
403
|
+
},
|
|
404
|
+
["+span"]: (suffixes, startpos, endpos, pos) => {
|
|
405
|
+
pushContainer(pos);
|
|
406
|
+
},
|
|
407
|
+
["-span"]: (suffixes, startpos, endpos, pos) => {
|
|
408
|
+
const node = popContainer(pos);
|
|
409
|
+
addChildToTip({ tag: "span", children: node.children, pos: node.pos });
|
|
410
|
+
},
|
|
411
|
+
["+mark"]: (suffixes, startpos, endpos, pos) => {
|
|
412
|
+
pushContainer(pos);
|
|
413
|
+
},
|
|
414
|
+
["-mark"]: (suffixes, startpos, endpos, pos) => {
|
|
415
|
+
const node = popContainer(pos);
|
|
416
|
+
addChildToTip({ tag: "mark", children: node.children, pos: node.pos });
|
|
417
|
+
},
|
|
418
|
+
["+superscript"]: (suffixes, startpos, endpos, pos) => {
|
|
419
|
+
pushContainer(pos);
|
|
420
|
+
},
|
|
421
|
+
["-superscript"]: (suffixes, startpos, endpos, pos) => {
|
|
422
|
+
const node = popContainer(pos);
|
|
423
|
+
addChildToTip({ tag: "superscript", children: node.children, pos: node.pos });
|
|
424
|
+
},
|
|
425
|
+
["+subscript"]: (suffixes, startpos, endpos, pos) => {
|
|
426
|
+
pushContainer(pos);
|
|
427
|
+
},
|
|
428
|
+
["-subscript"]: (suffixes, startpos, endpos, pos) => {
|
|
429
|
+
const node = popContainer(pos);
|
|
430
|
+
addChildToTip({ tag: "subscript", children: node.children, pos: node.pos });
|
|
431
|
+
},
|
|
432
|
+
["+delete"]: (suffixes, startpos, endpos, pos) => {
|
|
433
|
+
pushContainer(pos);
|
|
434
|
+
},
|
|
435
|
+
["-delete"]: (suffixes, startpos, endpos, pos) => {
|
|
436
|
+
const node = popContainer(pos);
|
|
437
|
+
addChildToTip({ tag: "delete", children: node.children, pos: node.pos });
|
|
438
|
+
},
|
|
439
|
+
["+insert"]: (suffixes, startpos, endpos, pos) => {
|
|
440
|
+
pushContainer(pos);
|
|
441
|
+
},
|
|
442
|
+
["-insert"]: (suffixes, startpos, endpos, pos) => {
|
|
443
|
+
const node = popContainer(pos);
|
|
444
|
+
addChildToTip({ tag: "insert", children: node.children, pos: node.pos });
|
|
445
|
+
},
|
|
446
|
+
["+double_quoted"]: (suffixes, startpos, endpos, pos) => {
|
|
447
|
+
pushContainer(pos);
|
|
448
|
+
},
|
|
449
|
+
["-double_quoted"]: (suffixes, startpos, endpos, pos) => {
|
|
450
|
+
const node = popContainer(pos);
|
|
451
|
+
addChildToTip({ tag: "double_quoted", children: node.children, pos: node.pos });
|
|
452
|
+
},
|
|
453
|
+
["+single_quoted"]: (suffixes, startpos, endpos, pos) => {
|
|
454
|
+
pushContainer(pos);
|
|
455
|
+
},
|
|
456
|
+
["-single_quoted"]: (suffixes, startpos, endpos, pos) => {
|
|
457
|
+
const node = popContainer(pos);
|
|
458
|
+
addChildToTip({ tag: "single_quoted", children: node.children, pos: node.pos });
|
|
459
|
+
},
|
|
460
|
+
// A citation's parts are gathered as they come, in data.parts, each
|
|
461
|
+
// the inlines between two separators and the key among them, if any;
|
|
462
|
+
// the citation is made from them at its end.
|
|
463
|
+
["+citation"]: (suffixes, startpos, endpos, pos) => {
|
|
464
|
+
pushContainer(pos);
|
|
465
|
+
topContainer().data.parts = [];
|
|
466
|
+
},
|
|
467
|
+
citation_key: (suffixes, startpos, endpos, pos) => {
|
|
468
|
+
const mark = input.codePointAt(startpos);
|
|
469
|
+
const marked = mark !== 64; // @
|
|
470
|
+
topContainer().data.key = {
|
|
471
|
+
id: input.substring(marked ? startpos + 2 : startpos + 1, endpos + 1),
|
|
472
|
+
suppress_author: mark === 45, // -
|
|
473
|
+
author_only: mark === 61, // =
|
|
474
|
+
no_cite: mark === 126, // ~
|
|
475
|
+
index: topContainer().children.length,
|
|
476
|
+
pos: pos
|
|
477
|
+
};
|
|
478
|
+
},
|
|
479
|
+
citation_separator: (suffixes, startpos, endpos, pos) => {
|
|
480
|
+
const top = topContainer();
|
|
481
|
+
top.data.parts.push({ children: top.children, key: top.data.key });
|
|
482
|
+
top.children = [];
|
|
483
|
+
top.data.key = undefined;
|
|
484
|
+
},
|
|
485
|
+
["-citation"]: (suffixes, startpos, endpos, pos) => {
|
|
486
|
+
const node = popContainer(pos);
|
|
487
|
+
const parts = node.data.parts;
|
|
488
|
+
parts.push({ children: node.children, key: node.data.key });
|
|
489
|
+
const children = [];
|
|
490
|
+
for (let i = 0; i < parts.length; i++) {
|
|
491
|
+
const part = parts[i];
|
|
492
|
+
const key = part.key;
|
|
493
|
+
if (key) {
|
|
494
|
+
const prefix = trimCitationPart(part.children.slice(0, key.index), true, false);
|
|
495
|
+
const suffix = trimCitationPart(part.children.slice(key.index), false, true);
|
|
496
|
+
const item = {
|
|
497
|
+
tag: "citation_item",
|
|
498
|
+
id: key.id,
|
|
499
|
+
children: [],
|
|
500
|
+
};
|
|
501
|
+
if (key.suppress_author) {
|
|
502
|
+
item.suppress_author = true;
|
|
503
|
+
}
|
|
504
|
+
if (key.author_only) {
|
|
505
|
+
item.author_only = true;
|
|
506
|
+
}
|
|
507
|
+
if (key.no_cite) {
|
|
508
|
+
item.no_cite = true;
|
|
509
|
+
}
|
|
510
|
+
let start = key.pos && key.pos.start;
|
|
511
|
+
let end = key.pos && key.pos.end;
|
|
512
|
+
if (prefix.length > 0) {
|
|
513
|
+
const part = citationPart("citation_prefix", prefix);
|
|
514
|
+
item.children.push(part);
|
|
515
|
+
start = part.pos && part.pos.start;
|
|
516
|
+
}
|
|
517
|
+
if (suffix.length > 0) {
|
|
518
|
+
const part = citationPart("citation_suffix", suffix);
|
|
519
|
+
item.children.push(part);
|
|
520
|
+
end = part.pos && part.pos.end;
|
|
521
|
+
}
|
|
522
|
+
if (start && end) {
|
|
523
|
+
item.pos = { start: start, end: end };
|
|
524
|
+
}
|
|
525
|
+
children.push(item);
|
|
526
|
+
}
|
|
527
|
+
else {
|
|
528
|
+
const inlines = trimCitationPart(part.children, true, true);
|
|
529
|
+
if (inlines.length > 0) {
|
|
530
|
+
children.push(citationPart(i === 0 ? "citation_prefix"
|
|
531
|
+
: "citation_suffix", inlines));
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
const citation = { tag: "citation", children: children,
|
|
536
|
+
pos: node.pos };
|
|
537
|
+
addChildToTip(citation);
|
|
538
|
+
},
|
|
539
|
+
["+attributes"]: (suffixes, startpos, endpos, pos) => {
|
|
540
|
+
pushContainer(pos);
|
|
541
|
+
},
|
|
542
|
+
["-attributes"]: (suffixes, startpos, endpos, pos) => {
|
|
543
|
+
const node = popContainer(pos);
|
|
544
|
+
if (node.attributes && containers.length > 0) {
|
|
545
|
+
if (node.attributes.id) {
|
|
546
|
+
identifiers[node.attributes.id] = true;
|
|
547
|
+
}
|
|
548
|
+
const warnUnattached = () => warn(new Warning("Ignoring unattached attribute", options.sourcePositions ?
|
|
549
|
+
getSourceLoc(startpos) : startpos));
|
|
550
|
+
let tip = getTip();
|
|
551
|
+
if (tip === topContainer()) {
|
|
552
|
+
// no inline children to add the attribute to...
|
|
553
|
+
warnUnattached();
|
|
554
|
+
return;
|
|
555
|
+
}
|
|
556
|
+
let endsWithSpace = false;
|
|
557
|
+
if ("tag" in tip && tip.tag === "str") { // bare word
|
|
558
|
+
// split off last consecutive word of string
|
|
559
|
+
// and attach attributes to it
|
|
560
|
+
const m = tip.text.match(/[^\s]+$/);
|
|
561
|
+
if (m && m.index && m.index > 0) {
|
|
562
|
+
let wordpos;
|
|
563
|
+
if (tip.pos) {
|
|
564
|
+
const origend = tip.pos.end;
|
|
565
|
+
tip.pos.end = {
|
|
566
|
+
line: origend.line,
|
|
567
|
+
col: origend.col - m[0].length,
|
|
568
|
+
offset: origend.offset - m[0].length
|
|
569
|
+
};
|
|
570
|
+
wordpos = {
|
|
571
|
+
start: {
|
|
572
|
+
line: origend.line,
|
|
573
|
+
col: origend.col - m[0].length + 1,
|
|
574
|
+
offset: origend.offset - m[0].length + 1
|
|
575
|
+
},
|
|
576
|
+
end: origend
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
tip.text = tip.text.substring(0, m.index);
|
|
580
|
+
addChildToTip({ tag: "str", text: m[0], pos: wordpos });
|
|
581
|
+
}
|
|
582
|
+
else if (!m) {
|
|
583
|
+
endsWithSpace = true;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
tip = getTip(); // get new tip, which may be the new element
|
|
587
|
+
if (endsWithSpace) {
|
|
588
|
+
warnUnattached();
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
if (!tip.attributes) {
|
|
592
|
+
tip.attributes = {};
|
|
593
|
+
}
|
|
594
|
+
for (const k in node.attributes) {
|
|
595
|
+
if (k === "class") {
|
|
596
|
+
if (tip.attributes[k]) {
|
|
597
|
+
tip.attributes[k] = tip.attributes[k] +
|
|
598
|
+
" " + node.attributes[k];
|
|
599
|
+
}
|
|
600
|
+
else {
|
|
601
|
+
tip.attributes[k] = node.attributes[k];
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
else {
|
|
605
|
+
tip.attributes[k] = node.attributes[k];
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
},
|
|
610
|
+
["+block_attributes"]: (suffixes, startpos, endpos, pos) => {
|
|
611
|
+
pushContainer(pos);
|
|
612
|
+
},
|
|
613
|
+
["-block_attributes"]: (suffixes, startpos, endpos, pos) => {
|
|
614
|
+
const node = popContainer(pos);
|
|
615
|
+
if (node.attributes && containers.length > 0) {
|
|
616
|
+
if (node.attributes.id) {
|
|
617
|
+
identifiers[node.attributes.id] = true;
|
|
618
|
+
}
|
|
619
|
+
for (const k in node.attributes) {
|
|
620
|
+
if (k === "class") {
|
|
621
|
+
if (blockAttributes[k]) {
|
|
622
|
+
blockAttributes[k] = blockAttributes[k] +
|
|
623
|
+
" " + node.attributes[k];
|
|
624
|
+
}
|
|
625
|
+
else {
|
|
626
|
+
blockAttributes[k] = node.attributes[k];
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
else {
|
|
630
|
+
blockAttributes[k] = node.attributes[k];
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
},
|
|
635
|
+
class: (suffixes, startpos, endpos, pos) => {
|
|
636
|
+
const top = topContainer();
|
|
637
|
+
const cl = input.substring(startpos, endpos + 1);
|
|
638
|
+
if (!top.attributes) {
|
|
639
|
+
top.attributes = {};
|
|
640
|
+
}
|
|
641
|
+
if (top.attributes.class) {
|
|
642
|
+
top.attributes.class = top.attributes.class + " " + cl;
|
|
643
|
+
}
|
|
644
|
+
else {
|
|
645
|
+
top.attributes.class = cl;
|
|
646
|
+
}
|
|
647
|
+
},
|
|
648
|
+
id: (suffixes, startpos, endpos, pos) => {
|
|
649
|
+
const top = topContainer();
|
|
650
|
+
const id = input.substring(startpos, endpos + 1);
|
|
651
|
+
if (!top.attributes) {
|
|
652
|
+
top.attributes = { id: id };
|
|
653
|
+
}
|
|
654
|
+
else {
|
|
655
|
+
top.attributes.id = id;
|
|
656
|
+
}
|
|
657
|
+
},
|
|
658
|
+
key: (suffixes, startpos, endpos, pos) => {
|
|
659
|
+
const top = topContainer();
|
|
660
|
+
const key = input.substring(startpos, endpos + 1);
|
|
661
|
+
top.data.key = key;
|
|
662
|
+
if (!top.attributes) {
|
|
663
|
+
top.attributes = {};
|
|
664
|
+
}
|
|
665
|
+
top.attributes[top.data.key] = "";
|
|
666
|
+
},
|
|
667
|
+
value: (suffixes, startpos, endpos, pos) => {
|
|
668
|
+
const top = topContainer();
|
|
669
|
+
const val = input.substring(startpos, endpos + 1)
|
|
670
|
+
.replace(/[ \r\n]+/g, " ") // collapse interior whitespace
|
|
671
|
+
.replace(/\\([.,\\/#!$%^&*;:{}=\-_`~+[\]()'"?|])/g, "$1");
|
|
672
|
+
// resolve backslash escapes
|
|
673
|
+
if (!top.attributes) {
|
|
674
|
+
top.attributes = {};
|
|
675
|
+
}
|
|
676
|
+
if (top.data.key) {
|
|
677
|
+
top.attributes[top.data.key] = // append multiple values to key
|
|
678
|
+
top.attributes[top.data.key] + val;
|
|
679
|
+
}
|
|
680
|
+
else {
|
|
681
|
+
throw (new Error("Encountered value without key"));
|
|
682
|
+
}
|
|
683
|
+
},
|
|
684
|
+
["+linktext"]: (suffixes, startpos, endpos, pos) => {
|
|
685
|
+
pushContainer(pos);
|
|
686
|
+
topContainer().data.isimage = false;
|
|
687
|
+
},
|
|
688
|
+
["-linktext"]: (suffixes, startpos, endpos, pos) => {
|
|
689
|
+
// we don't pop yet, but wait for -destination
|
|
690
|
+
},
|
|
691
|
+
["+imagetext"]: (suffixes, startpos, endpos, pos) => {
|
|
692
|
+
pushContainer(pos);
|
|
693
|
+
topContainer().data.isimage = true;
|
|
694
|
+
},
|
|
695
|
+
["-imagetext"]: (suffixes, startpos, endpos, pos) => {
|
|
696
|
+
// we don't pop yet, but wait for -destination
|
|
697
|
+
},
|
|
698
|
+
["+destination"]: (suffixes, startpos, endpos, pos) => {
|
|
699
|
+
context = Context.Literal;
|
|
700
|
+
},
|
|
701
|
+
["-destination"]: (suffixes, startpos, endpos, pos) => {
|
|
702
|
+
const node = popContainer(pos); // the container added by +linktext/+imagetext
|
|
703
|
+
addChildToTip({
|
|
704
|
+
tag: node.data.isimage ? "image" : "link",
|
|
705
|
+
destination: accumulatedText.replace(/[\r\n]/g, ""),
|
|
706
|
+
children: node.children,
|
|
707
|
+
pos: node.pos
|
|
708
|
+
});
|
|
709
|
+
context = Context.Normal;
|
|
710
|
+
accumulatedText = "";
|
|
711
|
+
},
|
|
712
|
+
["+reference"]: (suffixes, startpos, endpos, pos) => {
|
|
713
|
+
context = Context.Literal;
|
|
714
|
+
},
|
|
715
|
+
["-reference"]: (suffixes, startpos, endpos, pos) => {
|
|
716
|
+
const node = popContainer(pos); // the container added by +linktext
|
|
717
|
+
let ref = accumulatedText;
|
|
718
|
+
if (ref.length === 0) {
|
|
719
|
+
ref = getStringContent(node);
|
|
720
|
+
}
|
|
721
|
+
addChildToTip({
|
|
722
|
+
tag: node.data.isimage ? "image" : "link",
|
|
723
|
+
reference: normalizeLabel(ref),
|
|
724
|
+
children: node.children,
|
|
725
|
+
pos: node.pos
|
|
726
|
+
});
|
|
727
|
+
context = Context.Normal;
|
|
728
|
+
accumulatedText = "";
|
|
729
|
+
},
|
|
730
|
+
["+verbatim"]: (suffixes, startpos, endpos, pos) => {
|
|
731
|
+
context = Context.Verbatim;
|
|
732
|
+
pushContainer(pos);
|
|
733
|
+
},
|
|
734
|
+
["-verbatim"]: (suffixes, startpos, endpos, pos) => {
|
|
735
|
+
const node = popContainer(pos);
|
|
736
|
+
addChildToTip({
|
|
737
|
+
tag: "verbatim",
|
|
738
|
+
text: trimVerbatim(accumulatedText),
|
|
739
|
+
pos: node.pos
|
|
740
|
+
});
|
|
741
|
+
context = Context.Normal;
|
|
742
|
+
accumulatedText = "";
|
|
743
|
+
},
|
|
744
|
+
raw_format: (suffixes, startpos, endpos, pos) => {
|
|
745
|
+
const format = input.substring(startpos, endpos + 1)
|
|
746
|
+
.replace(/^\{?=/, "")
|
|
747
|
+
.replace(/\}$/, "");
|
|
748
|
+
const top = topContainer();
|
|
749
|
+
if (context === Context.Verbatim) { // in a code block
|
|
750
|
+
top.data.format = format;
|
|
751
|
+
}
|
|
752
|
+
else {
|
|
753
|
+
const tip = top.children[top.children.length - 1];
|
|
754
|
+
if (tip && "tag" in tip && tip.tag === "verbatim") {
|
|
755
|
+
tip.tag = "raw_inline";
|
|
756
|
+
tip.format = format;
|
|
757
|
+
}
|
|
758
|
+
else {
|
|
759
|
+
throw (new Error("raw_format is not after verbatim or code_block."));
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
},
|
|
763
|
+
["+display_math"]: (suffixes, startpos, endpos, pos) => {
|
|
764
|
+
context = Context.Verbatim;
|
|
765
|
+
pushContainer(pos);
|
|
766
|
+
},
|
|
767
|
+
["+inline_math"]: (suffixes, startpos, endpos, pos) => {
|
|
768
|
+
context = Context.Verbatim;
|
|
769
|
+
pushContainer(pos);
|
|
770
|
+
},
|
|
771
|
+
["-display_math"]: (suffixes, startpos, endpos, pos) => {
|
|
772
|
+
const node = popContainer(pos);
|
|
773
|
+
addChildToTip({
|
|
774
|
+
tag: "display_math",
|
|
775
|
+
text: trimVerbatim(accumulatedText),
|
|
776
|
+
pos: node.pos
|
|
777
|
+
});
|
|
778
|
+
context = Context.Normal;
|
|
779
|
+
accumulatedText = "";
|
|
780
|
+
},
|
|
781
|
+
["-inline_math"]: (suffixes, startpos, endpos, pos) => {
|
|
782
|
+
const node = popContainer(pos);
|
|
783
|
+
addChildToTip({
|
|
784
|
+
tag: "inline_math",
|
|
785
|
+
text: trimVerbatim(accumulatedText),
|
|
786
|
+
pos: node.pos
|
|
787
|
+
});
|
|
788
|
+
context = Context.Normal;
|
|
789
|
+
accumulatedText = "";
|
|
790
|
+
},
|
|
791
|
+
["+url"]: (suffixes, startpos, endpos, pos) => {
|
|
792
|
+
context = Context.Literal;
|
|
793
|
+
pushContainer(pos);
|
|
794
|
+
},
|
|
795
|
+
["-url"]: (suffixes, startpos, endpos, pos) => {
|
|
796
|
+
const node = popContainer(pos);
|
|
797
|
+
addChildToTip({ tag: "url",
|
|
798
|
+
text: accumulatedText.replace(/[\r\n]/g, ""),
|
|
799
|
+
pos: node.pos });
|
|
800
|
+
context = Context.Normal;
|
|
801
|
+
accumulatedText = "";
|
|
802
|
+
},
|
|
803
|
+
["+email"]: (suffixes, startpos, endpos, pos) => {
|
|
804
|
+
context = Context.Literal;
|
|
805
|
+
pushContainer(pos);
|
|
806
|
+
},
|
|
807
|
+
["-email"]: (suffixes, startpos, endpos, pos) => {
|
|
808
|
+
const node = popContainer(pos);
|
|
809
|
+
addChildToTip({ tag: "email",
|
|
810
|
+
text: accumulatedText.replace(/[\r\n]/g, ""),
|
|
811
|
+
pos: node.pos });
|
|
812
|
+
context = Context.Normal;
|
|
813
|
+
accumulatedText = "";
|
|
814
|
+
},
|
|
815
|
+
["+para"]: (suffixes, startpos, endpos, pos) => {
|
|
816
|
+
pushContainer(pos);
|
|
817
|
+
},
|
|
818
|
+
["-para"]: (suffixes, startpos, endpos, pos) => {
|
|
819
|
+
const node = popContainer(pos);
|
|
820
|
+
addChildToTip({
|
|
821
|
+
tag: "para",
|
|
822
|
+
children: node.children,
|
|
823
|
+
attributes: node.attributes,
|
|
824
|
+
pos: node.pos
|
|
825
|
+
});
|
|
826
|
+
},
|
|
827
|
+
["+heading"]: (suffixes, startpos, endpos, pos) => {
|
|
828
|
+
pushContainer(pos);
|
|
829
|
+
topContainer().data.level = 1 + endpos - startpos;
|
|
830
|
+
},
|
|
831
|
+
["-heading"]: (suffixes, startpos, endpos, pos) => {
|
|
832
|
+
const node = popContainer(pos);
|
|
833
|
+
const headingStr = getStringContent(node).trim();
|
|
834
|
+
if (!node.attributes || !node.attributes.id) {
|
|
835
|
+
if (!node.autoAttributes) {
|
|
836
|
+
node.autoAttributes = {};
|
|
837
|
+
}
|
|
838
|
+
node.autoAttributes.id = getUniqueIdentifier(headingStr);
|
|
839
|
+
identifiers[node.autoAttributes.id] = true;
|
|
840
|
+
}
|
|
841
|
+
// add implicit heading reference
|
|
842
|
+
const lab = normalizeLabel(headingStr);
|
|
843
|
+
if (!references[lab] && !autoReferences[lab]) {
|
|
844
|
+
autoReferences[lab] = {
|
|
845
|
+
tag: "reference",
|
|
846
|
+
label: lab,
|
|
847
|
+
destination: "#" + (node.attributes?.id || node.autoAttributes?.id)
|
|
848
|
+
};
|
|
849
|
+
}
|
|
850
|
+
// add section structure
|
|
851
|
+
let pnode = topContainer();
|
|
852
|
+
if (pnode.data.headinglevel !== undefined) { // doc or section
|
|
853
|
+
while (pnode && pnode.data.headinglevel !== undefined &&
|
|
854
|
+
pnode.data.headinglevel >= node.data.level) {
|
|
855
|
+
// close sections til we get to the right level
|
|
856
|
+
pnode = popContainer(pos);
|
|
857
|
+
addChildToTip({
|
|
858
|
+
tag: "section",
|
|
859
|
+
children: pnode.children,
|
|
860
|
+
attributes: pnode.attributes,
|
|
861
|
+
autoAttributes: pnode.autoAttributes,
|
|
862
|
+
pos: pnode.pos
|
|
863
|
+
});
|
|
864
|
+
pnode = topContainer();
|
|
865
|
+
}
|
|
866
|
+
// now we know that pnode.data.headinglevel is either
|
|
867
|
+
// undefined or < node.data.level
|
|
868
|
+
pushContainer(node.pos);
|
|
869
|
+
topContainer().data.headinglevel = node.data.level;
|
|
870
|
+
// move id attribute from heading to section
|
|
871
|
+
if (node.autoAttributes && node.autoAttributes.id) {
|
|
872
|
+
topContainer().autoAttributes = node.autoAttributes;
|
|
873
|
+
delete node.autoAttributes;
|
|
874
|
+
}
|
|
875
|
+
if (node.attributes && node.attributes.id) {
|
|
876
|
+
topContainer().attributes = node.attributes;
|
|
877
|
+
delete node.attributes;
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
addChildToTip({
|
|
881
|
+
tag: "heading",
|
|
882
|
+
level: node.data.level,
|
|
883
|
+
children: node.children,
|
|
884
|
+
attributes: node.attributes,
|
|
885
|
+
autoAttributes: node.autoAttributes,
|
|
886
|
+
pos: node.pos
|
|
887
|
+
});
|
|
888
|
+
},
|
|
889
|
+
["+list"]: (suffixes, startpos, endpos, pos) => {
|
|
890
|
+
pushContainer(pos);
|
|
891
|
+
topContainer().data.styles = suffixes;
|
|
892
|
+
topContainer().data.blanklines = false;
|
|
893
|
+
topContainer().data.tight = true;
|
|
894
|
+
listDepth++;
|
|
895
|
+
},
|
|
896
|
+
["-list"]: (suffixes, startpos, endpos, pos) => {
|
|
897
|
+
const node = popContainer(pos);
|
|
898
|
+
// take first if ambiguous
|
|
899
|
+
const listStyle = node.data.styles[0];
|
|
900
|
+
if (!listStyle) {
|
|
901
|
+
throw (new Error("No style defined for list"));
|
|
902
|
+
}
|
|
903
|
+
tightenContainerEnd(node);
|
|
904
|
+
const listStart = getListStart(node.data.firstMarker, listStyle);
|
|
905
|
+
if (listStyle === ":") {
|
|
906
|
+
addChildToTip({
|
|
907
|
+
tag: "definition_list",
|
|
908
|
+
children: node.children,
|
|
909
|
+
attributes: node.attributes,
|
|
910
|
+
autoAttributes: node.autoAttributes,
|
|
911
|
+
pos: node.pos
|
|
912
|
+
});
|
|
913
|
+
}
|
|
914
|
+
else if (listStyle.endsWith("X")) {
|
|
915
|
+
addChildToTip({
|
|
916
|
+
tag: "task_list",
|
|
917
|
+
tight: node.data.tight,
|
|
918
|
+
children: node.children,
|
|
919
|
+
attributes: node.attributes,
|
|
920
|
+
autoAttributes: node.autoAttributes,
|
|
921
|
+
pos: node.pos
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
else if (listStyle === "+" || listStyle === "*" ||
|
|
925
|
+
listStyle === "-") {
|
|
926
|
+
addChildToTip({
|
|
927
|
+
tag: "bullet_list",
|
|
928
|
+
tight: node.data.tight,
|
|
929
|
+
style: listStyle,
|
|
930
|
+
children: node.children,
|
|
931
|
+
attributes: node.attributes,
|
|
932
|
+
autoAttributes: node.autoAttributes,
|
|
933
|
+
pos: node.pos
|
|
934
|
+
});
|
|
935
|
+
}
|
|
936
|
+
else {
|
|
937
|
+
addChildToTip({
|
|
938
|
+
tag: "ordered_list",
|
|
939
|
+
style: listStyle,
|
|
940
|
+
children: node.children,
|
|
941
|
+
start: listStart,
|
|
942
|
+
tight: node.data.tight,
|
|
943
|
+
attributes: node.attributes,
|
|
944
|
+
autoAttributes: node.autoAttributes,
|
|
945
|
+
pos: node.pos
|
|
946
|
+
});
|
|
947
|
+
}
|
|
948
|
+
listDepth--;
|
|
949
|
+
},
|
|
950
|
+
["+list_item"]: (suffixes, startpos, endpos, pos) => {
|
|
951
|
+
// narrow styles
|
|
952
|
+
if (suffixes.length < topContainer().data.styles.length) {
|
|
953
|
+
topContainer().data.styles = suffixes;
|
|
954
|
+
}
|
|
955
|
+
if (!topContainer().data.firstMarker) {
|
|
956
|
+
topContainer().data.firstMarker =
|
|
957
|
+
input.substring(startpos, endpos + 1);
|
|
958
|
+
}
|
|
959
|
+
pushContainer(pos);
|
|
960
|
+
if (suffixes.length === 1 && suffixes[0] === ":") {
|
|
961
|
+
topContainer().data.definitionList = true;
|
|
962
|
+
}
|
|
963
|
+
},
|
|
964
|
+
["-list_item"]: (suffixes, startpos, endpos, pos) => {
|
|
965
|
+
const node = popContainer(pos);
|
|
966
|
+
// A lazily closed item (e.g. before a blank line that ends the list)
|
|
967
|
+
// must not extend past its own content, so the parent list's
|
|
968
|
+
// tightened range still contains it.
|
|
969
|
+
tightenContainerEnd(node);
|
|
970
|
+
if (node.data.definitionList) {
|
|
971
|
+
if (node.children[0] && node.children[0].tag === "para") {
|
|
972
|
+
const term = {
|
|
973
|
+
tag: "term",
|
|
974
|
+
children: node.children[0].children
|
|
975
|
+
};
|
|
976
|
+
node.children.shift();
|
|
977
|
+
const definition = {
|
|
978
|
+
tag: "definition",
|
|
979
|
+
children: node.children
|
|
980
|
+
};
|
|
981
|
+
addChildToTip({
|
|
982
|
+
tag: "definition_list_item",
|
|
983
|
+
children: [term, definition],
|
|
984
|
+
attributes: node.attributes,
|
|
985
|
+
autoAttributes: node.autoAttributes,
|
|
986
|
+
pos: node.pos
|
|
987
|
+
});
|
|
988
|
+
}
|
|
989
|
+
else {
|
|
990
|
+
const term = { tag: "term", children: [] };
|
|
991
|
+
const definition = {
|
|
992
|
+
tag: "definition",
|
|
993
|
+
children: node.children
|
|
994
|
+
};
|
|
995
|
+
addChildToTip({
|
|
996
|
+
tag: "definition_list_item",
|
|
997
|
+
children: [term, definition],
|
|
998
|
+
attributes: node.attributes,
|
|
999
|
+
autoAttributes: node.autoAttributes,
|
|
1000
|
+
pos: node.pos
|
|
1001
|
+
});
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
else if (node.data.checkbox) {
|
|
1005
|
+
addChildToTip({
|
|
1006
|
+
tag: "task_list_item",
|
|
1007
|
+
children: node.children,
|
|
1008
|
+
attributes: node.attributes,
|
|
1009
|
+
autoAttributes: node.autoAttributes,
|
|
1010
|
+
checkbox: node.data.checkbox,
|
|
1011
|
+
pos: node.pos
|
|
1012
|
+
});
|
|
1013
|
+
}
|
|
1014
|
+
else {
|
|
1015
|
+
addChildToTip({
|
|
1016
|
+
tag: "list_item",
|
|
1017
|
+
children: node.children,
|
|
1018
|
+
attributes: node.attributes,
|
|
1019
|
+
autoAttributes: node.autoAttributes,
|
|
1020
|
+
pos: node.pos
|
|
1021
|
+
});
|
|
1022
|
+
}
|
|
1023
|
+
},
|
|
1024
|
+
checkbox_checked: (suffixes, startpos, endpos, pos) => {
|
|
1025
|
+
topContainer().data.checkbox = "checked";
|
|
1026
|
+
},
|
|
1027
|
+
checkbox_unchecked: (suffixes, startpos, endpos, pos) => {
|
|
1028
|
+
topContainer().data.checkbox = "unchecked";
|
|
1029
|
+
},
|
|
1030
|
+
["+block_quote"]: (suffixes, startpos, endpos, pos) => {
|
|
1031
|
+
pushContainer(pos);
|
|
1032
|
+
},
|
|
1033
|
+
["-block_quote"]: (suffixes, startpos, endpos, pos) => {
|
|
1034
|
+
const node = popContainer(pos);
|
|
1035
|
+
tightenContainerEnd(node);
|
|
1036
|
+
addChildToTip({
|
|
1037
|
+
tag: "block_quote",
|
|
1038
|
+
children: node.children,
|
|
1039
|
+
attributes: node.attributes,
|
|
1040
|
+
autoAttributes: node.autoAttributes,
|
|
1041
|
+
pos: node.pos
|
|
1042
|
+
});
|
|
1043
|
+
},
|
|
1044
|
+
["+table"]: (suffixes, startpos, endpos, pos) => {
|
|
1045
|
+
pushContainer(pos);
|
|
1046
|
+
topContainer().data.aligns = [];
|
|
1047
|
+
},
|
|
1048
|
+
["-table"]: (suffixes, startpos, endpos, pos) => {
|
|
1049
|
+
const node = popContainer(pos);
|
|
1050
|
+
tightenContainerEnd(node);
|
|
1051
|
+
const rows = node.children;
|
|
1052
|
+
let caption = {
|
|
1053
|
+
tag: "caption",
|
|
1054
|
+
children: []
|
|
1055
|
+
};
|
|
1056
|
+
if (rows[0]?.tag === "caption") {
|
|
1057
|
+
caption = rows.shift();
|
|
1058
|
+
}
|
|
1059
|
+
addChildToTip({
|
|
1060
|
+
tag: "table",
|
|
1061
|
+
children: [caption, ...rows],
|
|
1062
|
+
attributes: node.attributes,
|
|
1063
|
+
autoAttributes: node.autoAttributes,
|
|
1064
|
+
pos: node.pos
|
|
1065
|
+
});
|
|
1066
|
+
},
|
|
1067
|
+
["+row"]: (suffixes, startpos, endpos, pos) => {
|
|
1068
|
+
pushContainer(pos);
|
|
1069
|
+
topContainer().data.aligns = [];
|
|
1070
|
+
},
|
|
1071
|
+
["-row"]: (suffixes, startpos, endpos, pos) => {
|
|
1072
|
+
const node = popContainer(pos);
|
|
1073
|
+
if (node.children.length === 0) { // a separator line
|
|
1074
|
+
// set table aligns, so they can be propagated to future rows
|
|
1075
|
+
topContainer().data.aligns = node.data.aligns;
|
|
1076
|
+
const tip = getTip();
|
|
1077
|
+
if (tip && "tag" in tip && tip.tag === "row") { // prev row of table
|
|
1078
|
+
tip.head = true;
|
|
1079
|
+
for (let i = 0; i < tip.children.length; i++) {
|
|
1080
|
+
tip.children[i].head = true;
|
|
1081
|
+
tip.children[i].align = node.data.aligns[i] || "default";
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
else {
|
|
1086
|
+
// get aligns from table
|
|
1087
|
+
node.data.aligns = [];
|
|
1088
|
+
for (let i = 0; i < node.children.length; i++) {
|
|
1089
|
+
node.children[i].align = topContainer().data.aligns[i] || "default";
|
|
1090
|
+
}
|
|
1091
|
+
addChildToTip({
|
|
1092
|
+
tag: "row",
|
|
1093
|
+
children: node.children,
|
|
1094
|
+
head: false, // gets set later
|
|
1095
|
+
attributes: node.attributes,
|
|
1096
|
+
autoAttributes: node.autoAttributes,
|
|
1097
|
+
pos: node.pos
|
|
1098
|
+
});
|
|
1099
|
+
}
|
|
1100
|
+
},
|
|
1101
|
+
separator_default: (suffixes, startpos, endpos, pos) => {
|
|
1102
|
+
topContainer().data.aligns.push("default");
|
|
1103
|
+
},
|
|
1104
|
+
separator_left: (suffixes, startpos, endpos, pos) => {
|
|
1105
|
+
topContainer().data.aligns.push("left");
|
|
1106
|
+
},
|
|
1107
|
+
separator_right: (suffixes, startpos, endpos, pos) => {
|
|
1108
|
+
topContainer().data.aligns.push("right");
|
|
1109
|
+
},
|
|
1110
|
+
separator_center: (suffixes, startpos, endpos, pos) => {
|
|
1111
|
+
topContainer().data.aligns.push("center");
|
|
1112
|
+
},
|
|
1113
|
+
["+cell"]: (suffixes, startpos, endpos, pos) => {
|
|
1114
|
+
pushContainer(pos);
|
|
1115
|
+
},
|
|
1116
|
+
["-cell"]: (suffixes, startpos, endpos, pos) => {
|
|
1117
|
+
const node = popContainer(pos);
|
|
1118
|
+
addChildToTip({
|
|
1119
|
+
tag: "cell",
|
|
1120
|
+
children: node.children,
|
|
1121
|
+
head: false, // gets set in "-row"
|
|
1122
|
+
align: "default", // set at "-row"
|
|
1123
|
+
attributes: node.attributes,
|
|
1124
|
+
autoAttributes: node.autoAttributes,
|
|
1125
|
+
pos: node.pos
|
|
1126
|
+
});
|
|
1127
|
+
},
|
|
1128
|
+
["+caption"]: (suffixes, startpos, endpos, pos) => {
|
|
1129
|
+
pushContainer(pos);
|
|
1130
|
+
},
|
|
1131
|
+
["-caption"]: (suffixes, startpos, endpos, pos) => {
|
|
1132
|
+
const node = popContainer(pos);
|
|
1133
|
+
const tip = getTip();
|
|
1134
|
+
if (!tip || ("tag" in tip && tip.tag !== "table")) {
|
|
1135
|
+
return;
|
|
1136
|
+
}
|
|
1137
|
+
const capt = {
|
|
1138
|
+
tag: "caption",
|
|
1139
|
+
children: node.children,
|
|
1140
|
+
attributes: node.attributes,
|
|
1141
|
+
autoAttributes: node.autoAttributes,
|
|
1142
|
+
pos: node.pos
|
|
1143
|
+
};
|
|
1144
|
+
if (tip.children[0]?.tag === "caption") {
|
|
1145
|
+
tip.children[0] = capt;
|
|
1146
|
+
}
|
|
1147
|
+
},
|
|
1148
|
+
["+footnote"]: (suffixes, startpos, endpos, pos) => {
|
|
1149
|
+
pushContainer(pos);
|
|
1150
|
+
},
|
|
1151
|
+
["-footnote"]: (suffixes, startpos, endpos, pos) => {
|
|
1152
|
+
const node = popContainer(pos);
|
|
1153
|
+
tightenContainerEnd(node);
|
|
1154
|
+
if (node.data.label) {
|
|
1155
|
+
const lab = normalizeLabel(node.data.label);
|
|
1156
|
+
footnotes[lab] =
|
|
1157
|
+
{
|
|
1158
|
+
tag: "footnote",
|
|
1159
|
+
label: lab || "",
|
|
1160
|
+
children: node.children,
|
|
1161
|
+
attributes: node.attributes,
|
|
1162
|
+
autoAttributes: node.autoAttributes,
|
|
1163
|
+
pos: node.pos
|
|
1164
|
+
};
|
|
1165
|
+
}
|
|
1166
|
+
else {
|
|
1167
|
+
warn(new Warning("Ignoring footnote without a label.", options.sourcePositions ?
|
|
1168
|
+
getSourceLoc(endpos) : endpos));
|
|
1169
|
+
}
|
|
1170
|
+
},
|
|
1171
|
+
note_label: (suffixes, startpos, endpos, pos) => {
|
|
1172
|
+
topContainer().data.label =
|
|
1173
|
+
input.substring(startpos, endpos + 1);
|
|
1174
|
+
},
|
|
1175
|
+
["+code_block"]: (suffixes, startpos, endpos, pos) => {
|
|
1176
|
+
pushContainer(pos);
|
|
1177
|
+
context = Context.Verbatim;
|
|
1178
|
+
},
|
|
1179
|
+
["-code_block"]: (suffixes, startpos, endpos, pos) => {
|
|
1180
|
+
const node = popContainer(pos);
|
|
1181
|
+
if (node.data.format) {
|
|
1182
|
+
addChildToTip({
|
|
1183
|
+
tag: "raw_block",
|
|
1184
|
+
format: node.data.format,
|
|
1185
|
+
text: accumulatedText,
|
|
1186
|
+
attributes: node.attributes,
|
|
1187
|
+
autoAttributes: node.autoAttributes,
|
|
1188
|
+
pos: node.pos
|
|
1189
|
+
});
|
|
1190
|
+
}
|
|
1191
|
+
else {
|
|
1192
|
+
addChildToTip({
|
|
1193
|
+
tag: "code_block",
|
|
1194
|
+
text: accumulatedText,
|
|
1195
|
+
lang: node.data.lang,
|
|
1196
|
+
attributes: node.attributes,
|
|
1197
|
+
autoAttributes: node.autoAttributes,
|
|
1198
|
+
pos: node.pos
|
|
1199
|
+
});
|
|
1200
|
+
}
|
|
1201
|
+
context = Context.Normal;
|
|
1202
|
+
accumulatedText = "";
|
|
1203
|
+
},
|
|
1204
|
+
code_language: (suffixes, startpos, endpos, pos) => {
|
|
1205
|
+
const top = topContainer();
|
|
1206
|
+
top.data.lang = input.substring(startpos, endpos + 1);
|
|
1207
|
+
},
|
|
1208
|
+
["+div"]: (suffixes, startpos, endpos, pos) => {
|
|
1209
|
+
pushContainer(pos);
|
|
1210
|
+
},
|
|
1211
|
+
["-div"]: (suffixes, startpos, endpos, pos) => {
|
|
1212
|
+
const node = popContainer(pos);
|
|
1213
|
+
addChildToTip({
|
|
1214
|
+
tag: "div",
|
|
1215
|
+
children: node.children,
|
|
1216
|
+
attributes: node.attributes,
|
|
1217
|
+
autoAttributes: node.autoAttributes,
|
|
1218
|
+
pos: node.pos
|
|
1219
|
+
});
|
|
1220
|
+
},
|
|
1221
|
+
thematic_break: (suffixes, startpos, endpos, pos) => {
|
|
1222
|
+
const tb = { tag: "thematic_break", pos: pos };
|
|
1223
|
+
addBlockAttributes(tb);
|
|
1224
|
+
addChildToTip(tb);
|
|
1225
|
+
},
|
|
1226
|
+
left_single_quote: (suffixes, startpos, endpos, pos) => {
|
|
1227
|
+
addChildToTip({ tag: "smart_punctuation",
|
|
1228
|
+
type: "left_single_quote",
|
|
1229
|
+
text: "'", pos: pos });
|
|
1230
|
+
},
|
|
1231
|
+
right_single_quote: (suffixes, startpos, endpos, pos) => {
|
|
1232
|
+
addChildToTip({ tag: "smart_punctuation",
|
|
1233
|
+
type: "right_single_quote",
|
|
1234
|
+
text: "'", pos: pos });
|
|
1235
|
+
},
|
|
1236
|
+
left_double_quote: (suffixes, startpos, endpos, pos) => {
|
|
1237
|
+
addChildToTip({ tag: "smart_punctuation",
|
|
1238
|
+
type: "left_double_quote",
|
|
1239
|
+
text: '"', pos });
|
|
1240
|
+
},
|
|
1241
|
+
right_double_quote: (suffixes, startpos, endpos, pos) => {
|
|
1242
|
+
addChildToTip({ tag: "smart_punctuation",
|
|
1243
|
+
type: "right_double_quote",
|
|
1244
|
+
text: '"', pos });
|
|
1245
|
+
},
|
|
1246
|
+
ellipses: (suffixes, startpos, endpos, pos) => {
|
|
1247
|
+
addChildToTip({ tag: "smart_punctuation",
|
|
1248
|
+
type: "ellipses",
|
|
1249
|
+
text: "...", pos });
|
|
1250
|
+
},
|
|
1251
|
+
en_dash: (suffixes, startpos, endpos, pos) => {
|
|
1252
|
+
addChildToTip({ tag: "smart_punctuation",
|
|
1253
|
+
type: "en_dash",
|
|
1254
|
+
text: "--", pos });
|
|
1255
|
+
},
|
|
1256
|
+
em_dash: (suffixes, startpos, endpos, pos) => {
|
|
1257
|
+
addChildToTip({ tag: "smart_punctuation",
|
|
1258
|
+
type: "em_dash",
|
|
1259
|
+
text: "---", pos });
|
|
1260
|
+
},
|
|
1261
|
+
// We set the blanklines property of a parent list or
|
|
1262
|
+
// sublist to aid with tight/loose list determination.
|
|
1263
|
+
blankline: (suffixes, startpos, endpos, pos) => {
|
|
1264
|
+
let listnode;
|
|
1265
|
+
if ("tight" in topContainer().data) {
|
|
1266
|
+
listnode = topContainer();
|
|
1267
|
+
}
|
|
1268
|
+
else if (containers.length >= 2 &&
|
|
1269
|
+
"tight" in containers[containers.length - 2].data) {
|
|
1270
|
+
listnode = containers[containers.length - 2];
|
|
1271
|
+
}
|
|
1272
|
+
if (listnode) {
|
|
1273
|
+
listnode.data.blanklines = true;
|
|
1274
|
+
}
|
|
1275
|
+
} };
|
|
1276
|
+
const handleEvent = function (containers, event) {
|
|
1277
|
+
let sp;
|
|
1278
|
+
let ep;
|
|
1279
|
+
let pos;
|
|
1280
|
+
if (options.sourcePositions) {
|
|
1281
|
+
sp = getSourceLoc(event.startpos);
|
|
1282
|
+
ep = getSourceLoc(event.endpos);
|
|
1283
|
+
pos = { start: sp, end: ep };
|
|
1284
|
+
}
|
|
1285
|
+
let annot = event.annot;
|
|
1286
|
+
let suffixes = [];
|
|
1287
|
+
if (event.annot.includes("|")) {
|
|
1288
|
+
const parts = event.annot.split("|");
|
|
1289
|
+
annot = parts[0];
|
|
1290
|
+
suffixes = parts.slice(1);
|
|
1291
|
+
}
|
|
1292
|
+
// Attributes must come right before a block, so we
|
|
1293
|
+
// reset them on blank lines.
|
|
1294
|
+
if (annot === "blankline") {
|
|
1295
|
+
for (const key in blockAttributes) {
|
|
1296
|
+
delete blockAttributes[key];
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
// The following is for tight/loose determination.
|
|
1300
|
+
// If blanklines have already been seen, and we're
|
|
1301
|
+
// about to process something other than a blankline,
|
|
1302
|
+
// the end of a list or list item, or the start of
|
|
1303
|
+
// a list, then it's a loose list.
|
|
1304
|
+
if (listDepth > 0 && annot !== "blankline") {
|
|
1305
|
+
let ln;
|
|
1306
|
+
const top = topContainer();
|
|
1307
|
+
if (top) {
|
|
1308
|
+
if (top.data && "tight" in top.data) {
|
|
1309
|
+
ln = top;
|
|
1310
|
+
}
|
|
1311
|
+
else if (containers.length >= 2 &&
|
|
1312
|
+
"tight" in containers[containers.length - 2].data) {
|
|
1313
|
+
ln = containers[containers.length - 2];
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
if (ln) {
|
|
1317
|
+
if (!/^[+-]list/.test(annot) && ln.data.blanklines) {
|
|
1318
|
+
ln.data.tight = false;
|
|
1319
|
+
}
|
|
1320
|
+
if (!/^[-+]list_item$/.test(annot)) {
|
|
1321
|
+
ln.data.blanklines = false;
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
const fn = handlers[annot];
|
|
1326
|
+
if (fn) {
|
|
1327
|
+
fn(suffixes, event.startpos, event.endpos, pos);
|
|
1328
|
+
}
|
|
1329
|
+
};
|
|
1330
|
+
const containers = [{
|
|
1331
|
+
children: [],
|
|
1332
|
+
data: { headinglevel: 0 },
|
|
1333
|
+
pos: {
|
|
1334
|
+
start: { line: 0, col: 0, offset: 0 },
|
|
1335
|
+
end: { line: 0, col: 0, offset: 0 }
|
|
1336
|
+
}
|
|
1337
|
+
}];
|
|
1338
|
+
let lastpos = 0;
|
|
1339
|
+
for (const event of events) {
|
|
1340
|
+
handleEvent(containers, event);
|
|
1341
|
+
lastpos = event.endpos;
|
|
1342
|
+
}
|
|
1343
|
+
let lastloc;
|
|
1344
|
+
if (options.sourcePositions) {
|
|
1345
|
+
lastloc = getSourceLoc(lastpos);
|
|
1346
|
+
}
|
|
1347
|
+
// close any open sections:
|
|
1348
|
+
let pnode = topContainer();
|
|
1349
|
+
while (pnode && pnode.data.headinglevel > 0) {
|
|
1350
|
+
// close sections til we get to the doc level
|
|
1351
|
+
popContainer(lastloc && { start: lastloc, end: lastloc });
|
|
1352
|
+
addChildToTip({
|
|
1353
|
+
tag: "section",
|
|
1354
|
+
children: pnode.children,
|
|
1355
|
+
attributes: pnode.attributes,
|
|
1356
|
+
autoAttributes: pnode.autoAttributes,
|
|
1357
|
+
pos: pnode.pos
|
|
1358
|
+
});
|
|
1359
|
+
pnode = topContainer();
|
|
1360
|
+
}
|
|
1361
|
+
const doc = {
|
|
1362
|
+
tag: "doc",
|
|
1363
|
+
references: references,
|
|
1364
|
+
autoReferences: autoReferences,
|
|
1365
|
+
footnotes: footnotes,
|
|
1366
|
+
children: containers[0].children,
|
|
1367
|
+
};
|
|
1368
|
+
if (containers[0].autoAttributes) {
|
|
1369
|
+
doc.autoAttributes = containers[0].autoAttributes;
|
|
1370
|
+
}
|
|
1371
|
+
if (containers[0].attributes) {
|
|
1372
|
+
doc.attributes = containers[0].attributes;
|
|
1373
|
+
}
|
|
1374
|
+
return doc;
|
|
1375
|
+
};
|
|
1376
|
+
const omitFields = {
|
|
1377
|
+
children: true,
|
|
1378
|
+
tag: true,
|
|
1379
|
+
pos: true,
|
|
1380
|
+
attributes: true,
|
|
1381
|
+
autoAttributes: true,
|
|
1382
|
+
references: true,
|
|
1383
|
+
autoReferences: true,
|
|
1384
|
+
footnotes: true
|
|
1385
|
+
};
|
|
1386
|
+
const stringify = function (x) {
|
|
1387
|
+
return JSON.stringify(x).replace(/\\\n/g, "\\n");
|
|
1388
|
+
};
|
|
1389
|
+
const renderAstNode = function (node, buff, indent) {
|
|
1390
|
+
buff.push(" ".repeat(indent));
|
|
1391
|
+
if (indent > 128) {
|
|
1392
|
+
buff.push("(((DEEPLY NESTED CONTENT OMITTED)))\n");
|
|
1393
|
+
return;
|
|
1394
|
+
}
|
|
1395
|
+
buff.push(node.tag);
|
|
1396
|
+
if (node.pos) {
|
|
1397
|
+
buff.push(` (${node.pos.start.line}:${node.pos.start.col}:${node.pos.start.offset}-${node.pos.end.line}:${node.pos.end.col}:${node.pos.end.offset})`);
|
|
1398
|
+
}
|
|
1399
|
+
for (const k in node) {
|
|
1400
|
+
if (!omitFields[k]) {
|
|
1401
|
+
const v = node[k];
|
|
1402
|
+
if (v !== undefined && v !== null) {
|
|
1403
|
+
buff.push(` ${k}=${stringify(v)}`);
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
if (node.attributes) {
|
|
1408
|
+
for (const k in node.attributes) {
|
|
1409
|
+
buff.push(` ${k}=${stringify(node.attributes[k])}`);
|
|
1410
|
+
}
|
|
1411
|
+
}
|
|
1412
|
+
buff.push("\n");
|
|
1413
|
+
if (node.children) {
|
|
1414
|
+
for (const child of node.children) {
|
|
1415
|
+
renderAstNode(child, buff, indent + 2);
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
};
|
|
1419
|
+
// Render an AST in human-readable form, with indentation
|
|
1420
|
+
// showing the hierarchy.
|
|
1421
|
+
const renderAST = function (doc) {
|
|
1422
|
+
const buff = [];
|
|
1423
|
+
renderAstNode(doc, buff, 0);
|
|
1424
|
+
if (Object.keys(doc.references).length > 0) {
|
|
1425
|
+
buff.push("references\n");
|
|
1426
|
+
for (const k in doc.references) {
|
|
1427
|
+
buff.push(` [${stringify(k)}] =\n`);
|
|
1428
|
+
renderAstNode(doc.references[k], buff, 4);
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
if (Object.keys(doc.footnotes).length > 0) {
|
|
1432
|
+
buff.push("footnotes\n");
|
|
1433
|
+
for (const k in doc.footnotes) {
|
|
1434
|
+
buff.push(` [${stringify(k)}] =\n`);
|
|
1435
|
+
renderAstNode(doc.footnotes[k], buff, 4);
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
return buff.join("");
|
|
1439
|
+
};
|
|
1440
|
+
const parse = function (input, options = {}) {
|
|
1441
|
+
const parser = parseEvents(input, options);
|
|
1442
|
+
return parseFromEvents(parser, input, options);
|
|
1443
|
+
};
|
|
1444
|
+
export { parseFromEvents, parse, renderAST, getStringContent, isBlock, isRow, isCaption, isInline, };
|
|
1445
|
+
//# sourceMappingURL=parse.js.map
|