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,681 @@
|
|
|
1
|
+
``` =meta
|
|
2
|
+
description = 'How pulpweaver4 breaks paragraphs into lines and lines into pages with TeX’s algorithms, and the CSS that tunes them — tolerance, hyphenation, leaders, widows, breaks, code, footnotes, floats, text around floats and minipages.'
|
|
3
|
+
```
|
|
4
|
+
|
|
5
|
+
{#lines-and-pages}
|
|
6
|
+
# Lines and pages
|
|
7
|
+
|
|
8
|
+
In a print edition, pulpweaver4 lays out lines and pages itself, with TeX’s
|
|
9
|
+
algorithms, while the browser styles the text and lays out everything else
|
|
10
|
+
(tables, images, math). The engine turns the styled document into TeX’s
|
|
11
|
+
lists of boxes, glue and penalties, breaks each paragraph into lines with
|
|
12
|
+
the Knuth--Plass algorithm, and fills pages with TeX’s page builder. You tune
|
|
13
|
+
both from the stylesheet, with ordinary CSS where CSS has a word for it and
|
|
14
|
+
custom properties named after TeX’s parameters where it doesn’t.
|
|
15
|
+
|
|
16
|
+
Everything here is about print editions. A web edition is laid out by the
|
|
17
|
+
browser, with Knuth--Plass justification if you ask for it ([below](#on-the-web)).
|
|
18
|
+
|
|
19
|
+
{#lines-and-pages-lines}
|
|
20
|
+
## Lines
|
|
21
|
+
|
|
22
|
+
TeX’s line breaker chooses all the breaks of a paragraph together. Each
|
|
23
|
+
possible line gets a _badness_ from how far its spaces must stretch or
|
|
24
|
+
shrink, each break a _penalty_, and the breaker picks the set of lines with
|
|
25
|
+
the fewest _demerits_ over the whole paragraph, so that no line is much
|
|
26
|
+
looser than its neighbours. A browser fills each line greedily instead, as
|
|
27
|
+
full as it will go, which is why justified text on the web gets rivers.
|
|
28
|
+
|
|
29
|
+
{data-example=justified}
|
|
30
|
+
::: live-example
|
|
31
|
+
_Live example: Justified text_, a paragraph justified by the Knuth–Plass breaker, hyphenated where it must be. On the site, at
|
|
32
|
+
<https://pulpweaver.inkylabs.com/guides/lines-and-pages>, it is a small project you can edit, and
|
|
33
|
+
pulpweaver4 sets its pages again in your browser as you type.
|
|
34
|
+
:::
|
|
35
|
+
|
|
36
|
+
{#texs-parameters}
|
|
37
|
+
### TeX’s parameters
|
|
38
|
+
|
|
39
|
+
The breaker’s parameters are custom properties with TeX’s names and
|
|
40
|
+
defaults. Set them on `:root` for the book, on an element for its
|
|
41
|
+
paragraphs, or in a media query for one edition:
|
|
42
|
+
|
|
43
|
+
| Property | TeX | Default |
|
|
44
|
+
|----|----|----|
|
|
45
|
+
| `--pw-tolerance` | `\tolerance` | `200` |
|
|
46
|
+
| `--pw-pretolerance` | `\pretolerance` | `100` |
|
|
47
|
+
| `--pw-emergency-stretch` | `\emergencystretch` | `0` |
|
|
48
|
+
| `--pw-looseness` | `\looseness` | `0` |
|
|
49
|
+
| `--pw-line-penalty` | `\linepenalty` | `10` |
|
|
50
|
+
| `--pw-hyphen-penalty` | `\hyphenpenalty` | `50` |
|
|
51
|
+
| `--pw-ex-hyphen-penalty` | `\exhyphenpenalty` | `50` |
|
|
52
|
+
| `--pw-adj-demerits` | `\adjdemerits` | `10000` |
|
|
53
|
+
| `--pw-double-hyphen-demerits` | `\doublehyphendemerits` | `10000` |
|
|
54
|
+
| `--pw-final-hyphen-demerits` | `\finalhyphendemerits` | `5000` |
|
|
55
|
+
|
|
56
|
+
As in TeX, the breaker first tries the paragraph without hyphenating, at
|
|
57
|
+
`--pw-pretolerance`; if that fails, it hyphenates and tries again at
|
|
58
|
+
`--pw-tolerance`; if that fails too, it adds `--pw-emergency-stretch` to
|
|
59
|
+
every line’s stretch for a last pass. `--pw-pretolerance: -1` skips the
|
|
60
|
+
first pass.
|
|
61
|
+
|
|
62
|
+
{project=lines}
|
|
63
|
+
``` css
|
|
64
|
+
/* A narrow column: allow looser lines, and stretch in an emergency. */
|
|
65
|
+
@media (--paperback) {
|
|
66
|
+
:root {
|
|
67
|
+
--pw-tolerance: 400;
|
|
68
|
+
--pw-emergency-stretch: 1em;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
{#spaces}
|
|
74
|
+
### Spaces
|
|
75
|
+
|
|
76
|
+
The space between words is `--pw-word-space`, a length that can stretch and
|
|
77
|
+
shrink, in TeX’s notation: `0.333em plus 0.167em minus 0.111em` by default.
|
|
78
|
+
`--pw-xspace` is the space after a sentence. It is unset, so a sentence ends
|
|
79
|
+
with a word space, as TeX’s `\frenchspacing` and modern typesetting have it;
|
|
80
|
+
set it to a glue, `0.444em plus 0.5em minus 0.037em`, for wider spaces
|
|
81
|
+
there.
|
|
82
|
+
|
|
83
|
+
{#hyphenation}
|
|
84
|
+
### Hyphenation
|
|
85
|
+
|
|
86
|
+
CSS’s `hyphens` says where a word may break, as it does in a browser:
|
|
87
|
+
|
|
88
|
+
- *`hyphens: auto`* hyphenates with TeX’s patterns for the text’s
|
|
89
|
+
language, the book’s `language` or an element’s `lang`, wherever the line
|
|
90
|
+
breaker wants to. The starter sets it on `:root`, so the text, its notes
|
|
91
|
+
and its captions are hyphenated.
|
|
92
|
+
- *`hyphens: manual`*, CSS’s initial value, breaks a word only at a soft
|
|
93
|
+
hyphen in it (U+00AD, typed as the character) or after a hyphen. The
|
|
94
|
+
starter’s headings are `manual`.
|
|
95
|
+
- *`hyphens: none`* never breaks a word, soft hyphens included.
|
|
96
|
+
|
|
97
|
+
{project=lines}
|
|
98
|
+
``` css
|
|
99
|
+
:root { hyphens: auto; }
|
|
100
|
+
h1, h2, .title { hyphens: none; }
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
For a word the patterns break wrongly, or a name they don’t know, put it in
|
|
104
|
+
`hyphenation.txt` in the project’s folder, as TeX’s `\hyphenation` writes
|
|
105
|
+
it: a hyphen wherever it may break, and a word with none never breaks.
|
|
106
|
+
`%` starts a comment, and a line `[<language>]` makes the words after it
|
|
107
|
+
that language’s alone:
|
|
108
|
+
|
|
109
|
+
{project=lines file="hyphenation.txt"}
|
|
110
|
+
``` text
|
|
111
|
+
% Words the patterns break wrongly: "man-uscript", "pulp-wea-ver".
|
|
112
|
+
manu-script pulp-weaver
|
|
113
|
+
[en-GB]
|
|
114
|
+
pro-gramme
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Every build reads it afresh, in every edition, and a web edition copies it
|
|
118
|
+
for its justification script. A malformed word is an error at its place in
|
|
119
|
+
the file.
|
|
120
|
+
|
|
121
|
+
`--pw-left-hyphen-min` and `--pw-right-hyphen-min` are TeX’s
|
|
122
|
+
`\lefthyphenmin` and `\righthyphenmin`: the fewest letters before and after a
|
|
123
|
+
hyphen. The language decides them unless you do (2 and 3 for English).
|
|
124
|
+
|
|
125
|
+
Patterns come for 63 languages, from TeX’s hyph-utf8, all but those under
|
|
126
|
+
licences pulpweaver4 can’t ship.
|
|
127
|
+
|
|
128
|
+
{#the-browsers-lines}
|
|
129
|
+
### The browser’s lines
|
|
130
|
+
|
|
131
|
+
`--pw-line-breaking: browser` gives a paragraph the browser’s lines, filled
|
|
132
|
+
one at a time, instead of the engine’s, in print as on the web: the engine
|
|
133
|
+
reads back where the browser broke it and sets those lines, at TeX’s
|
|
134
|
+
hyphenation points, so they are the same in every browser. It suits text
|
|
135
|
+
whose breaks should match a web page’s, or a ragged paragraph where
|
|
136
|
+
Knuth--Plass gains nothing.
|
|
137
|
+
|
|
138
|
+
{project=lines}
|
|
139
|
+
``` css
|
|
140
|
+
.sidebar p { --pw-line-breaking: browser; }
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
A [plugin](#line-breakers) can bring a line breaker of its
|
|
144
|
+
own, for an element or a language.
|
|
145
|
+
|
|
146
|
+
{#justified-ragged}
|
|
147
|
+
### Justified, ragged
|
|
148
|
+
|
|
149
|
+
`text-align: justify` justifies; `text-align: left` (or `start`) sets the
|
|
150
|
+
lines ragged, broken by the same algorithm, so the right edge has no
|
|
151
|
+
stragglers. `right` (or `end`) and `center` set them flush right and
|
|
152
|
+
centred, as the browser shows them.
|
|
153
|
+
|
|
154
|
+
{#microtypography}
|
|
155
|
+
### Microtypography
|
|
156
|
+
|
|
157
|
+
`--pw-protrusion` and `--pw-expansion` are pdfTeX’s margin kerning and font
|
|
158
|
+
expansion, as `microtype` sets them. Both are off by default, so lines
|
|
159
|
+
break as TeX’s do:
|
|
160
|
+
|
|
161
|
+
{project=lines}
|
|
162
|
+
``` css
|
|
163
|
+
@media print {
|
|
164
|
+
:root { --pw-protrusion: 1; --pw-expansion: 20; }
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
`--pw-protrusion: 1` hangs a period, a comma, a hyphen or a quotation mark
|
|
169
|
+
at a line’s edge into the margin by a fraction of its own width, so the
|
|
170
|
+
edge looks straight; letters don’t hang, and another number scales the
|
|
171
|
+
hang. `--pw-expansion` lets each line’s glyphs widen or narrow by up to
|
|
172
|
+
that many thousandths of their width, 20 being 2% either way: an extra
|
|
173
|
+
stretch and shrink, which the breaker uses to keep lines from going loose.
|
|
174
|
+
A face with a `wdth` axis is widened along it; a line whose faces have
|
|
175
|
+
none is tracked with `letter-spacing` instead. The breaker counts both,
|
|
176
|
+
and the preview and the PDF set each line as it was broken. The example
|
|
177
|
+
book’s 5.5 × 8.5 in editions use them, and have fewer loose lines for it.
|
|
178
|
+
|
|
179
|
+
{#leaders}
|
|
180
|
+
### Leaders
|
|
181
|
+
|
|
182
|
+
`--pw-leader` makes an inline element a _leader_, as TeX’s
|
|
183
|
+
`\leaders\hbox{.}\hfill`: it stretches to fill the rest of its line with
|
|
184
|
+
copies of its string, set at whole multiples of the string’s width from the
|
|
185
|
+
paragraph’s edge, so the dots of every line line up. `--pw-leader-space` is
|
|
186
|
+
the space either side of each copy, LaTeX’s 4.5mu by default, and
|
|
187
|
+
`--pw-leader: none` fills the line with blank space. A table of contents’
|
|
188
|
+
entries have one between each title and its page; a price list can have
|
|
189
|
+
them too:
|
|
190
|
+
|
|
191
|
+
{project=lines}
|
|
192
|
+
``` djot
|
|
193
|
+
{.price}
|
|
194
|
+
Paperback [ ]{.dots} $12
|
|
195
|
+
|
|
196
|
+
{.price}
|
|
197
|
+
Letter edition [ ]{.dots} free
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
{project=lines}
|
|
201
|
+
``` css
|
|
202
|
+
.dots { --pw-leader: "."; }
|
|
203
|
+
p.price { text-align: left; }
|
|
204
|
+
p + p.price { text-indent: 0; } /* over the starter's indent */
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
A line never breaks just before or after a leader. Leaders are print’s: a
|
|
208
|
+
web edition shows the element as it is.
|
|
209
|
+
|
|
210
|
+
{#overfull-lines}
|
|
211
|
+
### Overfull lines
|
|
212
|
+
|
|
213
|
+
When no set of breaks fits, TeX sets an overfull line, wider than the
|
|
214
|
+
measure, and so does pulpweaver4. The build doesn’t stop: it warns, with
|
|
215
|
+
where the line is. A paragraph with a long URL in it, say:
|
|
216
|
+
|
|
217
|
+
{project=overfull}
|
|
218
|
+
``` djot
|
|
219
|
+
Some words no line can hold: a reference such as https://gitlab.com/inkylabs/pulpweaver4/-/issues/new?issuable_template=bug never breaks.
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
{project=overfull output="pw build --edition paperback"}
|
|
223
|
+
``` text
|
|
224
|
+
chapters/02-writing.dj:18:1: warning: a line on page 3 is 14.2pt too wide: “/inkylabs/pulpweaver4/-/issues/new?issua…” [overfull-line]
|
|
225
|
+
|
|
|
226
|
+
16 | _pw build_, check it with _pw lint_ and test it with _pw test_.
|
|
227
|
+
17 |
|
|
228
|
+
18 | Some words no line can hold: a reference such as https://gitlab.com/inkylabs/pulpweaver4/-/issues/new?issuable_template=bug never breaks.
|
|
229
|
+
...
|
|
230
|
+
fix: reword it, allow a hyphenation the breaker can use ([super\-cali]), or give the paragraph --pw-emergency-stretch or a higher --pw-tolerance
|
|
231
|
+
|
|
232
|
+
1 warning
|
|
233
|
+
pw build: paperback: dist/paperback/paperback.pdf
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Rewording the paragraph is the best cure; a little
|
|
237
|
+
`--pw-emergency-stretch`, or a higher `--pw-tolerance`, are the others.
|
|
238
|
+
`underfull-line` warns of lines looser than a badness of 1000, if you turn
|
|
239
|
+
it on (it is in the `print-ready` preset).
|
|
240
|
+
|
|
241
|
+
{#lines-and-pages-pages}
|
|
242
|
+
## Pages
|
|
243
|
+
|
|
244
|
+
The page builder is TeX’s: it adds lines to a page until the page is full,
|
|
245
|
+
choosing where to break by the badness of the page and the penalty of the
|
|
246
|
+
break, and places footnotes and floats as it goes.
|
|
247
|
+
|
|
248
|
+
{#the-page}
|
|
249
|
+
### The page
|
|
250
|
+
|
|
251
|
+
A print edition’s page size is its `page` in `pulpweaver4.toml`: a width and
|
|
252
|
+
a height (`"5.5in 8.5in"`, `"148mm 210mm"`), or a name, `letter`, `legal`,
|
|
253
|
+
`ledger`, `A3` to `A7`, `B4` to `B6`, `JIS-B4` to `JIS-B6`, with
|
|
254
|
+
`landscape` if you want it.
|
|
255
|
+
|
|
256
|
+
`@page` rules style the pages, as CSS Paged Media has them: their margins,
|
|
257
|
+
which leave the text area, their `size` (which overrides the edition’s
|
|
258
|
+
`page`), their background and their margin boxes. A rule can be for every
|
|
259
|
+
page, or for `:first`, `:left`, `:right`, `:blank` (a page a sided break
|
|
260
|
+
leaves empty) or a named page, and they cascade as CSS’s rules do. Without
|
|
261
|
+
one, a page’s margins are 0.75 in at the top, 0.58 in at each side and
|
|
262
|
+
0.83 in at the foot.
|
|
263
|
+
|
|
264
|
+
{project=page}
|
|
265
|
+
``` css
|
|
266
|
+
@media print {
|
|
267
|
+
@page { margin: 0.75in 0.6in 0.9in; }
|
|
268
|
+
@page :left { margin-right: 0.8in; } /* a wider inner margin */
|
|
269
|
+
@page :right { margin-left: 0.8in; }
|
|
270
|
+
}
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
{#running-heads-and-folios}
|
|
274
|
+
### Running heads and folios
|
|
275
|
+
|
|
276
|
+
The sixteen margin boxes, `@top-left` round to `@left-top`, print what their
|
|
277
|
+
`content` says: text, `counter(page)` and `counter(pages)`,
|
|
278
|
+
`string(name)`, a string an element’s text set with `string-set`, and
|
|
279
|
+
`element(name)`, an element that `position: running(name)` took out of the
|
|
280
|
+
text. The starter project’s stylesheet already puts the chapter’s title at
|
|
281
|
+
the head of each page but the one it opens, and the folio at the outside of
|
|
282
|
+
the foot:
|
|
283
|
+
|
|
284
|
+
{project=page}
|
|
285
|
+
``` css
|
|
286
|
+
@media print {
|
|
287
|
+
h1 { string-set: chapter content(); }
|
|
288
|
+
@page {
|
|
289
|
+
@top-center { content: string(chapter, first-except); font-style: italic; }
|
|
290
|
+
}
|
|
291
|
+
@page :left { @bottom-left { content: counter(page); } }
|
|
292
|
+
@page :right { @bottom-right { content: counter(page); } }
|
|
293
|
+
}
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
{data-example=running-head}
|
|
297
|
+
::: live-example
|
|
298
|
+
_Live example: A running head_, the chapter’s title at the head of its pages. On the site, at
|
|
299
|
+
<https://pulpweaver.inkylabs.com/guides/lines-and-pages>, it is a small project you can edit, and
|
|
300
|
+
pulpweaver4 sets its pages again in your browser as you type.
|
|
301
|
+
:::
|
|
302
|
+
|
|
303
|
+
A string or running element’s second argument says which value a page
|
|
304
|
+
shows: `first`, the default, the first set on the page, or else the one in
|
|
305
|
+
force when it began; `start`, the one in force as the page starts; `last`;
|
|
306
|
+
and `first-except`, nothing on a page that sets it, such as a chapter’s
|
|
307
|
+
opening page.
|
|
308
|
+
|
|
309
|
+
{#front-matter}
|
|
310
|
+
### Front matter
|
|
311
|
+
|
|
312
|
+
An element’s `page` puts it on pages of that name, which `@page <name>`
|
|
313
|
+
styles; the page breaks wherever the name changes. `counter(page, <style>)`
|
|
314
|
+
writes the folio in `lower-roman`, `upper-roman`, `lower-alpha` and the
|
|
315
|
+
other counter styles, and `counter-reset: page 1`, on an `@page` rule or an
|
|
316
|
+
element, starts the count again. So a preface numbered in roman, and the
|
|
317
|
+
first chapter on page 1:
|
|
318
|
+
|
|
319
|
+
{project=front file="chapters/00-preface.dj"}
|
|
320
|
+
``` djot
|
|
321
|
+
::: front
|
|
322
|
+
{.unnumbered}
|
|
323
|
+
# Preface
|
|
324
|
+
|
|
325
|
+
The front matter, its pages numbered in roman.
|
|
326
|
+
:::
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
{project=front}
|
|
330
|
+
``` css
|
|
331
|
+
@media print {
|
|
332
|
+
.front { page: front; }
|
|
333
|
+
@page front:left { @bottom-left { content: counter(page, lower-roman); } }
|
|
334
|
+
@page front:right { @bottom-right { content: counter(page, lower-roman); } }
|
|
335
|
+
#beginning { counter-reset: page 1; }
|
|
336
|
+
}
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
The PDF’s page labels follow the folios, so a viewer’s “go to page” finds
|
|
340
|
+
“ii” and “12” as the book prints them; as LaTeX’s `\frontmatter` has
|
|
341
|
+
them, the pages before the first folio are labelled in its style, and a
|
|
342
|
+
blank page in the style of the page before it. `--pw-page-prefix: "A-"` on
|
|
343
|
+
an `@page` rule gives its pages’ labels a prefix.
|
|
344
|
+
|
|
345
|
+
{#breaks}
|
|
346
|
+
### Breaks
|
|
347
|
+
|
|
348
|
+
CSS’s break properties are TeX’s penalties:
|
|
349
|
+
|
|
350
|
+
| CSS | Means |
|
|
351
|
+
|----|----|
|
|
352
|
+
| `break-before: page` | Start a new page |
|
|
353
|
+
| `break-before: right` (or `recto`) | Start a right-hand page, leaving a blank page if needed |
|
|
354
|
+
| `break-before: left` (or `verso`) | Start a left-hand page |
|
|
355
|
+
| `break-after: avoid` | Don’t break after this: the default for headings |
|
|
356
|
+
| `break-inside: avoid` | Keep this whole, as one box: the default for figures |
|
|
357
|
+
| `--pw-penalty-before`, `--pw-penalty-after` | A penalty of your own, from -10000 (break here) to 10000 (never) |
|
|
358
|
+
|
|
359
|
+
The first page is a right-hand page, as in a printed book. A blank page
|
|
360
|
+
that a sided break leaves has the class `pw-blank`.
|
|
361
|
+
|
|
362
|
+
{project=pages}
|
|
363
|
+
``` css
|
|
364
|
+
@media print {
|
|
365
|
+
h1 { break-before: right; } /* chapters open on a recto */
|
|
366
|
+
.stanza { break-inside: avoid; } /* a stanza never splits */
|
|
367
|
+
.epigraph { --pw-penalty-after: 10000; } /* never part an epigraph from what follows */
|
|
368
|
+
}
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
{#widows-and-orphans}
|
|
372
|
+
### Widows and orphans
|
|
373
|
+
|
|
374
|
+
TeX discourages a page that starts with a paragraph’s last line (a widow) or
|
|
375
|
+
ends with its first (an orphan, a _club_ line in TeX) by a penalty, plain
|
|
376
|
+
TeX’s 150 each:
|
|
377
|
+
|
|
378
|
+
| Property | TeX | Default |
|
|
379
|
+
|----|----|----|
|
|
380
|
+
| `--pw-widow-penalty` | `\widowpenalty` | `150` |
|
|
381
|
+
| `--pw-club-penalty` | `\clubpenalty` | `150` |
|
|
382
|
+
| `--pw-broken-penalty` | `\brokenpenalty` (after a hyphenated line) | `100` |
|
|
383
|
+
| `--pw-inter-line-penalty` | `\interlinepenalty` | `0` |
|
|
384
|
+
|
|
385
|
+
CSS’s `widows` and `orphans` say how many lines count: `widows: 3` puts the
|
|
386
|
+
penalty on breaks that leave fewer than three lines at the top of a page.
|
|
387
|
+
|
|
388
|
+
A penalty of 150 often isn’t enough. Lines are rigid, and margins don’t
|
|
389
|
+
stretch, so the page builder has little to trade a widow for, and takes it.
|
|
390
|
+
To forbid widows and orphans outright, make their penalty 10000, as LaTeX
|
|
391
|
+
users often do:
|
|
392
|
+
|
|
393
|
+
{project=pages}
|
|
394
|
+
``` css
|
|
395
|
+
@media print {
|
|
396
|
+
:root {
|
|
397
|
+
--pw-widow-penalty: 10000;
|
|
398
|
+
--pw-club-penalty: 10000;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
The page that loses the line then runs a line short. The `widow` and
|
|
404
|
+
`orphan` lint rules, in the `print-ready` preset, report any that are left.
|
|
405
|
+
|
|
406
|
+
{#lookahead}
|
|
407
|
+
### Lookahead
|
|
408
|
+
|
|
409
|
+
The page builder is TeX’s: it fills one page at a time and breaks it at the
|
|
410
|
+
best place on that page, never looking further. `--pw-page-breaking:
|
|
411
|
+
lookahead` searches the whole flow instead, for the page breaks whose total
|
|
412
|
+
badness is least (Michael Plass’s dynamic program, as Knuth–Plass does for
|
|
413
|
+
lines), and won’t start a page on a paragraph’s last line when another
|
|
414
|
+
legal break exists:
|
|
415
|
+
|
|
416
|
+
{project=pages}
|
|
417
|
+
``` css
|
|
418
|
+
@media print {
|
|
419
|
+
:root { --pw-page-breaking: lookahead; }
|
|
420
|
+
}
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
Footnotes, floats, marks, the penalties above and forced breaks count as
|
|
424
|
+
they do for the page builder, and a page with no legal break at all is
|
|
425
|
+
broken as the page builder would break it.
|
|
426
|
+
|
|
427
|
+
The preview (`pw dev` and the browser app) searches again only near an
|
|
428
|
+
edit: from just before it to the first place after it where the search
|
|
429
|
+
stands as it did, and the pages after that are the last build's. They
|
|
430
|
+
are still the pages a build from nothing makes. Where the edit moves the
|
|
431
|
+
lines after it, as a paragraph added to chapters that run on without a
|
|
432
|
+
page break does, every page may fall differently until the search finds
|
|
433
|
+
the breaks it had before; an edit that leaves its lines as they were makes
|
|
434
|
+
only its own pages again.
|
|
435
|
+
|
|
436
|
+
When that search would keep you waiting, the preview shows approximate
|
|
437
|
+
pages at once: the pages before the edit as they were, the page or two
|
|
438
|
+
after it broken where they fit, and the last build's breaks after that. The
|
|
439
|
+
status says *approximate* while the search goes on, in the moments the
|
|
440
|
+
browser is idle, so typing stays quick; each edit starts it again. When it
|
|
441
|
+
finishes, its pages replace those that differ, a few at a time, each time
|
|
442
|
+
the browser is idle again, so that even a swap of hundreds of pages never
|
|
443
|
+
holds up a key you type. A PDF is only ever written
|
|
444
|
+
from the exact pages: downloading one waits for the search, and `pw build`
|
|
445
|
+
always searches the whole book.
|
|
446
|
+
|
|
447
|
+
{#code-and-other-preformatted-text}
|
|
448
|
+
### Code and other preformatted text
|
|
449
|
+
|
|
450
|
+
A `pre`, or any block whose `white-space` keeps its newlines, breaks across
|
|
451
|
+
pages between its lines, which are the browser’s, with a paragraph’s
|
|
452
|
+
penalties between them: `widows`, `orphans` and their penalties apply. Its
|
|
453
|
+
border and padding stay with its first and last lines, and
|
|
454
|
+
`break-inside: avoid` keeps it whole.
|
|
455
|
+
|
|
456
|
+
A box taller than any page that can’t be broken, such as an image or a
|
|
457
|
+
`pre` kept whole, is set on a page of its own and cut off at the page’s
|
|
458
|
+
foot, and `pw build` warns at its source:
|
|
459
|
+
|
|
460
|
+
{project=tall}
|
|
461
|
+
``` css
|
|
462
|
+
@media print {
|
|
463
|
+
pre { break-inside: avoid; line-height: 72pt; }
|
|
464
|
+
}
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
{project=tall}
|
|
468
|
+
```` djot
|
|
469
|
+
``` one
|
|
470
|
+
two
|
|
471
|
+
three
|
|
472
|
+
four
|
|
473
|
+
five
|
|
474
|
+
six
|
|
475
|
+
seven
|
|
476
|
+
eight
|
|
477
|
+
nine
|
|
478
|
+
ten
|
|
479
|
+
```
|
|
480
|
+
````
|
|
481
|
+
|
|
482
|
+
{project=tall output="pw build --edition paperback"}
|
|
483
|
+
``` text
|
|
484
|
+
chapters/02-writing.dj:18:1: warning: page 4 is 150.0pt overfull: a pre is taller than the page, and is cut off [overfull-page]
|
|
485
|
+
...
|
|
486
|
+
fix: let it break across pages (not break-inside: avoid), split it, or make it smaller
|
|
487
|
+
|
|
488
|
+
1 warning
|
|
489
|
+
pw build: paperback: dist/paperback/paperback.pdf
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
{#vertical-space}
|
|
493
|
+
### Vertical space
|
|
494
|
+
|
|
495
|
+
Margins between blocks work as in CSS, collapsing as they do, and are
|
|
496
|
+
rigid. For space that can stretch and shrink, so pages fill better, give a
|
|
497
|
+
block `--pw-space-before` and `--pw-space-after`, which replace its margins
|
|
498
|
+
with TeX’s glue:
|
|
499
|
+
|
|
500
|
+
{project=pages}
|
|
501
|
+
``` css
|
|
502
|
+
h2 { --pw-space-before: 18pt plus 6pt minus 3pt; --pw-space-after: 6pt; }
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
`--pw-top-skip` and `--pw-max-depth` are TeX’s `\topskip` and `\maxdepth`,
|
|
506
|
+
both 0: a page’s first line starts at the top of the text area, and its last
|
|
507
|
+
line’s descenders stay inside it.
|
|
508
|
+
|
|
509
|
+
{#lines-and-pages-footnotes}
|
|
510
|
+
### Footnotes
|
|
511
|
+
|
|
512
|
+
A footnote goes to the foot of the page where it is called, under a rule.
|
|
513
|
+
If it doesn’t fit, it is split and continued on the next page, as TeX splits
|
|
514
|
+
it.
|
|
515
|
+
|
|
516
|
+
{data-example=footnotes}
|
|
517
|
+
::: live-example
|
|
518
|
+
_Live example: Footnotes_, two footnotes at the foot of the page that calls them. On the site, at
|
|
519
|
+
<https://pulpweaver.inkylabs.com/guides/lines-and-pages>, it is a small project you can edit, and
|
|
520
|
+
pulpweaver4 sets its pages again in your browser as you type.
|
|
521
|
+
:::
|
|
522
|
+
|
|
523
|
+
| Property | TeX | Default |
|
|
524
|
+
|----|----|----|
|
|
525
|
+
| `--pw-footnote-skip` | `\skip\footins` | `12pt plus 4pt minus 4pt` |
|
|
526
|
+
| `--pw-footnote-max-height` | `\dimen\footins` | the whole text area |
|
|
527
|
+
|
|
528
|
+
Style the notes with `.pw-note`, and the rule above them with
|
|
529
|
+
`.pw-footnote-rule`. Any element can be made a footnote with CSS’s
|
|
530
|
+
`float: footnote`.
|
|
531
|
+
|
|
532
|
+
{#floats}
|
|
533
|
+
### Floats
|
|
534
|
+
|
|
535
|
+
`float: top` and `float: bottom` move an element to the top or bottom of the
|
|
536
|
+
page, the next page if this one has no room, as LaTeX’s `[t]` and `[b]`
|
|
537
|
+
placements do:
|
|
538
|
+
|
|
539
|
+
{project=pages}
|
|
540
|
+
``` css
|
|
541
|
+
@media print {
|
|
542
|
+
.plate { float: top; }
|
|
543
|
+
}
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
`--pw-float-skip`, `12pt plus 4pt minus 4pt` by default, is the space between
|
|
547
|
+
a float and the text. A float that is too tall for any page gets a page of
|
|
548
|
+
its own.
|
|
549
|
+
|
|
550
|
+
{#text-around-floats}
|
|
551
|
+
### Text around floats
|
|
552
|
+
|
|
553
|
+
CSS’s own floats, `float: left` and `float: right`, stay where they are, and
|
|
554
|
+
the text flows around them, in print as in the browser: each line beside a
|
|
555
|
+
float is set to the measure it leaves, as TeX’s `\parshape` sets a
|
|
556
|
+
paragraph’s lines (LaTeX’s `wrapfigure`), and Knuth--Plass breaks the
|
|
557
|
+
paragraph to that shape. A float and the lines beside it go to a page
|
|
558
|
+
together, and `clear` moves what follows below it. A pull quote, and a drop
|
|
559
|
+
cap, a floated `::first-letter`:
|
|
560
|
+
|
|
561
|
+
{project=floats}
|
|
562
|
+
``` css
|
|
563
|
+
@media print {
|
|
564
|
+
.pull { float: right; width: 35%; margin: 0 0 6pt 12pt; font-size: 14pt; line-height: 16pt; }
|
|
565
|
+
p.opening::first-letter { float: left; font-size: 40pt; line-height: 34pt; margin-right: 3pt; }
|
|
566
|
+
p.opening { --pw-emergency-stretch: 1em; }
|
|
567
|
+
}
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
{project=floats}
|
|
571
|
+
``` djot
|
|
572
|
+
{.pull}
|
|
573
|
+
::: pull
|
|
574
|
+
Worse and worse, and the pages turned.
|
|
575
|
+
:::
|
|
576
|
+
|
|
577
|
+
{.opening}
|
|
578
|
+
Once upon a time a press set its books by hand, letter by letter,
|
|
579
|
+
and its compositors read the text upside down and backwards as they set it,
|
|
580
|
+
line after line, in a stick.
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
The letter is CSS’s: the block’s first, with any punctuation either side of
|
|
584
|
+
it (a quotation mark too), and it is painted in its own face, size and colour.
|
|
585
|
+
A first letter split across elements that one span can’t hold is the
|
|
586
|
+
`first-letter` layout warning, and
|
|
587
|
+
`initial-letter` isn’t painted yet: it is the `unpaintable` lint error. A
|
|
588
|
+
floated span, `[O]{.drop}nce`, still works where you want a cap that isn’t
|
|
589
|
+
the first letter.
|
|
590
|
+
|
|
591
|
+
{#columns}
|
|
592
|
+
### Columns
|
|
593
|
+
|
|
594
|
+
`columns` (or `column-count`) sets an element’s content in columns, broken
|
|
595
|
+
across pages as LaTeX’s `multicols` breaks them: each page’s columns are
|
|
596
|
+
filled, and the last page’s are balanced.
|
|
597
|
+
|
|
598
|
+
{project=pages}
|
|
599
|
+
``` css
|
|
600
|
+
@media print {
|
|
601
|
+
.glossary { columns: 2; column-gap: 1.5em; }
|
|
602
|
+
.glossary h2 { column-span: all; }
|
|
603
|
+
}
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
`column-span: all` sets an element across the columns, as a heading or a
|
|
607
|
+
figure that should cross them: the columns above it end there, balanced,
|
|
608
|
+
and new ones start below it, as Chromium lays out the same page. Its
|
|
609
|
+
margins don't collapse with the columns' content, only with a spanner's
|
|
610
|
+
next to it. It spans only in the columns' own flow, not inside a box of
|
|
611
|
+
its own there (a float, a minipage, a kept box, nested columns).
|
|
612
|
+
|
|
613
|
+
{#flows}
|
|
614
|
+
### Flows and page templates
|
|
615
|
+
|
|
616
|
+
`flow-into` takes an element out of the main text into a flow of its own,
|
|
617
|
+
as CSS Regions has it, and `@region` rules inside `@page` divide the text
|
|
618
|
+
area into boxes, each filled from a flow with `flow-from`: a page
|
|
619
|
+
template. The main text is the flow `main`. Each flow is broken into pages on its own, with its own
|
|
620
|
+
footnotes and running-head strings, so a page can carry two texts side by
|
|
621
|
+
side or one above the other:
|
|
622
|
+
|
|
623
|
+
{project=flows}
|
|
624
|
+
``` css
|
|
625
|
+
@media print {
|
|
626
|
+
.gloss { flow-into: glosses; }
|
|
627
|
+
@page {
|
|
628
|
+
@region text { flow-from: main; top: 0; left: 0; width: 100%; height: 74%; }
|
|
629
|
+
@region glosses { flow-from: glosses; top: 78%; left: 0; width: 100%; height: 22%; }
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
```
|
|
633
|
+
|
|
634
|
+
{project=flows}
|
|
635
|
+
``` djot
|
|
636
|
+
::: gloss
|
|
637
|
+
_Colophon_: the printer’s note at a book’s end, saying how it was made.
|
|
638
|
+
:::
|
|
639
|
+
```
|
|
640
|
+
|
|
641
|
+
A region is placed in the text area with `top`, `left`, `width` and
|
|
642
|
+
`height` (or `right` and `bottom`); `columns` (or `column-count`) and
|
|
643
|
+
`column-gap` divide it into columns of the same flow, the last page’s
|
|
644
|
+
balanced. `@page :first`, `:left`, `:right` and named pages can give
|
|
645
|
+
their pages other regions, or turn one off with `flow-from: none`.
|
|
646
|
+
`flow-into: glosses content` moves an element’s children without the
|
|
647
|
+
element itself.
|
|
648
|
+
|
|
649
|
+
{#minipages}
|
|
650
|
+
### Minipages
|
|
651
|
+
|
|
652
|
+
`--pw-box: minipage` makes an element a box with its own measure, its lines
|
|
653
|
+
broken inside it and its footnotes at its own foot, as LaTeX’s `minipage`.
|
|
654
|
+
With `--pw-minipage-footnotes: outside`, its notes go to the page’s foot
|
|
655
|
+
instead.
|
|
656
|
+
|
|
657
|
+
{project=pages}
|
|
658
|
+
``` css
|
|
659
|
+
.sidebar {
|
|
660
|
+
--pw-box: minipage;
|
|
661
|
+
width: 60%;
|
|
662
|
+
margin: 12pt auto;
|
|
663
|
+
}
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
{#on-the-web}
|
|
667
|
+
## On the web
|
|
668
|
+
|
|
669
|
+
A web edition is laid out by the browser. Its paragraphs are broken
|
|
670
|
+
greedily, as browsers break them, unless you ask for Knuth--Plass:
|
|
671
|
+
|
|
672
|
+
{project=pages}
|
|
673
|
+
``` css
|
|
674
|
+
@media screen {
|
|
675
|
+
p { text-align: justify; --pw-line-breaking: knuth-plass; }
|
|
676
|
+
}
|
|
677
|
+
```
|
|
678
|
+
|
|
679
|
+
The site then carries a small script, with HarfBuzz and the hyphenation
|
|
680
|
+
patterns, which breaks each justified paragraph again whenever its width
|
|
681
|
+
changes. It does so only for `p` elements that are justified.
|