pulpweaver4 0.0.91 → 0.0.186

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.
Files changed (502) hide show
  1. package/dist/ast/djot.js +23 -0
  2. package/dist/ast/djot.js.map +1 -1
  3. package/dist/ast/index.d.ts +1 -0
  4. package/dist/ast/index.js +1 -0
  5. package/dist/ast/index.js.map +1 -1
  6. package/dist/ast/nodes.d.ts +59 -5
  7. package/dist/ast/nodes.js.map +1 -1
  8. package/dist/ast/table.d.ts +27 -0
  9. package/dist/ast/table.js +32 -0
  10. package/dist/ast/table.js.map +1 -0
  11. package/dist/browser.js +2420 -0
  12. package/dist/citations/index.d.ts +1 -1
  13. package/dist/citations/index.js +1 -1
  14. package/dist/citations/index.js.map +1 -1
  15. package/dist/citations/project.d.ts +12 -2
  16. package/dist/citations/project.js +21 -7
  17. package/dist/citations/project.js.map +1 -1
  18. package/dist/colour/images.d.ts +11 -2
  19. package/dist/colour/images.js +53 -3
  20. package/dist/colour/images.js.map +1 -1
  21. package/dist/colour/ink-limit.d.ts +2 -2
  22. package/dist/colour/ink-limit.js +6 -0
  23. package/dist/colour/ink-limit.js.map +1 -1
  24. package/dist/colour/previews.d.ts +8 -4
  25. package/dist/colour/previews.js +11 -8
  26. package/dist/colour/previews.js.map +1 -1
  27. package/dist/config/config.d.ts +91 -3
  28. package/dist/config/config.js +200 -3
  29. package/dist/config/config.js.map +1 -1
  30. package/dist/config/project-schema.d.ts +0 -8
  31. package/dist/config/project-schema.js +207 -12
  32. package/dist/config/project-schema.js.map +1 -1
  33. package/dist/config/schema.js +10 -0
  34. package/dist/config/schema.js.map +1 -1
  35. package/dist/config/secrets.d.ts +11 -0
  36. package/dist/config/secrets.js +19 -0
  37. package/dist/config/secrets.js.map +1 -0
  38. package/dist/csl/project.d.ts +19 -4
  39. package/dist/csl/project.js +23 -10
  40. package/dist/csl/project.js.map +1 -1
  41. package/dist/fonts/index.d.ts +1 -1
  42. package/dist/fonts/index.js +1 -1
  43. package/dist/fonts/index.js.map +1 -1
  44. package/dist/fonts/lint.d.ts +51 -0
  45. package/dist/fonts/lint.js +101 -16
  46. package/dist/fonts/lint.js.map +1 -1
  47. package/dist/fonts/walk.d.ts +13 -0
  48. package/dist/fonts/walk.js +50 -33
  49. package/dist/fonts/walk.js.map +1 -1
  50. package/dist/html/css.d.ts +4 -0
  51. package/dist/html/css.js +11 -3
  52. package/dist/html/css.js.map +1 -1
  53. package/dist/html/dom.d.ts +6 -1
  54. package/dist/html/dom.js +28 -6
  55. package/dist/html/dom.js.map +1 -1
  56. package/dist/html/generated.d.ts +17 -0
  57. package/dist/html/generated.js +21 -0
  58. package/dist/html/generated.js.map +1 -0
  59. package/dist/html/images.d.ts +18 -0
  60. package/dist/html/images.js +49 -2
  61. package/dist/html/images.js.map +1 -1
  62. package/dist/html/index.d.ts +1 -0
  63. package/dist/html/index.js +1 -0
  64. package/dist/html/index.js.map +1 -1
  65. package/dist/html/render.d.ts +5 -4
  66. package/dist/html/render.js +24 -6
  67. package/dist/html/render.js.map +1 -1
  68. package/dist/hyphenation/exceptions.d.ts +5 -0
  69. package/dist/hyphenation/exceptions.js +11 -0
  70. package/dist/hyphenation/exceptions.js.map +1 -1
  71. package/dist/hyphenation/index.d.ts +1 -1
  72. package/dist/hyphenation/index.js +1 -1
  73. package/dist/hyphenation/index.js.map +1 -1
  74. package/dist/import/convert.d.ts +21 -0
  75. package/dist/import/convert.js +65 -0
  76. package/dist/import/convert.js.map +1 -0
  77. package/dist/incremental/cache.d.ts +59 -0
  78. package/dist/incremental/cache.js +64 -0
  79. package/dist/incremental/cache.js.map +1 -0
  80. package/dist/incremental/index.d.ts +3 -0
  81. package/dist/incremental/index.js +4 -0
  82. package/dist/incremental/index.js.map +1 -0
  83. package/dist/incremental/keys.d.ts +27 -0
  84. package/dist/incremental/keys.js +89 -0
  85. package/dist/incremental/keys.js.map +1 -0
  86. package/dist/incremental/session.d.ts +180 -0
  87. package/dist/incremental/session.js +401 -0
  88. package/dist/incremental/session.js.map +1 -0
  89. package/dist/index.d.ts +6 -0
  90. package/dist/index.js +6 -0
  91. package/dist/index.js.map +1 -1
  92. package/dist/indexes/layout.d.ts +8 -2
  93. package/dist/indexes/layout.js +6 -4
  94. package/dist/indexes/layout.js.map +1 -1
  95. package/dist/layout/cache.d.ts +174 -0
  96. package/dist/layout/cache.js +150 -0
  97. package/dist/layout/cache.js.map +1 -0
  98. package/dist/layout/converge.d.ts +28 -0
  99. package/dist/layout/converge.js +102 -9
  100. package/dist/layout/converge.js.map +1 -1
  101. package/dist/layout/counters.d.ts +4 -0
  102. package/dist/layout/counters.js +15 -0
  103. package/dist/layout/counters.js.map +1 -1
  104. package/dist/layout/index.d.ts +5 -2
  105. package/dist/layout/index.js +3 -0
  106. package/dist/layout/index.js.map +1 -1
  107. package/dist/layout/lists.d.ts +52 -3
  108. package/dist/layout/lists.js +513 -46
  109. package/dist/layout/lists.js.map +1 -1
  110. package/dist/layout/lookahead.d.ts +151 -0
  111. package/dist/layout/lookahead.js +581 -0
  112. package/dist/layout/lookahead.js.map +1 -0
  113. package/dist/layout/margin-boxes.d.ts +11 -1
  114. package/dist/layout/margin-boxes.js +24 -1
  115. package/dist/layout/margin-boxes.js.map +1 -1
  116. package/dist/layout/page-rules.d.ts +6 -1
  117. package/dist/layout/page-rules.js +42 -1
  118. package/dist/layout/page-rules.js.map +1 -1
  119. package/dist/layout/page.js +4 -2
  120. package/dist/layout/page.js.map +1 -1
  121. package/dist/layout/pagebuilder.d.ts +248 -3
  122. package/dist/layout/pagebuilder.js +512 -19
  123. package/dist/layout/pagebuilder.js.map +1 -1
  124. package/dist/layout/pages.d.ts +108 -1
  125. package/dist/layout/pages.js +1362 -159
  126. package/dist/layout/pages.js.map +1 -1
  127. package/dist/layout/paragraph.d.ts +14 -0
  128. package/dist/layout/paragraph.js +304 -31
  129. package/dist/layout/paragraph.js.map +1 -1
  130. package/dist/layout/pre.js +4 -0
  131. package/dist/layout/pre.js.map +1 -1
  132. package/dist/layout/protrusion.d.ts +26 -0
  133. package/dist/layout/protrusion.js +39 -0
  134. package/dist/layout/protrusion.js.map +1 -0
  135. package/dist/layout/ranges.d.ts +2 -0
  136. package/dist/layout/ranges.js +22 -0
  137. package/dist/layout/ranges.js.map +1 -0
  138. package/dist/layout/region.d.ts +2 -1
  139. package/dist/layout/region.js +9 -5
  140. package/dist/layout/region.js.map +1 -1
  141. package/dist/layout/templates.d.ts +71 -0
  142. package/dist/layout/templates.js +290 -0
  143. package/dist/layout/templates.js.map +1 -0
  144. package/dist/layout/vlist.d.ts +3 -3
  145. package/dist/linebreak/items.d.ts +27 -2
  146. package/dist/linebreak/items.js +10 -3
  147. package/dist/linebreak/items.js.map +1 -1
  148. package/dist/linebreak/knuth-plass.d.ts +20 -0
  149. package/dist/linebreak/knuth-plass.js +68 -16
  150. package/dist/linebreak/knuth-plass.js.map +1 -1
  151. package/dist/lint/book.d.ts +13 -0
  152. package/dist/lint/book.js +52 -0
  153. package/dist/lint/book.js.map +1 -0
  154. package/dist/lint/config.d.ts +9 -0
  155. package/dist/lint/config.js +40 -6
  156. package/dist/lint/config.js.map +1 -1
  157. package/dist/lint/linter.js +1 -0
  158. package/dist/lint/linter.js.map +1 -1
  159. package/dist/lint/project.js +1 -1
  160. package/dist/lint/project.js.map +1 -1
  161. package/dist/lint/rules/layout.d.ts +3 -1
  162. package/dist/lint/rules/layout.js +8 -6
  163. package/dist/lint/rules/layout.js.map +1 -1
  164. package/dist/lint/rules/source.js +1 -1
  165. package/dist/lint/rules/source.js.map +1 -1
  166. package/dist/lint/testing.js +1 -0
  167. package/dist/lint/testing.js.map +1 -1
  168. package/dist/measure/bidi-data.d.ts +14 -0
  169. package/dist/measure/bidi-data.js +69 -0
  170. package/dist/measure/bidi-data.js.map +1 -0
  171. package/dist/measure/bidi.d.ts +70 -0
  172. package/dist/measure/bidi.js +225 -0
  173. package/dist/measure/bidi.js.map +1 -0
  174. package/dist/measure/css.d.ts +5 -0
  175. package/dist/measure/css.js +2 -0
  176. package/dist/measure/css.js.map +1 -1
  177. package/dist/measure/measurer.d.ts +36 -2
  178. package/dist/measure/measurer.js +220 -22
  179. package/dist/measure/measurer.js.map +1 -1
  180. package/dist/measure/model.d.ts +20 -2
  181. package/dist/measure/model.js +13 -6
  182. package/dist/measure/model.js.map +1 -1
  183. package/dist/measure/script-data.d.ts +6 -0
  184. package/dist/measure/script-data.js +34 -0
  185. package/dist/measure/script-data.js.map +1 -0
  186. package/dist/measure/scripts.d.ts +36 -0
  187. package/dist/measure/scripts.js +293 -0
  188. package/dist/measure/scripts.js.map +1 -0
  189. package/dist/output/output.d.ts +35 -3
  190. package/dist/output/output.js +26 -4
  191. package/dist/output/output.js.map +1 -1
  192. package/dist/paint/backgrounds.js +7 -20
  193. package/dist/paint/backgrounds.js.map +1 -1
  194. package/dist/paint/blend.d.ts +33 -13
  195. package/dist/paint/blend.js +73 -21
  196. package/dist/paint/blend.js.map +1 -1
  197. package/dist/paint/cache.d.ts +80 -0
  198. package/dist/paint/cache.js +537 -0
  199. package/dist/paint/cache.js.map +1 -0
  200. package/dist/paint/canvas.d.ts +4 -13
  201. package/dist/paint/canvas.js +45 -5
  202. package/dist/paint/canvas.js.map +1 -1
  203. package/dist/paint/context.d.ts +2 -0
  204. package/dist/paint/emphasis.js +1 -1
  205. package/dist/paint/emphasis.js.map +1 -1
  206. package/dist/paint/flatten.d.ts +24 -2
  207. package/dist/paint/flatten.js +55 -12
  208. package/dist/paint/flatten.js.map +1 -1
  209. package/dist/paint/forms.d.ts +64 -0
  210. package/dist/paint/forms.js +319 -0
  211. package/dist/paint/forms.js.map +1 -0
  212. package/dist/paint/images.d.ts +4 -1
  213. package/dist/paint/images.js +13 -2
  214. package/dist/paint/images.js.map +1 -1
  215. package/dist/paint/layers.d.ts +64 -0
  216. package/dist/paint/layers.js +137 -0
  217. package/dist/paint/layers.js.map +1 -0
  218. package/dist/paint/painter.d.ts +19 -6
  219. package/dist/paint/painter.js +15 -135
  220. package/dist/paint/painter.js.map +1 -1
  221. package/dist/paint/stacking.d.ts +1 -1
  222. package/dist/paint/stacking.js +9 -2
  223. package/dist/paint/stacking.js.map +1 -1
  224. package/dist/paint/text.d.ts +14 -3
  225. package/dist/paint/text.js +25 -4
  226. package/dist/paint/text.js.map +1 -1
  227. package/dist/paint/vertical.js +2 -2
  228. package/dist/paint/vertical.js.map +1 -1
  229. package/dist/pdf/encoded.d.ts +16 -0
  230. package/dist/pdf/encoded.js +35 -0
  231. package/dist/pdf/encoded.js.map +1 -0
  232. package/dist/pdf/include/colour.d.ts +105 -0
  233. package/dist/pdf/include/colour.js +349 -0
  234. package/dist/pdf/include/colour.js.map +1 -0
  235. package/dist/pdf/include/functions.d.ts +17 -0
  236. package/dist/pdf/include/functions.js +389 -0
  237. package/dist/pdf/include/functions.js.map +1 -0
  238. package/dist/pdf/include/pages.d.ts +14 -0
  239. package/dist/pdf/include/pages.js +27 -0
  240. package/dist/pdf/include/pages.js.map +1 -0
  241. package/dist/pdf/include/pdfjs/LICENSE +177 -0
  242. package/dist/pdf/include/pdfjs/pdf.min.mjs +27 -0
  243. package/dist/pdf/include/pdfjs/pdf.worker.min.mjs +27 -0
  244. package/dist/pdf/include/pdfjs/standard_fonts/FoxitDingbats.pfb +0 -0
  245. package/dist/pdf/include/pdfjs/standard_fonts/FoxitFixed.pfb +0 -0
  246. package/dist/pdf/include/pdfjs/standard_fonts/FoxitFixedBold.pfb +0 -0
  247. package/dist/pdf/include/pdfjs/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
  248. package/dist/pdf/include/pdfjs/standard_fonts/FoxitFixedItalic.pfb +0 -0
  249. package/dist/pdf/include/pdfjs/standard_fonts/FoxitSerif.pfb +0 -0
  250. package/dist/pdf/include/pdfjs/standard_fonts/FoxitSerifBold.pfb +0 -0
  251. package/dist/pdf/include/pdfjs/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
  252. package/dist/pdf/include/pdfjs/standard_fonts/FoxitSerifItalic.pfb +0 -0
  253. package/dist/pdf/include/pdfjs/standard_fonts/FoxitSymbol.pfb +0 -0
  254. package/dist/pdf/include/pdfjs/standard_fonts/LICENSE_FOXIT +27 -0
  255. package/dist/pdf/include/pdfjs/standard_fonts/LICENSE_LIBERATION +363 -0
  256. package/dist/pdf/include/pdfjs/standard_fonts/LiberationSans-Bold.ttf +0 -0
  257. package/dist/pdf/include/pdfjs/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
  258. package/dist/pdf/include/pdfjs/standard_fonts/LiberationSans-Italic.ttf +0 -0
  259. package/dist/pdf/include/pdfjs/standard_fonts/LiberationSans-Regular.ttf +0 -0
  260. package/dist/pdf/include/pdfjs/wasm/LICENSE_JBIG2 +196 -0
  261. package/dist/pdf/include/pdfjs/wasm/LICENSE_OPENJPEG +39 -0
  262. package/dist/pdf/include/pdfjs/wasm/LICENSE_PDFJS_JBIG2 +13 -0
  263. package/dist/pdf/include/pdfjs/wasm/LICENSE_PDFJS_OPENJPEG +22 -0
  264. package/dist/pdf/include/pdfjs/wasm/LICENSE_PDFJS_QCMS +19 -0
  265. package/dist/pdf/include/pdfjs/wasm/LICENSE_QCMS +21 -0
  266. package/dist/pdf/include/pdfjs/wasm/jbig2.wasm +0 -0
  267. package/dist/pdf/include/pdfjs/wasm/openjpeg.wasm +0 -0
  268. package/dist/pdf/include/pdfjs/wasm/qcms_bg.wasm +0 -0
  269. package/dist/pdf/include/pdfjs/wasm/quickjs-eval.wasm +0 -0
  270. package/dist/pdf/include/prepare.d.ts +58 -0
  271. package/dist/pdf/include/prepare.js +266 -0
  272. package/dist/pdf/include/prepare.js.map +1 -0
  273. package/dist/pdf/include/preview.d.ts +38 -0
  274. package/dist/pdf/include/preview.js +101 -0
  275. package/dist/pdf/include/preview.js.map +1 -0
  276. package/dist/pdf/include/rewrite.d.ts +57 -0
  277. package/dist/pdf/include/rewrite.js +803 -0
  278. package/dist/pdf/include/rewrite.js.map +1 -0
  279. package/dist/pdf/include/serialize.d.ts +32 -0
  280. package/dist/pdf/include/serialize.js +158 -0
  281. package/dist/pdf/include/serialize.js.map +1 -0
  282. package/dist/pdf/include/testing.d.ts +26 -0
  283. package/dist/pdf/include/testing.js +50 -0
  284. package/dist/pdf/include/testing.js.map +1 -0
  285. package/dist/pdf/index.d.ts +1 -0
  286. package/dist/pdf/index.js +1 -0
  287. package/dist/pdf/index.js.map +1 -1
  288. package/dist/pdf/structure/annotations.d.ts +33 -0
  289. package/dist/pdf/structure/annotations.js +112 -0
  290. package/dist/pdf/structure/annotations.js.map +1 -0
  291. package/dist/pdf/structure/forms.d.ts +10 -0
  292. package/dist/pdf/structure/forms.js +46 -0
  293. package/dist/pdf/structure/forms.js.map +1 -0
  294. package/dist/pdf/structure/index.d.ts +41 -5
  295. package/dist/pdf/structure/index.js +40 -5
  296. package/dist/pdf/structure/index.js.map +1 -1
  297. package/dist/pdf/structure/links.d.ts +2 -0
  298. package/dist/pdf/structure/links.js +1 -1
  299. package/dist/pdf/structure/links.js.map +1 -1
  300. package/dist/pdf/structure/presentation.d.ts +28 -0
  301. package/dist/pdf/structure/presentation.js +79 -0
  302. package/dist/pdf/structure/presentation.js.map +1 -0
  303. package/dist/pdf/structure/tags.d.ts +34 -2
  304. package/dist/pdf/structure/tags.js +117 -14
  305. package/dist/pdf/structure/tags.js.map +1 -1
  306. package/dist/pdf/types.d.ts +357 -11
  307. package/dist/pdf/wasm/pulpweaver4_pdf.d.ts +44 -2
  308. package/dist/pdf/wasm/pulpweaver4_pdf.js +191 -2
  309. package/dist/pdf/wasm/pulpweaver4_pdf_bg.wasm +0 -0
  310. package/dist/pdf/writer.d.ts +13 -1
  311. package/dist/pdf/writer.js +26 -1
  312. package/dist/pdf/writer.js.map +1 -1
  313. package/dist/plugin/define.d.ts +200 -15
  314. package/dist/plugin/define.js +124 -15
  315. package/dist/plugin/define.js.map +1 -1
  316. package/dist/plugin/failure.d.ts +1 -1
  317. package/dist/plugin/index.d.ts +5 -4
  318. package/dist/plugin/index.js +5 -4
  319. package/dist/plugin/index.js.map +1 -1
  320. package/dist/plugin/reference.d.ts +38 -0
  321. package/dist/plugin/reference.js +287 -0
  322. package/dist/plugin/reference.js.map +1 -0
  323. package/dist/plugin/register.d.ts +39 -7
  324. package/dist/plugin/register.js +83 -2
  325. package/dist/plugin/register.js.map +1 -1
  326. package/dist/preflight/index.d.ts +1 -1
  327. package/dist/preflight/index.js +1 -1
  328. package/dist/preflight/index.js.map +1 -1
  329. package/dist/preflight/pdfx.d.ts +35 -0
  330. package/dist/preflight/pdfx.js +33 -2
  331. package/dist/preflight/pdfx.js.map +1 -1
  332. package/dist/preflight/reader.d.ts +10 -3
  333. package/dist/preflight/reader.js +86 -5
  334. package/dist/preflight/reader.js.map +1 -1
  335. package/dist/print/impose.d.ts +66 -0
  336. package/dist/print/impose.js +331 -0
  337. package/dist/print/impose.js.map +1 -0
  338. package/dist/print/output.js +400 -50
  339. package/dist/print/output.js.map +1 -1
  340. package/dist/problem.js +4 -3
  341. package/dist/problem.js.map +1 -1
  342. package/dist/profile/index.d.ts +1 -0
  343. package/dist/profile/index.js +1 -0
  344. package/dist/profile/index.js.map +1 -1
  345. package/dist/profile/lint.d.ts +1 -1
  346. package/dist/profile/lint.js +29 -1
  347. package/dist/profile/lint.js.map +1 -1
  348. package/dist/profile/list-table.d.ts +51 -0
  349. package/dist/profile/list-table.js +137 -0
  350. package/dist/profile/list-table.js.map +1 -0
  351. package/dist/profile/metadata.js +3 -0
  352. package/dist/profile/metadata.js.map +1 -1
  353. package/dist/profile/profile.d.ts +3 -0
  354. package/dist/profile/profile.js +9 -1
  355. package/dist/profile/profile.js.map +1 -1
  356. package/dist/project.js +3 -0
  357. package/dist/project.js.map +1 -1
  358. package/dist/qpdf/index.d.ts +2 -0
  359. package/dist/qpdf/index.js +3 -0
  360. package/dist/qpdf/index.js.map +1 -0
  361. package/dist/qpdf/qpdf.d.ts +125 -0
  362. package/dist/qpdf/qpdf.js +205 -0
  363. package/dist/qpdf/qpdf.js.map +1 -0
  364. package/dist/qpdf/testing.d.ts +12 -0
  365. package/dist/qpdf/testing.js +9 -0
  366. package/dist/qpdf/testing.js.map +1 -0
  367. package/dist/qpdf/wasm/LICENSE-qpdf +202 -0
  368. package/dist/qpdf/wasm/LICENSE-zlib +22 -0
  369. package/dist/qpdf/wasm/NOTICE-qpdf.md +42 -0
  370. package/dist/qpdf/wasm/qpdf.wasm +0 -0
  371. package/dist/render/index.d.ts +3 -0
  372. package/dist/render/index.js +2 -0
  373. package/dist/render/index.js.map +1 -0
  374. package/dist/render/render.d.ts +98 -0
  375. package/dist/render/render.js +243 -0
  376. package/dist/render/render.js.map +1 -0
  377. package/dist/reproducible/clock.d.ts +4 -5
  378. package/dist/reproducible/clock.js +4 -5
  379. package/dist/reproducible/clock.js.map +1 -1
  380. package/dist/spike/spike-page.chromium.json +4 -4
  381. package/dist/style/colours.d.ts +7 -2
  382. package/dist/style/colours.js +24 -2
  383. package/dist/style/colours.js.map +1 -1
  384. package/dist/style/compile.js +1 -1
  385. package/dist/style/compile.js.map +1 -1
  386. package/dist/style/defaults.d.ts +9 -3
  387. package/dist/style/defaults.js +14 -2
  388. package/dist/style/defaults.js.map +1 -1
  389. package/dist/style/gcpm.d.ts +1 -1
  390. package/dist/style/gcpm.js +17 -5
  391. package/dist/style/gcpm.js.map +1 -1
  392. package/dist/style/properties.js +84 -0
  393. package/dist/style/properties.js.map +1 -1
  394. package/dist/test/book.d.ts +22 -2
  395. package/dist/test/book.js +35 -2
  396. package/dist/test/book.js.map +1 -1
  397. package/dist/test/build.d.ts +23 -0
  398. package/dist/test/build.js +86 -33
  399. package/dist/test/build.js.map +1 -1
  400. package/dist/test/layout.js +128 -19
  401. package/dist/test/layout.js.map +1 -1
  402. package/dist/test/limits.d.ts +8 -0
  403. package/dist/test/limits.js +9 -0
  404. package/dist/test/limits.js.map +1 -0
  405. package/dist/test/pipeline.d.ts +23 -0
  406. package/dist/test/pipeline.js.map +1 -1
  407. package/dist/test/render.d.ts +26 -3
  408. package/dist/test/render.js +151 -23
  409. package/dist/test/render.js.map +1 -1
  410. package/dist/test/runner.d.ts +6 -3
  411. package/dist/test/runner.js +172 -105
  412. package/dist/test/runner.js.map +1 -1
  413. package/dist/test/text.js +2 -2
  414. package/dist/test/text.js.map +1 -1
  415. package/dist/text/output.js +2 -2
  416. package/dist/text/output.js.map +1 -1
  417. package/dist/text/render.d.ts +4 -3
  418. package/dist/text/render.js +126 -4
  419. package/dist/text/render.js.map +1 -1
  420. package/dist/transform/index.d.ts +1 -1
  421. package/dist/transform/index.js +1 -1
  422. package/dist/transform/index.js.map +1 -1
  423. package/dist/transform/run.d.ts +2 -0
  424. package/dist/transform/run.js +32 -16
  425. package/dist/transform/run.js.map +1 -1
  426. package/dist/web/output.js +116 -10
  427. package/dist/web/output.js.map +1 -1
  428. package/dist/web/runtime/justify.js.txt +2 -2
  429. package/dist/web/site.d.ts +2 -0
  430. package/dist/web/site.js +8 -1
  431. package/dist/web/site.js.map +1 -1
  432. package/docs/README.md +6 -1
  433. package/docs/manual/chapters/front.dj +34 -0
  434. package/docs/manual/chapters/guides/citations.dj +426 -0
  435. package/docs/manual/chapters/guides/colour-and-prepress.dj +261 -0
  436. package/docs/manual/chapters/guides/editions.dj +329 -0
  437. package/docs/manual/chapters/guides/in-a-web-page.dj +143 -0
  438. package/docs/manual/chapters/guides/lines-and-pages.dj +681 -0
  439. package/docs/manual/chapters/guides/lint-rules.dj +355 -0
  440. package/docs/manual/chapters/guides/pdfs.dj +501 -0
  441. package/docs/manual/chapters/guides/plugins.dj +425 -0
  442. package/docs/manual/chapters/guides/testing.dj +264 -0
  443. package/docs/manual/chapters/guides/writing-in-djot.dj +537 -0
  444. package/docs/manual/chapters/start/for-latex-users.dj +256 -0
  445. package/docs/manual/chapters/start/getting-started.dj +167 -0
  446. package/docs/manual/chapters/start/your-first-book.dj +426 -0
  447. package/docs/manual/fonts/CrimsonPro-Italic-VF.ttf +0 -0
  448. package/docs/manual/fonts/CrimsonPro-VF.ttf +0 -0
  449. package/docs/manual/fonts/JetBrainsMono-Regular.otf +0 -0
  450. package/docs/manual/fonts/NotoSansSymbols2-Boxes.ttf +0 -0
  451. package/docs/manual/fonts/OFL.txt +95 -0
  452. package/docs/manual/pulpweaver4.toml +39 -0
  453. package/docs/manual/styles/manual.css +137 -0
  454. package/docs/reference/css-properties/index.md +9 -0
  455. package/docs/reference/css-properties/pw-expansion.md +31 -0
  456. package/docs/reference/css-properties/pw-flow-into.md +31 -0
  457. package/docs/reference/css-properties/pw-knockout.md +26 -0
  458. package/docs/reference/css-properties/pw-layer.md +24 -0
  459. package/docs/reference/css-properties/pw-page-breaking.md +30 -0
  460. package/docs/reference/css-properties/pw-page-duration.md +28 -0
  461. package/docs/reference/css-properties/pw-page-rotate.md +29 -0
  462. package/docs/reference/css-properties/pw-page-transition.md +29 -0
  463. package/docs/reference/css-properties/pw-protrusion.md +31 -0
  464. package/docs/reference/lint-rules/ibid-across-page.md +2 -2
  465. package/docs/reference/plugin-api/capabilities.md +2 -2
  466. package/docs/reference/plugin-api/claim-kind.md +1 -1
  467. package/docs/reference/plugin-api/combine-exceptions.md +19 -0
  468. package/docs/reference/plugin-api/element-break-context.md +34 -0
  469. package/docs/reference/plugin-api/element-break-item.md +24 -0
  470. package/docs/reference/plugin-api/element-breaker.md +24 -0
  471. package/docs/reference/plugin-api/flow-definition.md +30 -0
  472. package/docs/reference/plugin-api/generated-reference.md +32 -0
  473. package/docs/reference/plugin-api/index-definition.md +32 -0
  474. package/docs/reference/plugin-api/index-titles.md +18 -0
  475. package/docs/reference/plugin-api/index.md +27 -3
  476. package/docs/reference/plugin-api/insert-class-definition.md +46 -0
  477. package/docs/reference/plugin-api/insert-placement.md +22 -0
  478. package/docs/reference/plugin-api/insert-placements.md +18 -0
  479. package/docs/reference/plugin-api/layout-definition.md +9 -5
  480. package/docs/reference/plugin-api/layout-slot.md +6 -16
  481. package/docs/reference/plugin-api/lint-context.md +3 -1
  482. package/docs/reference/plugin-api/lint-definition.md +1 -1
  483. package/docs/reference/plugin-api/lint-edition.md +2 -0
  484. package/docs/reference/plugin-api/page-builder-event.md +22 -0
  485. package/docs/reference/plugin-api/page-builder-hook.md +7 -3
  486. package/docs/reference/plugin-api/page-builder-page-event.md +30 -0
  487. package/docs/reference/plugin-api/page-template-definition.md +34 -0
  488. package/docs/reference/plugin-api/page-template-region-definition.md +46 -0
  489. package/docs/reference/plugin-api/plugin-definition.md +5 -1
  490. package/docs/reference/plugin-api/plugin-reference-options.md +32 -0
  491. package/docs/reference/plugin-api/plugin-reference.md +22 -0
  492. package/docs/reference/plugin-api/plugin-registry.md +15 -5
  493. package/docs/reference/plugin-api/plugin-stage.md +1 -1
  494. package/docs/reference/plugin-api/plugin.md +9 -2
  495. package/docs/reference/plugin-api/reference-page.md +34 -0
  496. package/docs/reference/plugin-api/render-reference-page.md +18 -0
  497. package/docs/reference/plugin-api/renderers.md +1 -1
  498. package/docs/reference/pulpweaver4-toml/editions.md +239 -2
  499. package/docs/reference/pulpweaver4-toml/index.md +44 -1
  500. package/docs/reference/pulpweaver4-toml/inks.md +15 -4
  501. package/docs/reference/pulpweaver4-toml/lint.md +1 -1
  502. package/package.json +5 -1
