pulpweaver4 0.0.88 → 0.0.185
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 +2 -1
- package/dist/ast/djot.js +31 -2
- package/dist/ast/djot.js.map +1 -1
- package/dist/ast/index.d.ts +1 -0
- package/dist/ast/index.js +1 -0
- package/dist/ast/index.js.map +1 -1
- package/dist/ast/nodes.d.ts +72 -9
- package/dist/ast/nodes.js +8 -0
- package/dist/ast/nodes.js.map +1 -1
- package/dist/ast/table.d.ts +27 -0
- package/dist/ast/table.js +32 -0
- package/dist/ast/table.js.map +1 -0
- package/dist/browser.js +2420 -0
- package/dist/citations/book.d.ts +2 -0
- package/dist/citations/book.js +17 -6
- package/dist/citations/book.js.map +1 -1
- package/dist/citations/collect.d.ts +5 -1
- package/dist/citations/collect.js +5 -1
- package/dist/citations/collect.js.map +1 -1
- package/dist/citations/index.d.ts +1 -1
- package/dist/citations/index.js +1 -1
- package/dist/citations/index.js.map +1 -1
- package/dist/citations/notes.js +54 -11
- package/dist/citations/notes.js.map +1 -1
- package/dist/citations/positions.js +4 -4
- package/dist/citations/positions.js.map +1 -1
- package/dist/citations/project.d.ts +12 -2
- package/dist/citations/project.js +21 -7
- package/dist/citations/project.js.map +1 -1
- package/dist/colour/images.d.ts +11 -2
- package/dist/colour/images.js +53 -3
- package/dist/colour/images.js.map +1 -1
- package/dist/colour/ink-limit.d.ts +2 -2
- package/dist/colour/ink-limit.js +6 -0
- package/dist/colour/ink-limit.js.map +1 -1
- package/dist/colour/intents.d.ts +10 -0
- package/dist/colour/intents.js +10 -0
- package/dist/colour/intents.js.map +1 -1
- package/dist/colour/previews.d.ts +8 -4
- package/dist/colour/previews.js +11 -8
- package/dist/colour/previews.js.map +1 -1
- package/dist/config/config.d.ts +99 -6
- package/dist/config/config.js +217 -6
- package/dist/config/config.js.map +1 -1
- package/dist/config/project-schema.d.ts +0 -8
- package/dist/config/project-schema.js +221 -12
- package/dist/config/project-schema.js.map +1 -1
- package/dist/config/schema.js +10 -0
- package/dist/config/schema.js.map +1 -1
- package/dist/config/secrets.d.ts +11 -0
- package/dist/config/secrets.js +19 -0
- package/dist/config/secrets.js.map +1 -0
- package/dist/csl/processor.d.ts +3 -1
- package/dist/csl/processor.js +19 -13
- package/dist/csl/processor.js.map +1 -1
- package/dist/csl/project.d.ts +19 -4
- package/dist/csl/project.js +31 -11
- package/dist/csl/project.js.map +1 -1
- package/dist/djot/djot.js/src/ast.d.ts +4 -1
- package/dist/djot/djot.js/src/ast.js +8 -1
- package/dist/djot/djot.js/src/ast.js.map +1 -1
- package/dist/djot/djot.js/src/djot-renderer.js +3 -3
- package/dist/djot/djot.js/src/djot-renderer.js.map +1 -1
- package/dist/djot/djot.js/src/html.js +2 -1
- package/dist/djot/djot.js/src/html.js.map +1 -1
- package/dist/djot/djot.js/src/inline.d.ts +1 -1
- package/dist/djot/djot.js/src/inline.js +25 -12
- package/dist/djot/djot.js/src/inline.js.map +1 -1
- package/dist/djot/djot.js/src/pandoc.js +81 -11
- package/dist/djot/djot.js/src/pandoc.js.map +1 -1
- package/dist/djot/djot.js/src/parse.js +12 -3
- package/dist/djot/djot.js/src/parse.js.map +1 -1
- package/dist/fonts/index.d.ts +1 -1
- package/dist/fonts/index.js +1 -1
- package/dist/fonts/index.js.map +1 -1
- package/dist/fonts/lint.d.ts +51 -0
- package/dist/fonts/lint.js +101 -16
- package/dist/fonts/lint.js.map +1 -1
- package/dist/fonts/walk.d.ts +13 -0
- package/dist/fonts/walk.js +50 -33
- package/dist/fonts/walk.js.map +1 -1
- package/dist/html/css.d.ts +4 -0
- package/dist/html/css.js +11 -3
- package/dist/html/css.js.map +1 -1
- package/dist/html/dom.d.ts +6 -1
- package/dist/html/dom.js +28 -6
- package/dist/html/dom.js.map +1 -1
- package/dist/html/generated.d.ts +17 -0
- package/dist/html/generated.js +21 -0
- package/dist/html/generated.js.map +1 -0
- package/dist/html/images.d.ts +18 -0
- package/dist/html/images.js +49 -2
- package/dist/html/images.js.map +1 -1
- package/dist/html/index.d.ts +1 -0
- package/dist/html/index.js +1 -0
- package/dist/html/index.js.map +1 -1
- package/dist/html/render.d.ts +5 -4
- package/dist/html/render.js +34 -9
- package/dist/html/render.js.map +1 -1
- package/dist/hyphenation/exceptions.d.ts +5 -0
- package/dist/hyphenation/exceptions.js +11 -0
- package/dist/hyphenation/exceptions.js.map +1 -1
- package/dist/hyphenation/index.d.ts +1 -1
- package/dist/hyphenation/index.js +1 -1
- package/dist/hyphenation/index.js.map +1 -1
- package/dist/import/convert.d.ts +21 -0
- package/dist/import/convert.js +65 -0
- package/dist/import/convert.js.map +1 -0
- package/dist/incremental/cache.d.ts +59 -0
- package/dist/incremental/cache.js +64 -0
- package/dist/incremental/cache.js.map +1 -0
- package/dist/incremental/index.d.ts +3 -0
- package/dist/incremental/index.js +4 -0
- package/dist/incremental/index.js.map +1 -0
- package/dist/incremental/keys.d.ts +27 -0
- package/dist/incremental/keys.js +89 -0
- package/dist/incremental/keys.js.map +1 -0
- package/dist/incremental/session.d.ts +180 -0
- package/dist/incremental/session.js +401 -0
- package/dist/incremental/session.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/indexes/layout.d.ts +8 -2
- package/dist/indexes/layout.js +6 -4
- package/dist/indexes/layout.js.map +1 -1
- package/dist/layout/cache.d.ts +174 -0
- package/dist/layout/cache.js +150 -0
- package/dist/layout/cache.js.map +1 -0
- package/dist/layout/converge.d.ts +28 -0
- package/dist/layout/converge.js +102 -9
- package/dist/layout/converge.js.map +1 -1
- package/dist/layout/counters.d.ts +4 -0
- package/dist/layout/counters.js +15 -0
- package/dist/layout/counters.js.map +1 -1
- package/dist/layout/index.d.ts +5 -2
- package/dist/layout/index.js +3 -0
- package/dist/layout/index.js.map +1 -1
- package/dist/layout/lists.d.ts +52 -3
- package/dist/layout/lists.js +513 -46
- package/dist/layout/lists.js.map +1 -1
- package/dist/layout/lookahead.d.ts +151 -0
- package/dist/layout/lookahead.js +581 -0
- package/dist/layout/lookahead.js.map +1 -0
- package/dist/layout/margin-boxes.d.ts +11 -1
- package/dist/layout/margin-boxes.js +24 -1
- package/dist/layout/margin-boxes.js.map +1 -1
- package/dist/layout/page-box.d.ts +2 -0
- package/dist/layout/page-box.js +6 -4
- package/dist/layout/page-box.js.map +1 -1
- package/dist/layout/page-rules.d.ts +8 -1
- package/dist/layout/page-rules.js +46 -2
- package/dist/layout/page-rules.js.map +1 -1
- package/dist/layout/page.js +4 -2
- package/dist/layout/page.js.map +1 -1
- package/dist/layout/pagebuilder.d.ts +248 -3
- package/dist/layout/pagebuilder.js +512 -19
- package/dist/layout/pagebuilder.js.map +1 -1
- package/dist/layout/pages.d.ts +116 -3
- package/dist/layout/pages.js +1396 -162
- package/dist/layout/pages.js.map +1 -1
- package/dist/layout/paragraph.d.ts +14 -0
- package/dist/layout/paragraph.js +304 -31
- package/dist/layout/paragraph.js.map +1 -1
- package/dist/layout/pre.js +4 -0
- package/dist/layout/pre.js.map +1 -1
- package/dist/layout/protrusion.d.ts +26 -0
- package/dist/layout/protrusion.js +39 -0
- package/dist/layout/protrusion.js.map +1 -0
- package/dist/layout/ranges.d.ts +2 -0
- package/dist/layout/ranges.js +22 -0
- package/dist/layout/ranges.js.map +1 -0
- package/dist/layout/region.d.ts +2 -1
- package/dist/layout/region.js +9 -5
- package/dist/layout/region.js.map +1 -1
- package/dist/layout/templates.d.ts +71 -0
- package/dist/layout/templates.js +290 -0
- package/dist/layout/templates.js.map +1 -0
- package/dist/layout/vlist.d.ts +3 -3
- package/dist/linebreak/items.d.ts +27 -2
- package/dist/linebreak/items.js +10 -3
- package/dist/linebreak/items.js.map +1 -1
- package/dist/linebreak/knuth-plass.d.ts +20 -0
- package/dist/linebreak/knuth-plass.js +68 -16
- package/dist/linebreak/knuth-plass.js.map +1 -1
- package/dist/lint/book.d.ts +13 -0
- package/dist/lint/book.js +52 -0
- package/dist/lint/book.js.map +1 -0
- package/dist/lint/config.d.ts +9 -0
- package/dist/lint/config.js +40 -6
- package/dist/lint/config.js.map +1 -1
- package/dist/lint/linter.js +1 -0
- package/dist/lint/linter.js.map +1 -1
- package/dist/lint/project.js +1 -1
- package/dist/lint/project.js.map +1 -1
- package/dist/lint/rules/layout.d.ts +3 -1
- package/dist/lint/rules/layout.js +8 -6
- package/dist/lint/rules/layout.js.map +1 -1
- package/dist/lint/rules/source.d.ts +3 -1
- package/dist/lint/rules/source.js +9 -4
- package/dist/lint/rules/source.js.map +1 -1
- package/dist/lint/testing.js +1 -0
- package/dist/lint/testing.js.map +1 -1
- package/dist/measure/bidi-data.d.ts +14 -0
- package/dist/measure/bidi-data.js +69 -0
- package/dist/measure/bidi-data.js.map +1 -0
- package/dist/measure/bidi.d.ts +70 -0
- package/dist/measure/bidi.js +225 -0
- package/dist/measure/bidi.js.map +1 -0
- package/dist/measure/css.d.ts +5 -0
- package/dist/measure/css.js +2 -0
- package/dist/measure/css.js.map +1 -1
- package/dist/measure/measurer.d.ts +36 -2
- package/dist/measure/measurer.js +220 -22
- package/dist/measure/measurer.js.map +1 -1
- package/dist/measure/model.d.ts +20 -2
- package/dist/measure/model.js +13 -6
- package/dist/measure/model.js.map +1 -1
- package/dist/measure/script-data.d.ts +6 -0
- package/dist/measure/script-data.js +34 -0
- package/dist/measure/script-data.js.map +1 -0
- package/dist/measure/scripts.d.ts +36 -0
- package/dist/measure/scripts.js +293 -0
- package/dist/measure/scripts.js.map +1 -0
- package/dist/output/output.d.ts +35 -3
- package/dist/output/output.js +26 -4
- package/dist/output/output.js.map +1 -1
- package/dist/paint/backgrounds.js +7 -20
- package/dist/paint/backgrounds.js.map +1 -1
- package/dist/paint/blend.d.ts +33 -13
- package/dist/paint/blend.js +73 -21
- package/dist/paint/blend.js.map +1 -1
- package/dist/paint/cache.d.ts +80 -0
- package/dist/paint/cache.js +537 -0
- package/dist/paint/cache.js.map +1 -0
- package/dist/paint/canvas.d.ts +4 -13
- package/dist/paint/canvas.js +45 -5
- package/dist/paint/canvas.js.map +1 -1
- package/dist/paint/context.d.ts +2 -0
- package/dist/paint/emphasis.js +1 -1
- package/dist/paint/emphasis.js.map +1 -1
- package/dist/paint/flatten.d.ts +24 -2
- package/dist/paint/flatten.js +55 -12
- package/dist/paint/flatten.js.map +1 -1
- package/dist/paint/forms.d.ts +64 -0
- package/dist/paint/forms.js +319 -0
- package/dist/paint/forms.js.map +1 -0
- package/dist/paint/images.d.ts +4 -1
- package/dist/paint/images.js +13 -2
- package/dist/paint/images.js.map +1 -1
- package/dist/paint/layers.d.ts +64 -0
- package/dist/paint/layers.js +137 -0
- package/dist/paint/layers.js.map +1 -0
- package/dist/paint/painter.d.ts +19 -6
- package/dist/paint/painter.js +15 -135
- package/dist/paint/painter.js.map +1 -1
- package/dist/paint/stacking.d.ts +1 -1
- package/dist/paint/stacking.js +9 -2
- package/dist/paint/stacking.js.map +1 -1
- package/dist/paint/text.d.ts +14 -3
- package/dist/paint/text.js +25 -4
- package/dist/paint/text.js.map +1 -1
- package/dist/paint/vertical.js +2 -2
- package/dist/paint/vertical.js.map +1 -1
- package/dist/pdf/encoded.d.ts +16 -0
- package/dist/pdf/encoded.js +35 -0
- package/dist/pdf/encoded.js.map +1 -0
- package/dist/pdf/include/colour.d.ts +105 -0
- package/dist/pdf/include/colour.js +349 -0
- package/dist/pdf/include/colour.js.map +1 -0
- package/dist/pdf/include/functions.d.ts +17 -0
- package/dist/pdf/include/functions.js +389 -0
- package/dist/pdf/include/functions.js.map +1 -0
- package/dist/pdf/include/pages.d.ts +14 -0
- package/dist/pdf/include/pages.js +27 -0
- package/dist/pdf/include/pages.js.map +1 -0
- package/dist/pdf/include/pdfjs/LICENSE +177 -0
- package/dist/pdf/include/pdfjs/pdf.min.mjs +27 -0
- package/dist/pdf/include/pdfjs/pdf.worker.min.mjs +27 -0
- package/dist/pdf/include/pdfjs/standard_fonts/FoxitDingbats.pfb +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/FoxitFixed.pfb +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/FoxitFixedBold.pfb +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/FoxitFixedItalic.pfb +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/FoxitSerif.pfb +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/FoxitSerifBold.pfb +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/FoxitSerifItalic.pfb +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/FoxitSymbol.pfb +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/LICENSE_FOXIT +27 -0
- package/dist/pdf/include/pdfjs/standard_fonts/LICENSE_LIBERATION +363 -0
- package/dist/pdf/include/pdfjs/standard_fonts/LiberationSans-Bold.ttf +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/LiberationSans-Italic.ttf +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/LiberationSans-Regular.ttf +0 -0
- package/dist/pdf/include/pdfjs/wasm/LICENSE_JBIG2 +196 -0
- package/dist/pdf/include/pdfjs/wasm/LICENSE_OPENJPEG +39 -0
- package/dist/pdf/include/pdfjs/wasm/LICENSE_PDFJS_JBIG2 +13 -0
- package/dist/pdf/include/pdfjs/wasm/LICENSE_PDFJS_OPENJPEG +22 -0
- package/dist/pdf/include/pdfjs/wasm/LICENSE_PDFJS_QCMS +19 -0
- package/dist/pdf/include/pdfjs/wasm/LICENSE_QCMS +21 -0
- package/dist/pdf/include/pdfjs/wasm/jbig2.wasm +0 -0
- package/dist/pdf/include/pdfjs/wasm/openjpeg.wasm +0 -0
- package/dist/pdf/include/pdfjs/wasm/qcms_bg.wasm +0 -0
- package/dist/pdf/include/pdfjs/wasm/quickjs-eval.wasm +0 -0
- package/dist/pdf/include/prepare.d.ts +58 -0
- package/dist/pdf/include/prepare.js +266 -0
- package/dist/pdf/include/prepare.js.map +1 -0
- package/dist/pdf/include/preview.d.ts +38 -0
- package/dist/pdf/include/preview.js +101 -0
- package/dist/pdf/include/preview.js.map +1 -0
- package/dist/pdf/include/rewrite.d.ts +57 -0
- package/dist/pdf/include/rewrite.js +803 -0
- package/dist/pdf/include/rewrite.js.map +1 -0
- package/dist/pdf/include/serialize.d.ts +32 -0
- package/dist/pdf/include/serialize.js +158 -0
- package/dist/pdf/include/serialize.js.map +1 -0
- package/dist/pdf/include/testing.d.ts +26 -0
- package/dist/pdf/include/testing.js +50 -0
- package/dist/pdf/include/testing.js.map +1 -0
- package/dist/pdf/index.d.ts +1 -0
- package/dist/pdf/index.js +1 -0
- package/dist/pdf/index.js.map +1 -1
- package/dist/pdf/structure/annotations.d.ts +33 -0
- package/dist/pdf/structure/annotations.js +112 -0
- package/dist/pdf/structure/annotations.js.map +1 -0
- package/dist/pdf/structure/forms.d.ts +10 -0
- package/dist/pdf/structure/forms.js +46 -0
- package/dist/pdf/structure/forms.js.map +1 -0
- package/dist/pdf/structure/index.d.ts +41 -5
- package/dist/pdf/structure/index.js +40 -5
- package/dist/pdf/structure/index.js.map +1 -1
- package/dist/pdf/structure/links.d.ts +2 -0
- package/dist/pdf/structure/links.js +1 -1
- package/dist/pdf/structure/links.js.map +1 -1
- package/dist/pdf/structure/presentation.d.ts +28 -0
- package/dist/pdf/structure/presentation.js +79 -0
- package/dist/pdf/structure/presentation.js.map +1 -0
- package/dist/pdf/structure/tags.d.ts +34 -2
- package/dist/pdf/structure/tags.js +117 -14
- package/dist/pdf/structure/tags.js.map +1 -1
- package/dist/pdf/types.d.ts +378 -15
- package/dist/pdf/wasm/pulpweaver4_pdf.d.ts +44 -2
- package/dist/pdf/wasm/pulpweaver4_pdf.js +191 -2
- package/dist/pdf/wasm/pulpweaver4_pdf_bg.wasm +0 -0
- package/dist/pdf/writer.d.ts +13 -1
- package/dist/pdf/writer.js +26 -1
- package/dist/pdf/writer.js.map +1 -1
- package/dist/plugin/define.d.ts +200 -15
- package/dist/plugin/define.js +124 -15
- package/dist/plugin/define.js.map +1 -1
- package/dist/plugin/failure.d.ts +1 -1
- package/dist/plugin/index.d.ts +5 -4
- package/dist/plugin/index.js +5 -4
- package/dist/plugin/index.js.map +1 -1
- package/dist/plugin/reference.d.ts +38 -0
- package/dist/plugin/reference.js +287 -0
- package/dist/plugin/reference.js.map +1 -0
- package/dist/plugin/register.d.ts +39 -7
- package/dist/plugin/register.js +83 -2
- package/dist/plugin/register.js.map +1 -1
- package/dist/preflight/index.d.ts +1 -1
- package/dist/preflight/index.js +1 -1
- package/dist/preflight/index.js.map +1 -1
- package/dist/preflight/pdfx.d.ts +35 -0
- package/dist/preflight/pdfx.js +37 -4
- package/dist/preflight/pdfx.js.map +1 -1
- package/dist/preflight/reader.d.ts +10 -3
- package/dist/preflight/reader.js +86 -5
- package/dist/preflight/reader.js.map +1 -1
- package/dist/print/impose.d.ts +66 -0
- package/dist/print/impose.js +331 -0
- package/dist/print/impose.js.map +1 -0
- package/dist/print/output.js +426 -60
- package/dist/print/output.js.map +1 -1
- package/dist/problem.js +4 -3
- package/dist/problem.js.map +1 -1
- package/dist/profile/index.d.ts +1 -0
- package/dist/profile/index.js +1 -0
- package/dist/profile/index.js.map +1 -1
- package/dist/profile/lint.d.ts +1 -1
- package/dist/profile/lint.js +29 -1
- package/dist/profile/lint.js.map +1 -1
- package/dist/profile/list-table.d.ts +51 -0
- package/dist/profile/list-table.js +137 -0
- package/dist/profile/list-table.js.map +1 -0
- package/dist/profile/metadata.js +3 -0
- package/dist/profile/metadata.js.map +1 -1
- package/dist/profile/profile.d.ts +3 -0
- package/dist/profile/profile.js +9 -1
- package/dist/profile/profile.js.map +1 -1
- package/dist/project.js +3 -0
- package/dist/project.js.map +1 -1
- package/dist/qpdf/index.d.ts +2 -0
- package/dist/qpdf/index.js +3 -0
- package/dist/qpdf/index.js.map +1 -0
- package/dist/qpdf/qpdf.d.ts +125 -0
- package/dist/qpdf/qpdf.js +205 -0
- package/dist/qpdf/qpdf.js.map +1 -0
- package/dist/qpdf/testing.d.ts +12 -0
- package/dist/qpdf/testing.js +9 -0
- package/dist/qpdf/testing.js.map +1 -0
- package/dist/qpdf/wasm/LICENSE-qpdf +202 -0
- package/dist/qpdf/wasm/LICENSE-zlib +22 -0
- package/dist/qpdf/wasm/NOTICE-qpdf.md +42 -0
- package/dist/qpdf/wasm/qpdf.wasm +0 -0
- package/dist/render/index.d.ts +3 -0
- package/dist/render/index.js +2 -0
- package/dist/render/index.js.map +1 -0
- package/dist/render/render.d.ts +98 -0
- package/dist/render/render.js +243 -0
- package/dist/render/render.js.map +1 -0
- package/dist/reproducible/clock.d.ts +4 -5
- package/dist/reproducible/clock.js +4 -5
- package/dist/reproducible/clock.js.map +1 -1
- package/dist/spike/spike-page.chromium.json +4 -4
- package/dist/style/colours.d.ts +7 -2
- package/dist/style/colours.js +24 -2
- package/dist/style/colours.js.map +1 -1
- package/dist/style/compile.js +1 -1
- package/dist/style/compile.js.map +1 -1
- package/dist/style/defaults.d.ts +9 -3
- package/dist/style/defaults.js +14 -2
- package/dist/style/defaults.js.map +1 -1
- package/dist/style/gcpm.d.ts +1 -1
- package/dist/style/gcpm.js +17 -5
- package/dist/style/gcpm.js.map +1 -1
- package/dist/style/properties.js +84 -0
- package/dist/style/properties.js.map +1 -1
- package/dist/test/book.d.ts +22 -2
- package/dist/test/book.js +35 -2
- package/dist/test/book.js.map +1 -1
- package/dist/test/build.d.ts +23 -0
- package/dist/test/build.js +86 -33
- package/dist/test/build.js.map +1 -1
- package/dist/test/layout.js +132 -22
- package/dist/test/layout.js.map +1 -1
- package/dist/test/limits.d.ts +8 -0
- package/dist/test/limits.js +9 -0
- package/dist/test/limits.js.map +1 -0
- package/dist/test/pipeline.d.ts +26 -0
- package/dist/test/pipeline.js +4 -2
- package/dist/test/pipeline.js.map +1 -1
- package/dist/test/render.d.ts +26 -3
- package/dist/test/render.js +151 -23
- package/dist/test/render.js.map +1 -1
- package/dist/test/runner.d.ts +6 -3
- package/dist/test/runner.js +172 -105
- package/dist/test/runner.js.map +1 -1
- package/dist/test/text.js +2 -2
- package/dist/test/text.js.map +1 -1
- package/dist/text/output.js +2 -2
- package/dist/text/output.js.map +1 -1
- package/dist/text/render.d.ts +4 -3
- package/dist/text/render.js +128 -6
- package/dist/text/render.js.map +1 -1
- package/dist/transform/index.d.ts +1 -1
- package/dist/transform/index.js +1 -1
- package/dist/transform/index.js.map +1 -1
- package/dist/transform/run.d.ts +2 -0
- package/dist/transform/run.js +32 -16
- package/dist/transform/run.js.map +1 -1
- package/dist/web/output.js +116 -10
- package/dist/web/output.js.map +1 -1
- package/dist/web/runtime/justify.js.txt +2 -2
- package/dist/web/site.d.ts +2 -0
- package/dist/web/site.js +8 -1
- package/dist/web/site.js.map +1 -1
- package/docs/README.md +6 -1
- package/docs/manual/chapters/front.dj +34 -0
- package/docs/manual/chapters/guides/citations.dj +426 -0
- package/docs/manual/chapters/guides/colour-and-prepress.dj +261 -0
- package/docs/manual/chapters/guides/editions.dj +329 -0
- package/docs/manual/chapters/guides/in-a-web-page.dj +143 -0
- package/docs/manual/chapters/guides/lines-and-pages.dj +681 -0
- package/docs/manual/chapters/guides/lint-rules.dj +355 -0
- package/docs/manual/chapters/guides/pdfs.dj +501 -0
- package/docs/manual/chapters/guides/plugins.dj +425 -0
- package/docs/manual/chapters/guides/testing.dj +264 -0
- package/docs/manual/chapters/guides/writing-in-djot.dj +537 -0
- package/docs/manual/chapters/start/for-latex-users.dj +256 -0
- package/docs/manual/chapters/start/getting-started.dj +167 -0
- package/docs/manual/chapters/start/your-first-book.dj +426 -0
- package/docs/manual/fonts/CrimsonPro-Italic-VF.ttf +0 -0
- package/docs/manual/fonts/CrimsonPro-VF.ttf +0 -0
- package/docs/manual/fonts/JetBrainsMono-Regular.otf +0 -0
- package/docs/manual/fonts/NotoSansSymbols2-Boxes.ttf +0 -0
- package/docs/manual/fonts/OFL.txt +95 -0
- package/docs/manual/pulpweaver4.toml +39 -0
- package/docs/manual/styles/manual.css +137 -0
- package/docs/reference/css-properties/index.md +9 -0
- package/docs/reference/css-properties/pw-expansion.md +31 -0
- package/docs/reference/css-properties/pw-flow-into.md +31 -0
- package/docs/reference/css-properties/pw-knockout.md +26 -0
- package/docs/reference/css-properties/pw-layer.md +24 -0
- package/docs/reference/css-properties/pw-page-breaking.md +30 -0
- package/docs/reference/css-properties/pw-page-duration.md +28 -0
- package/docs/reference/css-properties/pw-page-rotate.md +29 -0
- package/docs/reference/css-properties/pw-page-transition.md +29 -0
- package/docs/reference/css-properties/pw-protrusion.md +31 -0
- package/docs/reference/lint-rules/ibid-across-page.md +2 -2
- package/docs/reference/lint-rules/unused-entry.md +3 -1
- package/docs/reference/plugin-api/capabilities.md +2 -2
- package/docs/reference/plugin-api/claim-kind.md +1 -1
- package/docs/reference/plugin-api/combine-exceptions.md +19 -0
- package/docs/reference/plugin-api/element-break-context.md +34 -0
- package/docs/reference/plugin-api/element-break-item.md +24 -0
- package/docs/reference/plugin-api/element-breaker.md +24 -0
- package/docs/reference/plugin-api/flow-definition.md +30 -0
- package/docs/reference/plugin-api/generated-reference.md +32 -0
- package/docs/reference/plugin-api/index-definition.md +32 -0
- package/docs/reference/plugin-api/index-titles.md +18 -0
- package/docs/reference/plugin-api/index.md +27 -3
- package/docs/reference/plugin-api/insert-class-definition.md +46 -0
- package/docs/reference/plugin-api/insert-placement.md +22 -0
- package/docs/reference/plugin-api/insert-placements.md +18 -0
- package/docs/reference/plugin-api/layout-definition.md +9 -5
- package/docs/reference/plugin-api/layout-slot.md +6 -16
- package/docs/reference/plugin-api/lint-context.md +3 -1
- package/docs/reference/plugin-api/lint-definition.md +1 -1
- package/docs/reference/plugin-api/lint-edition.md +2 -0
- package/docs/reference/plugin-api/page-builder-event.md +22 -0
- package/docs/reference/plugin-api/page-builder-hook.md +7 -3
- package/docs/reference/plugin-api/page-builder-page-event.md +30 -0
- package/docs/reference/plugin-api/page-template-definition.md +34 -0
- package/docs/reference/plugin-api/page-template-region-definition.md +46 -0
- package/docs/reference/plugin-api/plugin-definition.md +5 -1
- package/docs/reference/plugin-api/plugin-reference-options.md +32 -0
- package/docs/reference/plugin-api/plugin-reference.md +22 -0
- package/docs/reference/plugin-api/plugin-registry.md +15 -5
- package/docs/reference/plugin-api/plugin-stage.md +1 -1
- package/docs/reference/plugin-api/plugin.md +9 -2
- package/docs/reference/plugin-api/reference-page.md +34 -0
- package/docs/reference/plugin-api/render-reference-page.md +18 -0
- package/docs/reference/plugin-api/renderers.md +1 -1
- package/docs/reference/pulpweaver4-toml/editions.md +253 -2
- package/docs/reference/pulpweaver4-toml/index.md +57 -1
- package/docs/reference/pulpweaver4-toml/inks.md +15 -4
- package/docs/reference/pulpweaver4-toml/lint.md +1 -1
- package/package.json +5 -1
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
``` =meta
|
|
2
|
+
description = 'The lint rules that check every book against a policy — on its source, its HTML and its finished pages — how to configure them like ESLint’s, and how a press writes its own.'
|
|
3
|
+
```
|
|
4
|
+
|
|
5
|
+
{#lint-rules}
|
|
6
|
+
# Lint rules for your press
|
|
7
|
+
|
|
8
|
+
Lint rules check a book against a policy: no unknown labels, no image
|
|
9
|
+
without a description, no widows, no chapter opening on a left-hand page.
|
|
10
|
+
Where a [test](#testing) checks a fact about one book, a rule
|
|
11
|
+
holds every book to a house style. pulpweaver4’s rules are configured like
|
|
12
|
+
[ESLint](https://eslint.org)’s, and unlike a linter for code, many of them
|
|
13
|
+
see the finished pages.
|
|
14
|
+
|
|
15
|
+
{#three-levels}
|
|
16
|
+
## Three levels
|
|
17
|
+
|
|
18
|
+
Each rule runs at one level, on what the build has made by then:
|
|
19
|
+
|
|
20
|
+
| Level | Sees |
|
|
21
|
+
|----|----|
|
|
22
|
+
| `source` | The document and the bibliography, with every node’s place in the source |
|
|
23
|
+
| `html` | The rendered HTML, for each edition |
|
|
24
|
+
| `layout` | The pages, their lines (with TeX’s adjustment ratios) and boxes, for each print edition |
|
|
25
|
+
|
|
26
|
+
`pw lint` and `pw build` run every level and report the same problems. `pw lint` runs the `source` rules first, then, if an `html` or `layout` rule is
|
|
27
|
+
on, builds the book in Chromium, as `pw build` does, without writing it;
|
|
28
|
+
`pw build` lints each edition it builds. A problem a rule reports as an
|
|
29
|
+
error fails `pw build` (the files are still written, to look at) and `pw lint`. Every problem points at the source, with the rule’s name. A
|
|
30
|
+
reference to a label nothing has:
|
|
31
|
+
|
|
32
|
+
{project=levels}
|
|
33
|
+
``` djot
|
|
34
|
+
As [](#conclusion) shows, the rest follows.
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
{project=levels output="pw lint"}
|
|
38
|
+
``` text
|
|
39
|
+
chapters/02-writing.dj:18:4: error: unknown label conclusion [unknown-label]
|
|
40
|
+
|
|
|
41
|
+
16 | _pw build_, check it with _pw lint_ and test it with _pw test_.
|
|
42
|
+
17 |
|
|
43
|
+
18 | As [](#conclusion) shows, the rest follows.
|
|
44
|
+
| ^^^^^^^^^^^^^^^
|
|
45
|
+
fix: label a block or span {#conclusion}, or check the spelling
|
|
46
|
+
|
|
47
|
+
1 error
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
In the browser app and `pw dev`
|
|
51
|
+
([Watching as you write](#watching-as-you-write)), the same problems are
|
|
52
|
+
listed as you type, each underlined in the source with its message, and a
|
|
53
|
+
`source` rule’s fix is a click away, as `pw lint --fix` applies it.
|
|
54
|
+
|
|
55
|
+
{#the-rules}
|
|
56
|
+
## The rules
|
|
57
|
+
|
|
58
|
+
The rules marked _fix_ can correct what they report, with `pw lint --fix`.
|
|
59
|
+
|
|
60
|
+
| Rule | Level | Reports |
|
|
61
|
+
|----|----|----|
|
|
62
|
+
| `unknown-label` | source | A cross-reference to a label that doesn’t exist |
|
|
63
|
+
| `unplaced-index` | source | An index with terms but no `::: index` block to print it |
|
|
64
|
+
| `unknown-citation` | source | A citation of a key that isn’t in the bibliography |
|
|
65
|
+
| `unused-entry` | source | A bibliography entry nothing cites (option `ignore`: keys to keep) |
|
|
66
|
+
| `missing-field` | source | An entry without a field its citations print (option `fields`) |
|
|
67
|
+
| `citation-in-heading` | source | A citation in a heading, under a note style |
|
|
68
|
+
| `straight-quotes` | source | A straight quote Djot didn’t curl, such as an escaped `\"` (_fix_) |
|
|
69
|
+
| `raw-html` | source | A raw HTML block or span |
|
|
70
|
+
| `profile` | source | Djot the pulpweaver profile doesn’t understand: errors, and warnings for an unknown class or symbol |
|
|
71
|
+
| `image-alt` | html | An image without alt text |
|
|
72
|
+
| `heading-levels` | html | A skipped heading level |
|
|
73
|
+
| `empty-link` | html | A link with no text |
|
|
74
|
+
| `fonts` | html | A character no font of the project covers |
|
|
75
|
+
| `generated-text` | html | Text from CSS (`::before`, counters), which a PDF can’t carry |
|
|
76
|
+
| `unpaintable` | html | CSS a PDF can’t show: 3D transforms, `backdrop-filter`, a clip, mask or filter around an SVG’s `<foreignObject>`, ... |
|
|
77
|
+
| `svg-use-css` | html | CSS styling the inside of an SVG `<use>` |
|
|
78
|
+
| `overfull-line` | layout | A line wider than its measure |
|
|
79
|
+
| `underfull-line` | layout | A line looser than a badness (option `badness`, 1000) |
|
|
80
|
+
| `widow` | layout | A paragraph’s last line alone at the top of a page (option `min`, 2) |
|
|
81
|
+
| `orphan` | layout | Its first line alone at the foot of a page (option `min`, 2) |
|
|
82
|
+
| `consecutive-hyphens` | layout | More hyphenated lines in a row than `max` (2) |
|
|
83
|
+
| `chapter-verso` | layout | A chapter that opens on a left-hand page (option `selector`) |
|
|
84
|
+
| `figure-distance` | layout | A figure more than `pages` (1) from its first reference |
|
|
85
|
+
| `blank-page` | layout | A blank page (option `sided`) |
|
|
86
|
+
| `image-resolution` | layout | An image under `min` (300) dpi as printed |
|
|
87
|
+
| `signature` | layout | A page count that isn’t a multiple of the booklet’s `pages` |
|
|
88
|
+
| `black-text` | layout | Text that isn’t black ink alone, in a CMYK edition |
|
|
89
|
+
| `ink-limit` | layout | Total ink over the printing condition’s limit (option `max`) |
|
|
90
|
+
| `ibid-across-page` | layout | An ibid. whose source is on another page |
|
|
91
|
+
|
|
92
|
+
The [lint rules reference](https://pulpweaver.inkylabs.com/reference/lint-rules) has each rule’s options
|
|
93
|
+
and examples.
|
|
94
|
+
|
|
95
|
+
{#configuring-them}
|
|
96
|
+
## Configuring them
|
|
97
|
+
|
|
98
|
+
`[lint]` in `pulpweaver4.toml` turns rules on, from presets and one by one:
|
|
99
|
+
|
|
100
|
+
{project=config}
|
|
101
|
+
``` toml
|
|
102
|
+
[lint]
|
|
103
|
+
extends = ["recommended"]
|
|
104
|
+
rules = { "widow" = "error", "consecutive-hyphens" = ["warn", { max = 3 }] }
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
- *A rule’s level* is `"off"`, `"warn"`, `"error"`, or `"on"`, the rule’s
|
|
108
|
+
own (some are errors in print and warnings on the web, and some, such as
|
|
109
|
+
`profile`, give each problem its own level). `"warn"` or `"error"` sets
|
|
110
|
+
every problem the rule reports to that level.
|
|
111
|
+
- *Options* go with the level in an array: `["warn", { max = 3 }]`.
|
|
112
|
+
- *A plugin’s rule* is named `<plugin>/<rule>`; quote it in TOML, as any
|
|
113
|
+
key with a `/`: `"house-style/spelling" = "error"`.
|
|
114
|
+
|
|
115
|
+
{#presets}
|
|
116
|
+
### Presets
|
|
117
|
+
|
|
118
|
+
| Preset | Turns on |
|
|
119
|
+
|----|----|
|
|
120
|
+
| `recommended` | The source rules, the HTML rules, `overfull-line` and `ink-limit`: what any book wants. `pw new` extends it |
|
|
121
|
+
| `print-ready` | For a book going to press: widows and orphans as errors, `underfull-line`, `consecutive-hyphens` (3), `chapter-verso`, `figure-distance`, `blank-page`, `image-resolution`, `signature`, `ibid-across-page` |
|
|
122
|
+
| `pdf-x` | For PDF/X: `black-text`, `ink-limit`, `image-resolution` as an error, `fonts` and `unpaintable` |
|
|
123
|
+
| `epub` | For an EPUB: alt text, heading levels, empty links, fonts |
|
|
124
|
+
|
|
125
|
+
With no `[lint]` at all, no preset applies and no rule runs: a project
|
|
126
|
+
turns rules on by extending a preset, as `pw new`’s does.
|
|
127
|
+
|
|
128
|
+
A plugin’s own `recommended` comes with the core’s: a project (or an
|
|
129
|
+
edition) whose presets reach `recommended`, directly or through a preset
|
|
130
|
+
that extends it, also extends `<plugin>/recommended` for each plugin in
|
|
131
|
+
`[plugins]` that has one, without naming it. So a plugin’s rules are on
|
|
132
|
+
wherever the core’s recommended ones are, and installing a plugin is enough
|
|
133
|
+
to have them. Your `rules` still decide over them, so a rule of a plugin’s
|
|
134
|
+
you don’t want is turned off there, as any rule is
|
|
135
|
+
([an example](#writing-your-own)).
|
|
136
|
+
|
|
137
|
+
Unlike ESLint’s, presets have no order. If two presets set a rule
|
|
138
|
+
differently, neither wins: the build says so, and leaves the rule off until
|
|
139
|
+
your `rules` decides. Here a [plugin](#writing-your-own)’s preset,
|
|
140
|
+
`house-style/strict`, makes `overfull-line` an error, and `recommended` a
|
|
141
|
+
warning:
|
|
142
|
+
|
|
143
|
+
{.untested}
|
|
144
|
+
``` text
|
|
145
|
+
pulpweaver4.toml:23:12: error: the presets house-style/strict and recommended set the rule overfull-line differently ("error" and "warn"), and presets have no order [lint-preset-conflict]
|
|
146
|
+
|
|
|
147
|
+
21 |
|
|
148
|
+
22 | [lint]
|
|
149
|
+
23 | extends = ["recommended", "house-style/strict"]
|
|
150
|
+
| ^^^^^^^^^^^^^
|
|
151
|
+
fix: decide in lint.rules: overfull-line = "error"
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
A plugin’s `recommended` is one more preset in that set, so where it sets a
|
|
155
|
+
rule differently from a core preset you extend, the build says so in the same
|
|
156
|
+
way, adds that it came with `recommended`, and leaves the rule off until your
|
|
157
|
+
`rules` decides. A plugin’s `recommended` should agree with every core
|
|
158
|
+
preset; one that doesn’t is the plugin’s to put right, and the fix says to
|
|
159
|
+
tell it.
|
|
160
|
+
|
|
161
|
+
{#per-edition}
|
|
162
|
+
### Per edition
|
|
163
|
+
|
|
164
|
+
An edition can add presets, or a whole `lint` table of its own, over the
|
|
165
|
+
project’s:
|
|
166
|
+
|
|
167
|
+
{project=config}
|
|
168
|
+
``` toml
|
|
169
|
+
[editions.paperback]
|
|
170
|
+
media = "print"
|
|
171
|
+
page = "5.5in 8.5in"
|
|
172
|
+
lint = ["print-ready"]
|
|
173
|
+
|
|
174
|
+
[editions.offset]
|
|
175
|
+
media = "print"
|
|
176
|
+
page = "5.5in 8.5in"
|
|
177
|
+
|
|
178
|
+
[editions.offset.lint]
|
|
179
|
+
extends = ["print-ready", "pdf-x"]
|
|
180
|
+
rules = { "image-resolution" = "warn" }
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
The edition’s settings go over the project’s. `pw lint --edition offset`
|
|
184
|
+
lints as that edition sets them, building it for its `html` and `layout`
|
|
185
|
+
rules; without `--edition`, `pw lint` uses the first edition’s.
|
|
186
|
+
|
|
187
|
+
{#turning-a-rule-off-in-one-place}
|
|
188
|
+
### Turning a rule off in one place
|
|
189
|
+
|
|
190
|
+
`lint-disable` on a block or span turns rules off inside it, by name,
|
|
191
|
+
separated by spaces or commas, or all of them with `""`:
|
|
192
|
+
|
|
193
|
+
{project=config}
|
|
194
|
+
``` djot
|
|
195
|
+
{lint-disable="widow orphan"}
|
|
196
|
+
A paragraph the press has agreed may break as it likes.
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
{#writing-your-own}
|
|
200
|
+
## Writing your own
|
|
201
|
+
|
|
202
|
+
A press’s rules are a [plugin](#plugins)’s: the rule is an object
|
|
203
|
+
with a name, a level and a `check` function, and the plugin lists it in
|
|
204
|
+
`lint`. Each is named after the plugin, `house-style/no-todo` say, so rules
|
|
205
|
+
from different plugins can’t collide.
|
|
206
|
+
|
|
207
|
+
{project=house file="plugins/house-style.js"}
|
|
208
|
+
``` js
|
|
209
|
+
// plugins/house-style.js
|
|
210
|
+
const noTodo = {
|
|
211
|
+
name: 'no-todo',
|
|
212
|
+
level: 'source',
|
|
213
|
+
description: 'No TODO left in the text.',
|
|
214
|
+
severity: 'error',
|
|
215
|
+
fixable: false,
|
|
216
|
+
check({ ast, report }) {
|
|
217
|
+
for (const text of ast.select('text')) {
|
|
218
|
+
if (text.text.includes('TODO')) report(text, 'a TODO is left in the text')
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const shortChapter = {
|
|
224
|
+
name: 'short-chapter',
|
|
225
|
+
level: 'layout',
|
|
226
|
+
description: 'A chapter fills at least a page.',
|
|
227
|
+
options: {
|
|
228
|
+
type: 'object',
|
|
229
|
+
additionalProperties: false,
|
|
230
|
+
properties: { pages: { type: 'integer', minimum: 1 } },
|
|
231
|
+
},
|
|
232
|
+
check({ ast, pages, options, report }) {
|
|
233
|
+
const min = options.pages ?? 2
|
|
234
|
+
for (const chapter of ast.select('document > section')) {
|
|
235
|
+
if (pages.of(chapter).length < min) report(chapter, `this chapter is shorter than ${min} pages`)
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export default {
|
|
241
|
+
name: 'house-style',
|
|
242
|
+
api: 1,
|
|
243
|
+
lint: {
|
|
244
|
+
rules: [noTodo, shortChapter],
|
|
245
|
+
presets: { recommended: { rules: { 'house-style/no-todo': 'error', 'house-style/short-chapter': ['warn', { pages: 2 }] } } },
|
|
246
|
+
},
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
and in `pulpweaver4.toml`:
|
|
251
|
+
|
|
252
|
+
{project=house}
|
|
253
|
+
``` toml
|
|
254
|
+
[plugins]
|
|
255
|
+
"./plugins/house-style.js" = {}
|
|
256
|
+
|
|
257
|
+
[lint]
|
|
258
|
+
extends = ["recommended"]
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
Its preset is named `recommended`, so the core’s `recommended` brings it
|
|
262
|
+
([Presets](#presets)): the project names no preset of the
|
|
263
|
+
plugin’s, and `pw build` finds the starter’s chapters short:
|
|
264
|
+
|
|
265
|
+
{project=house output="pw build"}
|
|
266
|
+
``` text
|
|
267
|
+
chapters/01-beginning.dj:2:1: warning: this chapter is shorter than 2 pages [house-style/short-chapter] [paperback, letter]
|
|
268
|
+
|
|
|
269
|
+
1 | {#beginning}
|
|
270
|
+
2 | # The Beginning
|
|
271
|
+
| ^^^^^^^^^^^^^^^
|
|
272
|
+
...
|
|
273
|
+
2 warnings
|
|
274
|
+
pw build: web: dist/web/ (6 files)
|
|
275
|
+
pw build: paperback: dist/paperback/paperback.pdf
|
|
276
|
+
pw build: letter: dist/letter/letter.pdf
|
|
277
|
+
pw build: text: dist/text/book.txt
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
`pw lint` reports the same, and a TODO left in the text fails both. Your
|
|
281
|
+
own `rules` decide over a plugin’s `recommended`, as over any preset: a
|
|
282
|
+
project that keeps its TODOs for now turns that rule off,
|
|
283
|
+
|
|
284
|
+
{project=house}
|
|
285
|
+
``` toml
|
|
286
|
+
[lint]
|
|
287
|
+
extends = ["recommended"]
|
|
288
|
+
rules = { "house-style/no-todo" = "off" }
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
and the rest of the plugin’s preset still holds. `pw lint` loads the project’s plugins as `pw build` does, from the project, npm
|
|
292
|
+
or a URL, so a rule’s plugin can import `pulpweaver4`.
|
|
293
|
+
|
|
294
|
+
What `check` is given depends on its level:
|
|
295
|
+
|
|
296
|
+
- *`ast`*, the document, at every level: `ast.select(selector)` finds
|
|
297
|
+
nodes, with the selectors of [tests](#testing-the-document), and
|
|
298
|
+
`ast.select(selector, node)` within a node.
|
|
299
|
+
- *`html`*, the rendered HTML’s root element, at the `html` and `layout`
|
|
300
|
+
levels.
|
|
301
|
+
- *`pages`*, at the `layout` level: `pages.of(node)` is the pages a node
|
|
302
|
+
is on, and each page has its `number`, `side`, `lines` and the rest, as in
|
|
303
|
+
tests.
|
|
304
|
+
- *`options`*, as the project set them, checked against the rule’s
|
|
305
|
+
`options` schema; a rule without one takes none.
|
|
306
|
+
- *`edition`*: its name, `media`, colour and standards.
|
|
307
|
+
- *`report(at, message, fix)`*, where `at` is a node, an element of the
|
|
308
|
+
HTML or the pages, or a CSS selector, and pulpweaver4 finds its place in
|
|
309
|
+
the source. `fix` is a hint in words, or for a `source` rule
|
|
310
|
+
`{ edits: [{ position, text }] }`, which `pw lint --fix` applies.
|
|
311
|
+
|
|
312
|
+
A rule that throws doesn’t stop the others: the build names the plugin and
|
|
313
|
+
goes on.
|
|
314
|
+
|
|
315
|
+
A layout rule only reports. Its fix is usually a rewording or a penalty that
|
|
316
|
+
a person chooses, so pulpweaver4 doesn’t guess.
|
|
317
|
+
|
|
318
|
+
{#lint-in-a-test}
|
|
319
|
+
## Lint in a test
|
|
320
|
+
|
|
321
|
+
`build()` in a [test](#testing) runs the edition’s rules too, as `pw build`
|
|
322
|
+
does, every level its settings turn on. Their problems are in
|
|
323
|
+
`book.problems`, each with its rule’s name as `rule`, so a test can check
|
|
324
|
+
what a rule finds in this book:
|
|
325
|
+
|
|
326
|
+
{project=house file="tests/house.test.ts"}
|
|
327
|
+
``` ts
|
|
328
|
+
import { build } from 'pulpweaver4/test'
|
|
329
|
+
|
|
330
|
+
const book = await build({ edition: 'paperback' })
|
|
331
|
+
|
|
332
|
+
test('the house rules find the first chapter short', () => {
|
|
333
|
+
expect(book.problems).toContainEqual(expect.objectContaining({
|
|
334
|
+
rule: 'house-style/short-chapter',
|
|
335
|
+
file: 'chapters/01-beginning.dj',
|
|
336
|
+
}))
|
|
337
|
+
})
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
{project=house}
|
|
341
|
+
``` sh
|
|
342
|
+
pw test
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
{project=house .output}
|
|
346
|
+
``` text
|
|
347
|
+
...
|
|
348
|
+
Test Files 2 passed (2)
|
|
349
|
+
Tests 4 passed (4)
|
|
350
|
+
...
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
An error a rule reports fails `build()`, as it fails `pw build`;
|
|
354
|
+
`build({ errors: 'keep' })` returns the book with it, and
|
|
355
|
+
`build({ lint: false })` leaves the rules out.
|