@@ -0,0 +1,261 @@
1
+ ``` =meta
2
+ description = 'RGB and CMYK editions, output intents, exact inks with device-cmyk(), spot colours, overprint, black text on black ink alone, ink limits, bleed and crop marks.'
3
+ ```
4
+
5
+ {#colour-and-prepress}
6
+ # Colour and prepress
7
+
8
+ A print edition is RGB or CMYK. An RGB PDF suits a print-on-demand
9
+ service that takes RGB (Amazon KDP’s interiors, say), a home printer, or the
10
+ screen. An offset printer wants CMYK, made for its press and paper by an
11
+ ICC profile, usually as [PDF/X](#pdfx). pulpweaver4 makes either
12
+ from the same stylesheet.
13
+
14
+ {#rgb-editions}
15
+ ## RGB editions
16
+
17
+ An edition is RGB unless it says otherwise. Its colours are written as
18
+ CSS writes them, in any syntax (`#1d1c1a`, `rgb()`, `oklch()`,
19
+ `color-mix()`), and the PDF embeds sRGB as its colour space, so it looks the
20
+ same in every viewer.
21
+
22
+ {#cmyk-editions}
23
+ ## CMYK editions
24
+
25
+ {project=offset}
26
+ ``` toml
27
+ [editions.offset]
28
+ media = "print"
29
+ page = "5.5in 8.5in"
30
+ color = "cmyk"
31
+ output-intent = "GRACoL2013"
32
+ ```
33
+
34
+ - *`color = "cmyk"`* makes the edition’s PDF CMYK.
35
+ - *`output-intent`* is the printing condition, the ICC profile for the
36
+ printer’s press and paper, which the PDF names and embeds. Ask the
37
+ printer which; these are known by name:
38
+
39
+ | Name | Printing condition |
40
+ |----|----|
41
+ | `GRACoL2013` | North American sheet-fed offset, coated paper (CGATS21-2-CRPC6) |
42
+ | `SWOP` | North American web offset, coated paper (SWOP 2013) |
43
+ | `FOGRA39` | European offset, coated paper; an ICC version 2 profile, which PDF/X-1a, X-3 and PDF/A-1 embed |
44
+ | `FOGRA51` | European offset, coated paper, newer: its profile can’t be shared, so get it once with `pw profiles get FOGRA51`, which shows ECI’s licence and downloads it from ECI when you accept |
45
+
46
+ Or give `output-intent` a printer’s own profile, a file in the project,
47
+ such as `"profiles/printer.icc"`.
48
+
49
+ The named profiles are downloaded from the ICC’s registry the first time an
50
+ edition needs one, checked against their known hash, and kept in
51
+ `~/.cache/pulpweaver4/icc/`: a first CMYK build needs the network, later
52
+ ones don’t. `pw profiles get <name>` fetches one ahead of time, for a
53
+ machine that builds offline, and `pw profiles list` says which are there.
54
+ The profile is embedded in the PDF, which makes it a few megabytes bigger.
55
+ For PDF/X-1a and X-3, `output-profile = "registered"` names the condition
56
+ in the PDF without embedding its profile; the build converts through the
57
+ profile all the same ([PDFs](#a-registered-condition-without-its-profile)).
58
+
59
+ PDF/X-1a, PDF/X-3 and PDF/A-1 are PDF 1.4, which takes only ICC profiles of
60
+ version 2. GRACoL2013’s and SWOP’s are version 4, so for those standards ask
61
+ the printer for a version 2 profile, use `FOGRA39`, or, for PDF/X-1a and X-3,
62
+ name the condition alone with `output-profile = "registered"`; the build
63
+ stops on a newer one, with the fix. PDF/X-4 and PDF/A-2 and later take either.
64
+
65
+ {#how-colours-become-cmyk}
66
+ ### How colours become CMYK
67
+
68
+ Every colour in the stylesheet, and every image, is converted to the
69
+ printing condition through its profile, with Little CMS, the colour engine
70
+ most prepress software uses. Two things are kept from that conversion:
71
+
72
+ - *Black stays black ink.* Black and grey text, rules and borders are
73
+ printed on the black plate alone, never as a mix of all four inks, so
74
+ they stay sharp however the plates are registered. A greyscale image is
75
+ black ink alone too.
76
+ - *CMYK images are passed through*, not converted again.
77
+ - *An SVG’s filters are converted too.* An element in an inline SVG with a
78
+ filter (a blur, a drop shadow) is drawn by the browser at the edition’s
79
+ resolution and converted as the images are, its neutrals on black ink
80
+ alone, rather than left in RGB for the printer’s RIP. An RGB edition
81
+ leaves them as vectors.
82
+
83
+ The `ink-limit` lint rule, in the `recommended` preset, checks every colour
84
+ against the printing condition’s limit on total ink, and `black-text`, in
85
+ `pdf-x`, that text is black ink alone:
86
+
87
+ {.untested}
88
+ ``` text
89
+ chapters/02-writing.dj:25:1: error: color puts down 330% of ink (C 100%, M 100%, Y 80%, K 50%), over GRACoL2013’s limit of 320% [ink-limit]
90
+ |
91
+ 23 |
92
+ 24 | {.loud}
93
+ 25 | Too much ink.
94
+ | ^^^^^^^^^^^^^
95
+ fix: use less ink: a rich black of device-cmyk(0.6 0.4 0.4 1) is 240%, and black text needs K alone
96
+ ```
97
+
98
+ A rich black on purpose, for a display heading say, is text that isn’t
99
+ black ink alone too: put `lint-disable="black-text"` on it.
100
+
101
+ {#exact-inks-with-device-cmyk}
102
+ ### Exact inks with device-cmyk()
103
+
104
+ For a colour that must be exact inks, not a conversion, write it in CMYK
105
+ with CSS Color 5’s `device-cmyk()`, each ink from 0 to 1 or 0% to 100%:
106
+
107
+ {project=offset}
108
+ ``` css
109
+ @media (--offset) {
110
+ .rubric { color: device-cmyk(0 1 1 0); } /* 100% magenta and yellow */
111
+ }
112
+ ```
113
+
114
+ No browser draws `device-cmyk()`, so the stylesheet compiler gives each a
115
+ preview colour, never one the stylesheet or the browser uses for anything
116
+ else, that the painter turns back into those exact inks in the PDF. So a
117
+ rich or registration black, `device-cmyk(1 1 1 1)`, stays apart from
118
+ ordinary black text, which keeps to the black plate. In an RGB edition it is
119
+ shown as its nearest RGB. Mixing one with `color-mix()` is an error: the
120
+ result would have no exact inks.
121
+
122
+ {#spot-colours}
123
+ ## Spot colours
124
+
125
+ A spot ink, a Pantone colour say, is printed from a plate of its own. Name
126
+ it in `pulpweaver4.toml`, with a colour to show it by and a CMYK fallback:
127
+
128
+ {project=offset}
129
+ ``` toml
130
+ [inks.teal]
131
+ preview = "#00594f" # how it looks on screen
132
+ cmyk = [0.9, 0, 0.5, 0.6] # its CMYK, for a PDF without its plate
133
+ name = "PANTONE 3302 C" # its name as the printer knows it
134
+ ```
135
+
136
+ and use it in CSS as `var(--ink-<name>)`:
137
+
138
+ {project=offset}
139
+ ``` css
140
+ h1 { color: var(--ink-teal); }
141
+ ```
142
+
143
+ In a CMYK edition the heading is printed in the spot ink, a Separation colour
144
+ space named `PANTONE 3302 C` in the PDF, which a separations preview shows
145
+ as a plate of its own. In an RGB edition it is its preview colour. An
146
+ edition can add inks, or replace one, with its own `[editions.<name>.inks]`.
147
+
148
+ {#mixing-inks}
149
+ ### Mixing inks: two-colour work
150
+
151
+ A colour made of several inks, a spot ink and black say, as a two-colour
152
+ job’s tints are, is a `mix` of them, each by its key in `[inks]` or a
153
+ process ink (`cyan`, `magenta`, `yellow`, `black`), at a tint from 0 to 1:
154
+
155
+ {project=offset}
156
+ ``` toml
157
+ [inks.dusk]
158
+ mix = { teal = 0.6, black = 0.4 }
159
+ ```
160
+
161
+ `var(--ink-dusk)` is then one DeviceN colour in a CMYK edition’s PDF, which
162
+ prints 60% teal on teal’s plate and 40% on the black plate, and in an RGB
163
+ edition the inks’ previews multiplied at their tints (or its own `preview`).
164
+ A mix takes 2 to 8 inks, none of them a mix itself.
165
+
166
+ PDF/X-1a and X-3 allow no transparency, so the painter blends what is
167
+ transparent over what is under it. A spot ink blended with process colour,
168
+ or with another spot ink, becomes a DeviceN colour of them, still on its own
169
+ plate, as the overlap prints. Only an ink under a hue, saturation, colour or
170
+ luminosity blend mode, over an image or through a mask is drawn as an image,
171
+ in process colours, with an error.
172
+
173
+ {#knockout-groups}
174
+ ### Knockout groups
175
+
176
+ `--pw-knockout: on` makes an element a knockout group: what is painted
177
+ inside it composites with what is under the element, not with what it
178
+ painted before, so two translucent shapes inside it don’t darken where they
179
+ overlap; the later one shows the background through itself instead. It
180
+ applies to the element alone, not to what is inside it:
181
+
182
+ {project=offset}
183
+ ``` css
184
+ @media (--offset) {
185
+ .badge { --pw-knockout: on; }
186
+ }
187
+ ```
188
+
189
+ {#overprint}
190
+ ## Overprint
191
+
192
+ `--pw-overprint: on` makes an element’s text and rules overprint, instead of
193
+ knocking out the inks beneath them:
194
+
195
+ {project=offset}
196
+ ``` css
197
+ @media (--offset) {
198
+ .caption { color: device-cmyk(0 1 0 0); --pw-overprint: on; }
199
+ }
200
+ ```
201
+
202
+ It is inherited, so it can go on a block, and it applies in CMYK editions
203
+ only.
204
+
205
+ {#bleed-and-crop-marks}
206
+ ## Bleed and crop marks
207
+
208
+ A page whose background or picture runs off its edge is printed bigger and
209
+ trimmed. `bleed` on a print edition is how far past the trim it is printed,
210
+ and `marks` adds crop marks (`crop`), registration marks (`cross`) or both
211
+ in a margin outside the bleed:
212
+
213
+ {project=bleed}
214
+ ``` toml
215
+ [editions.paperback]
216
+ media = "print"
217
+ page = "5.5in 8.5in"
218
+ bleed = "0.125in"
219
+ marks = "crop cross"
220
+ ```
221
+
222
+ The PDF’s pages are then bigger than the book’s, with the trim and bleed
223
+ boxes saying where to cut. A page’s `@page` background runs to the bleed’s
224
+ edge:
225
+
226
+ {project=bleed}
227
+ ``` css
228
+ @media (--paperback) {
229
+ @page :first { background: #e8e4da; }
230
+ }
231
+ ```
232
+
233
+ `@page` rules can set `bleed` and `marks` too, for the pages they match.
234
+ Crop marks with no bleed give the page CSS’s 6pt of bleed. A
235
+ print-on-demand service usually wants bleed and no marks; an offset printer
236
+ says which it wants.
237
+
238
+ {#checking-the-plates}
239
+ ## Checking the plates
240
+
241
+ `pw lint --edition offset` checks an edition’s settings, the profile’s
242
+ name among them, and lints the book with the edition’s colours as its PDF
243
+ has them, through the output intent, so `black-text` and `ink-limit` see
244
+ what the plates will:
245
+
246
+ {project=offset}
247
+ ``` sh
248
+ pw lint --edition offset
249
+ ```
250
+
251
+ {project=offset .output}
252
+ ``` text
253
+ pw lint: no problems
254
+ ```
255
+
256
+ A CMYK PDF can be checked like any printer’s file: with your printer’s
257
+ preflight, Acrobat’s Output Preview, or Ghostscript’s separations
258
+ (`gs -sDEVICE=tiffsep -r150 -o plate-%d.tif book.pdf`), which writes a TIFF
259
+ for each ink. pulpweaver4’s own tests check every CMYK PDF they make that
260
+ way: text and rules on the black plate alone, spot inks on their own.
261
+
@@ -0,0 +1,329 @@
1
+ ``` =meta
2
+ description = 'One source, many editions — a paperback, a Letter edition, a web site and plain text from pulpweaver4.toml, each styled from one stylesheet with media queries and the edition’s own name.'
3
+ ```
4
+
5
+ {#editions}
6
+ # Editions and media queries
7
+
8
+ An _edition_ is one thing `pw build` makes from the book: a PDF at a page
9
+ size, a web site, or a text file. A book can have as many as it needs, all
10
+ from the same chapters and the same stylesheet: a trade paperback, a Letter
11
+ edition to print at home, a CMYK edition for an offset printer, the web.
12
+
13
+ {#editions-in-pulpweaver4toml}
14
+ ## Editions in pulpweaver4.toml
15
+
16
+ Each edition is a table under `[editions]`, named as you like:
17
+
18
+ {project=editions}
19
+ ``` toml
20
+ [editions.web]
21
+ media = "screen"
22
+
23
+ [editions.paperback]
24
+ media = "print"
25
+ page = "5.5in 8.5in"
26
+
27
+ [editions.letter]
28
+ media = "print"
29
+ page = "letter"
30
+
31
+ [editions.text]
32
+ output = "text"
33
+ wrap = 72
34
+ ```
35
+
36
+ - *`media`* is `print` or `screen`, the media queries the stylesheet is
37
+ compiled for. A `print` edition is a PDF, and a `screen` edition a web
38
+ site, unless `output` says otherwise.
39
+ - *`output`* is what the edition writes: `pdf`, `web` or `text`, or an
40
+ output a plugin adds.
41
+ - *`page`* is a PDF’s trimmed page size: a width and a height, or a name
42
+ such as `letter`, `A5` or `B5`. [Lines and pages](#the-page)
43
+ lists them.
44
+ - *The name* is the edition’s folder in `dist/` and its PDF’s name:
45
+ the paperback’s is `dist/paperback/paperback.pdf`. With it,
46
+ `pw build --edition paperback` builds that edition alone, and
47
+ `@media (--paperback)` styles it.
48
+
49
+ A print edition has more keys, for colour, PDF standards and the press:
50
+ [PDFs](#pdfs) and [Colour and prepress](#colour-and-prepress)
51
+ cover them. Among them is `output-profile`, `embedded` or `registered`:
52
+ whether a PDF/X-1a or X-3 edition embeds its output intent’s profile or
53
+ names the registered condition alone. The
54
+ [configuration reference](https://pulpweaver.inkylabs.com/reference/pulpweaver4-toml/editions) describes every key in
55
+ full.
56
+
57
+ {#bleed-and-printers-marks}
58
+ ### Bleed and printer’s marks
59
+
60
+ For a printer who trims the pages, `bleed` runs the backgrounds and images
61
+ that touch the trim past it, and `marks` draws crop marks (`"crop"`),
62
+ registration marks (`"cross"`) or both outside the bleed:
63
+
64
+ {project=editions}
65
+ ``` toml
66
+ [editions.offset]
67
+ media = "print"
68
+ page = "5.5in 8.5in"
69
+ bleed = "0.125in"
70
+ marks = "crop"
71
+ ```
72
+
73
+ The PDF’s pages are then the trimmed page with its bleed and, with marks, a
74
+ half-inch slug around it for them; its trim box and bleed box say where the
75
+ printer cuts.
76
+
77
+ {#booklets}
78
+ ### Booklets and n-up
79
+
80
+ `impose = "booklet"` prints an edition as a saddle-stitched booklet: its
81
+ pages are paired onto both sides of sheets that are folded, nested and
82
+ stitched through the fold, the last page beside the first on the first
83
+ sheet’s front, and so on inwards. `n-up` sets several sheets on one, to be
84
+ cut apart, `"<columns>x<rows>"`:
85
+
86
+ {project=editions}
87
+ ``` toml
88
+ [editions.booklet]
89
+ media = "print"
90
+ page = "5.5in 8.5in"
91
+ impose = "booklet"
92
+ marks = "crop"
93
+ ```
94
+
95
+ The pages are laid out and painted as they would be alone, and each is
96
+ moved whole onto its sheet, with its bleed, cut at the fold. The sheet gets
97
+ its own marks: crop marks at every cut, fold marks at the spine and cross
98
+ marks. A book whose pages aren’t a multiple of four is padded with blank
99
+ pages at the end, which the `signature` lint rule reports.
100
+
101
+ A booklet’s nested sheets each wrap those inside them, so the inner sheets
102
+ stick out at the fore-edge and lose more to the trim: creep, or shingling.
103
+ `creep` makes up for it, moving each sheet’s pages toward the spine, the
104
+ innermost sheet’s by the whole amount and the others in proportion, so
105
+ every fore-edge margin is the same once the book is trimmed. It is about
106
+ the paper’s thickness times the number of sheets; the printer can say.
107
+
108
+ `sheet` asks for press sheets: the paper the press prints, of the size it
109
+ names, with each of the edition’s sheets in its middle (turned, if it fits
110
+ only across it), crop and fold marks around it, the cross marks `marks`
111
+ asks for, and a slug line below naming the book, the edition, the sheet and
112
+ its side, and the build’s date. Too small a press sheet is an error.
113
+
114
+ {project=editions}
115
+ ``` toml
116
+ [editions.press]
117
+ media = "print"
118
+ page = "5.5in 8.5in"
119
+ bleed = "0.125in"
120
+ impose = "booklet"
121
+ creep = "0.5mm"
122
+ sheet = "12in 18in"
123
+ ```
124
+
125
+ {#the-web-edition}
126
+ ### The web edition
127
+
128
+ A `screen` edition is a static site in `dist/<name>/`, with the project’s
129
+ fonts, subset to the characters the book uses.
130
+
131
+ {project=editions}
132
+ ``` toml
133
+ [editions.web]
134
+ media = "screen"
135
+ split = "chapter" # or "none"
136
+ ```
137
+
138
+ `split = "chapter"`, the default, makes a page for each chapter’s file and a
139
+ contents page, `index.html`; `split = "none"` puts the whole book on
140
+ `index.html`. A file’s page is named by its first heading, or by the title
141
+ in its [`=meta` block](#a-files-own-language-and-title).
142
+ Footnotes open as pop-overs where they are called, page references read as
143
+ cross-references, math is MathML, and the site follows the reader’s light or
144
+ dark mode.
145
+
146
+ {#the-text-edition}
147
+ ### The text edition
148
+
149
+ `output = "text"` writes `dist/<name>/book.txt`: the book in plain text,
150
+ with underlined headings, notes at the end of each chapter, citations as the
151
+ style writes them, and verse line by line. `wrap` is the line length in
152
+ characters, or `"none"` (the default) for a paragraph per line. The text
153
+ edition is written from the document, not the stylesheet, so CSS doesn’t
154
+ change it.
155
+
156
+ {#one-stylesheet-for-every-edition}
157
+ ## One stylesheet for every edition
158
+
159
+ Every `.css` file in `styles/` (and its folders) styles every edition, in
160
+ the order of their paths. The stylesheet is compiled once for each edition,
161
+ and media queries decide, at that moment, what applies:
162
+
163
+ {project=editions}
164
+ ``` css
165
+ p {
166
+ text-align: justify;
167
+ }
168
+
169
+ @media print {
170
+ :root { font-size: 11pt; line-height: 14pt; }
171
+ h1 { break-before: right; }
172
+ }
173
+
174
+ @media screen {
175
+ :root { font-size: 19px; }
176
+ }
177
+ ```
178
+
179
+ {#an-editions-own-name}
180
+ ### An edition’s own name
181
+
182
+ Each edition’s name is a custom media query, true in that edition and false
183
+ in every other:
184
+
185
+ {project=editions}
186
+ ``` css
187
+ @media (--paperback) {
188
+ :root { font-size: 10pt; line-height: 13pt; }
189
+ }
190
+
191
+ @media print and (not (--paperback)) {
192
+ :root { font-size: 12pt; line-height: 15pt; }
193
+ }
194
+ ```
195
+
196
+ You don’t declare them: every edition in `pulpweaver4.toml` is one. A name
197
+ that isn’t an edition, `(--papreback)`, is an error that names the nearest.
198
+
199
+ The pages are styled the same way. `@page`, in a media query, gives one
200
+ edition margins of its own:
201
+
202
+ {project=editions}
203
+ ``` css
204
+ @media (--letter) {
205
+ @page { margin: 1in 1.25in; }
206
+ }
207
+ ```
208
+
209
+ {#the-editions-page-wins}
210
+ ### The edition’s page wins
211
+
212
+ An edition’s `page`, `bleed` and `marks` win over the stylesheet’s `@page`,
213
+ so one stylesheet can serve a paperback and a Letter edition: an
214
+ `@page { size: 5.5in 8.5in }` shared by both leaves the Letter edition
215
+ Letter. Where `@page` would have made another page, the build says so with
216
+ a `page-overridden` warning, once for each property:
217
+
218
+ {project=override}
219
+ ``` toml
220
+ [editions.letter]
221
+ media = "print"
222
+ page = "letter"
223
+ ```
224
+
225
+ {project=override}
226
+ ``` css
227
+ @page { size: 5.5in 8.5in; }
228
+ ```
229
+
230
+ {project=override output="pw build --edition letter"}
231
+ ``` text
232
+ warning: @page { size: 5.5in 8.5in } isn't the edition's page, which wins: 612pt × 792pt, not 396pt × 612pt [page-overridden]
233
+ fix: the edition’s page, bleed and marks are pulpweaver4.toml’s: change them there, or take this out of @page (a named page’s, `@page cover`, still applies)
234
+
235
+ 1 warning
236
+ pw build: letter: dist/letter/letter.pdf
237
+ ```
238
+
239
+ A named page’s still applies, in every edition: `@page cover { size: 6in 9in }`
240
+ sizes the pages that take `page: cover`. What the edition leaves out of
241
+ `pulpweaver4.toml`, `@page` still sets, so an edition with no `page` takes
242
+ the stylesheet’s `size`.
243
+
244
+ {#your-own-conditions}
245
+ ### Your own conditions
246
+
247
+ Declare more with `@custom-media`, as CSS Media Queries 5 proposes, and use
248
+ them like the editions’ names:
249
+
250
+ {project=editions}
251
+ ``` css
252
+ @custom-media --small-page (width < 6in);
253
+
254
+ @media (--small-page) {
255
+ :root { --pw-tolerance: 400; }
256
+ }
257
+ ```
258
+
259
+ {#print-knows-its-page}
260
+ ### Print knows its page
261
+
262
+ A print edition decides every media query against its own trimmed page,
263
+ never the window of the browser that builds it: `width` and `height` are the
264
+ page’s, `orientation` follows from them, `print` is true and `screen` false,
265
+ and `prefers-color-scheme` is `light`, so a print edition never turns dark.
266
+ `hover` is `none`, and a feature a page can’t decide is false, with a
267
+ warning.
268
+
269
+ A web edition leaves its media queries to the reader’s browser, as any site
270
+ does; only the editions’ names and your own conditions are decided when it
271
+ is built. `@media print` stays in the site’s stylesheet, for a reader who
272
+ prints a page.
273
+
274
+ {#layers}
275
+ ### Layers
276
+
277
+ The stylesheet goes over pulpweaver4’s own, in CSS cascade layers:
278
+ pulpweaver4’s defaults first (`@layer pw.defaults`, TeX’s parameters among
279
+ them), then the theme (`pw.theme`), then each plugin’s
280
+ (`pw.plugins.<name>`), then yours, unlayered, which wins over them all. You
281
+ never need `!important` to override a default.
282
+
283
+ `@import` isn’t allowed: put each stylesheet in `styles/`.
284
+
285
+ {#different-text-in-different-editions}
286
+ ## Different text in different editions
287
+
288
+ Media queries change how the book looks. To change what it says, mark a
289
+ block or span for some editions:
290
+
291
+ {project=editions}
292
+ ``` djot
293
+ {.print-only}
294
+ The first chapter starts on page [](#beginning){.page}.
295
+
296
+ {.edition-letter}
297
+ Printed at home? Print at actual size.
298
+ ```
299
+
300
+ [Writing in Djot](#content-for-some-editions) has the
301
+ whole of it: `.print-only`, `.screen-only` and `.edition-<name>`.
302
+
303
+ {#building-editions}
304
+ ## Building editions
305
+
306
+ `pw build` builds every edition; `pw build --edition paperback` builds one,
307
+ and `--edition` can be given more than once. Each edition’s folder in
308
+ `dist/` is emptied and written again; the others are left alone.
309
+
310
+ {#plugin-editions}
311
+ ## EPUB and reStructuredText
312
+
313
+ An EPUB and a reStructuredText edition come from the official plugins,
314
+ [`pulpweaver4-epub`](https://pulpweaver.inkylabs.com/plugins/epub) and
315
+ [`pulpweaver4-rst`](https://pulpweaver.inkylabs.com/plugins/rst):
316
+ `pw add pulpweaver4-epub` installs one and names it in `[plugins]`, and
317
+ the edition’s `output` asks for it. An EPUB edition’s `page-list` names
318
+ the print edition whose page numbers it lists, so a reader of the EPUB can
319
+ cite the printed book’s pages:
320
+
321
+ {.untested}
322
+ ``` toml
323
+ [editions.epub]
324
+ media = "screen"
325
+ output = "epub"
326
+ page-list = "paperback"
327
+ ```
328
+
329
+ Each plugin’s page says what its edition writes and takes.