paperlint 8.0.0 → 9.0.1

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 (393) hide show
  1. package/.github/CLAUDE.md +22 -0
  2. package/.github/CLAUDE.md.spec.ts +20 -0
  3. package/CLAUDE.md +59 -531
  4. package/CONTRIBUTING.md +7 -6
  5. package/README.md +4 -3
  6. package/dist/CLAUDE.md.spec.d.ts +3 -0
  7. package/dist/CLAUDE.md.spec.d.ts.map +1 -0
  8. package/dist/CLAUDE.md.spec.js +62 -0
  9. package/dist/CLAUDE.md.spec.js.map +1 -0
  10. package/dist/adapters/bibtex/index.d.ts +3 -0
  11. package/dist/adapters/bibtex/index.d.ts.map +1 -0
  12. package/dist/adapters/bibtex/index.js +103 -0
  13. package/dist/adapters/bibtex/index.js.map +1 -0
  14. package/dist/adapters/latex/filecontents.d.ts +33 -0
  15. package/dist/adapters/latex/filecontents.d.ts.map +1 -0
  16. package/dist/adapters/latex/filecontents.js +65 -0
  17. package/dist/adapters/latex/filecontents.js.map +1 -0
  18. package/dist/adapters/latex/includes.d.ts +3 -3
  19. package/dist/adapters/latex/includes.d.ts.map +1 -1
  20. package/dist/adapters/latex/includes.js +18 -10
  21. package/dist/adapters/latex/includes.js.map +1 -1
  22. package/dist/adapters/latex/index.d.ts.map +1 -1
  23. package/dist/adapters/latex/index.js +2 -0
  24. package/dist/adapters/latex/index.js.map +1 -1
  25. package/dist/adapters/latex/nodes.d.ts +12 -0
  26. package/dist/adapters/latex/nodes.d.ts.map +1 -1
  27. package/dist/adapters/latex/nodes.js +39 -0
  28. package/dist/adapters/latex/nodes.js.map +1 -1
  29. package/dist/adapters/latex/parse.d.ts +7 -1
  30. package/dist/adapters/latex/parse.d.ts.map +1 -1
  31. package/dist/adapters/latex/parse.js +55 -6
  32. package/dist/adapters/latex/parse.js.map +1 -1
  33. package/dist/adapters/memory/index.d.ts +3 -0
  34. package/dist/adapters/memory/index.d.ts.map +1 -1
  35. package/dist/adapters/memory/index.js +9 -0
  36. package/dist/adapters/memory/index.js.map +1 -1
  37. package/dist/adapters/references/index.d.ts.map +1 -1
  38. package/dist/adapters/references/index.js +27 -24
  39. package/dist/adapters/references/index.js.map +1 -1
  40. package/dist/adapters/sources-record/index.d.ts +9 -0
  41. package/dist/adapters/sources-record/index.d.ts.map +1 -0
  42. package/dist/adapters/sources-record/index.js +68 -0
  43. package/dist/adapters/sources-record/index.js.map +1 -0
  44. package/dist/adapters/tex-output/blg.d.ts +9 -0
  45. package/dist/adapters/tex-output/blg.d.ts.map +1 -0
  46. package/dist/adapters/tex-output/blg.js +20 -0
  47. package/dist/adapters/tex-output/blg.js.map +1 -0
  48. package/dist/adapters/tex-output/fls.d.ts +8 -0
  49. package/dist/adapters/tex-output/fls.d.ts.map +1 -0
  50. package/dist/adapters/tex-output/fls.js +16 -0
  51. package/dist/adapters/tex-output/fls.js.map +1 -0
  52. package/dist/adapters/tex-output/index.d.ts +7 -0
  53. package/dist/adapters/tex-output/index.d.ts.map +1 -0
  54. package/dist/adapters/tex-output/index.js +7 -0
  55. package/dist/adapters/tex-output/index.js.map +1 -0
  56. package/dist/bib-rules.d.ts +47 -0
  57. package/dist/bib-rules.d.ts.map +1 -0
  58. package/dist/bib-rules.js +127 -0
  59. package/dist/bib-rules.js.map +1 -0
  60. package/dist/build.d.ts +29 -1
  61. package/dist/build.d.ts.map +1 -1
  62. package/dist/build.js +41 -25
  63. package/dist/build.js.map +1 -1
  64. package/dist/claim-provenance.d.ts +2 -2
  65. package/dist/cli.d.ts +6 -1
  66. package/dist/cli.d.ts.map +1 -1
  67. package/dist/cli.js +30 -26
  68. package/dist/cli.js.map +1 -1
  69. package/dist/domain/paper-source.d.ts +1 -10
  70. package/dist/domain/paper-source.d.ts.map +1 -1
  71. package/dist/domain/paper-source.js +34 -24
  72. package/dist/domain/paper-source.js.map +1 -1
  73. package/dist/domain/paper-sources.d.ts +72 -0
  74. package/dist/domain/paper-sources.d.ts.map +1 -0
  75. package/dist/domain/paper-sources.js +18 -0
  76. package/dist/domain/paper-sources.js.map +1 -0
  77. package/dist/domain/sources-record.d.ts +102 -0
  78. package/dist/domain/sources-record.d.ts.map +1 -0
  79. package/dist/domain/sources-record.js +38 -0
  80. package/dist/domain/sources-record.js.map +1 -0
  81. package/dist/domain/tex-run.d.ts +25 -0
  82. package/dist/domain/tex-run.d.ts.map +1 -0
  83. package/dist/domain/tex-run.js +79 -0
  84. package/dist/domain/tex-run.js.map +1 -0
  85. package/dist/eslint-rules/CLAUDE.md.spec.d.ts +3 -0
  86. package/dist/eslint-rules/CLAUDE.md.spec.d.ts.map +1 -0
  87. package/dist/eslint-rules/CLAUDE.md.spec.js +39 -0
  88. package/dist/eslint-rules/CLAUDE.md.spec.js.map +1 -0
  89. package/dist/eslint-rules/install-path-literals.d.ts +1 -1
  90. package/dist/eslint-rules/install-path-literals.js +4 -4
  91. package/dist/eslint-rules/install-path-literals.js.map +1 -1
  92. package/dist/eslint-rules/paper-context.d.ts.map +1 -1
  93. package/dist/eslint-rules/paper-context.js +4 -3
  94. package/dist/eslint-rules/paper-context.js.map +1 -1
  95. package/dist/eslint-rules/paper-typography.d.ts +0 -9
  96. package/dist/eslint-rules/paper-typography.d.ts.map +1 -1
  97. package/dist/eslint-rules/paper-typography.js +12 -5
  98. package/dist/eslint-rules/paper-typography.js.map +1 -1
  99. package/dist/eslint-rules/pdf-last-page-balance.js +1 -1
  100. package/dist/latex-log.d.ts +10 -0
  101. package/dist/latex-log.d.ts.map +1 -1
  102. package/dist/latex-log.js +10 -0
  103. package/dist/latex-log.js.map +1 -1
  104. package/dist/latex-loop.d.ts +2 -0
  105. package/dist/latex-loop.d.ts.map +1 -1
  106. package/dist/latex-loop.js.map +1 -1
  107. package/dist/lib/agent-cli-version.js +1 -1
  108. package/dist/lib/agent-cli-version.js.map +1 -1
  109. package/dist/package-dirs.d.ts.map +1 -1
  110. package/dist/package-dirs.js +3 -2
  111. package/dist/package-dirs.js.map +1 -1
  112. package/dist/paper-includes.d.ts +4 -7
  113. package/dist/paper-includes.d.ts.map +1 -1
  114. package/dist/paper-includes.js +29 -21
  115. package/dist/paper-includes.js.map +1 -1
  116. package/dist/paper-prose.d.ts +2 -2
  117. package/dist/paper-record.d.ts +25 -0
  118. package/dist/paper-record.d.ts.map +1 -0
  119. package/dist/paper-record.js +39 -0
  120. package/dist/paper-record.js.map +1 -0
  121. package/dist/paper-sources.d.ts +66 -0
  122. package/dist/paper-sources.d.ts.map +1 -0
  123. package/dist/paper-sources.js +92 -0
  124. package/dist/paper-sources.js.map +1 -0
  125. package/dist/ports/bib-reader.d.ts +18 -0
  126. package/dist/ports/bib-reader.d.ts.map +1 -0
  127. package/dist/ports/bib-reader.js +2 -0
  128. package/dist/ports/bib-reader.js.map +1 -0
  129. package/dist/ports/check-references.d.ts +9 -4
  130. package/dist/ports/check-references.d.ts.map +1 -1
  131. package/dist/ports/latex.d.ts +15 -0
  132. package/dist/ports/latex.d.ts.map +1 -1
  133. package/dist/ports/sources-codec.d.ts +11 -0
  134. package/dist/ports/sources-codec.d.ts.map +1 -0
  135. package/dist/ports/sources-codec.js +2 -0
  136. package/dist/ports/sources-codec.js.map +1 -0
  137. package/dist/ports/tex-output.d.ts +17 -0
  138. package/dist/ports/tex-output.d.ts.map +1 -0
  139. package/dist/ports/tex-output.js +2 -0
  140. package/dist/ports/tex-output.js.map +1 -0
  141. package/dist/recorded-bibliography.d.ts +89 -0
  142. package/dist/recorded-bibliography.d.ts.map +1 -0
  143. package/dist/recorded-bibliography.js +136 -0
  144. package/dist/recorded-bibliography.js.map +1 -0
  145. package/dist/reference-rules.d.ts +5 -5
  146. package/dist/reference-rules.d.ts.map +1 -1
  147. package/dist/reference-rules.js +150 -77
  148. package/dist/reference-rules.js.map +1 -1
  149. package/dist/references.d.ts +71 -16
  150. package/dist/references.d.ts.map +1 -1
  151. package/dist/references.js +110 -26
  152. package/dist/references.js.map +1 -1
  153. package/dist/register-bands.d.ts +3 -3
  154. package/dist/register-bands.d.ts.map +1 -1
  155. package/dist/register-bands.js.map +1 -1
  156. package/dist/register.d.ts +2 -2
  157. package/dist/sources-record.d.ts +38 -0
  158. package/dist/sources-record.d.ts.map +1 -0
  159. package/dist/sources-record.js +123 -0
  160. package/dist/sources-record.js.map +1 -0
  161. package/dist/sources-rules.d.ts +44 -0
  162. package/dist/sources-rules.d.ts.map +1 -0
  163. package/dist/sources-rules.js +76 -0
  164. package/dist/sources-rules.js.map +1 -0
  165. package/dist/tex-paper.d.ts +10 -15
  166. package/dist/tex-paper.d.ts.map +1 -1
  167. package/dist/tex-paper.js +24 -40
  168. package/dist/tex-paper.js.map +1 -1
  169. package/dist/tex-requirements.js +1 -1
  170. package/dist/tex-venue-rules.d.ts +3 -3
  171. package/dist/tex-venue-rules.d.ts.map +1 -1
  172. package/dist/tex-venue-rules.js.map +1 -1
  173. package/dist/toolchain.js +1 -1
  174. package/docs/configuration.md +12 -4
  175. package/docs/design/paper-sources.md +197 -0
  176. package/docs/e2e.md +1 -1
  177. package/docs/incidents.md +5 -5
  178. package/docs/package-shape-options.md +1 -1
  179. package/docs/references.md +34 -8
  180. package/docs/rules/bib/reachable-entry.md +64 -0
  181. package/docs/rules/paper/sources-fresh.md +81 -0
  182. package/docs/rules.md +62 -57
  183. package/eslint-rules/CLAUDE.md +44 -0
  184. package/eslint-rules/CLAUDE.md.spec.ts +43 -0
  185. package/eslint-rules/install-path-literals.harness.mjs +1 -1
  186. package/eslint-rules/install-path-literals.ts +4 -4
  187. package/eslint-rules/paper-context.ts +4 -3
  188. package/eslint-rules/paper-typography.test.mjs +12 -72
  189. package/eslint-rules/paper-typography.ts +13 -6
  190. package/eslint-rules/pdf-last-page-balance.ts +1 -1
  191. package/eslint.config.mjs +28 -3
  192. package/fixtures/build-e2e/aidc/paper.tex +1 -1
  193. package/fixtures/build-e2e/anon-ack/paper.tex +1 -1
  194. package/fixtures/build-e2e/anon-author/paper.tex +1 -1
  195. package/fixtures/build-e2e/anon-bib/paper.tex +1 -1
  196. package/fixtures/build-e2e/anon-href/paper.tex +1 -1
  197. package/fixtures/build-e2e/anon-macro/paper.tex +1 -1
  198. package/fixtures/build-e2e/anon-pdfauthor/paper.tex +1 -1
  199. package/fixtures/paper-sources/p1/paper.tex +30 -0
  200. package/fixtures/paper-sources/p1/refs.bib +6 -0
  201. package/fixtures/paper-sources/p1/sections/dead.tex +6 -0
  202. package/fixtures/paper-sources/p1/sections/intro.tex +7 -0
  203. package/fixtures/paper-sources/p1/sections/parked.tex +6 -0
  204. package/fixtures/paper-sources/p1/tex-truth.json +37 -0
  205. package/fixtures/paper-sources/p1/versions/2026-01-01-review.tex +4 -0
  206. package/fixtures/paper-sources/v1-stale/paper.tex +14 -0
  207. package/fixtures/paper-sources/v1-stale/refs.bib +6 -0
  208. package/fixtures/paper-sources/v1-stale/tex-truth.json +32 -0
  209. package/fixtures/paper-sources/v10-ifthenelse/anon.bib +1 -0
  210. package/fixtures/paper-sources/v10-ifthenelse/paper.tex +9 -0
  211. package/fixtures/paper-sources/v10-ifthenelse/real.bib +1 -0
  212. package/fixtures/paper-sources/v10-ifthenelse/tex-truth.json +28 -0
  213. package/fixtures/paper-sources/v11-two-blocks/paper.tex +12 -0
  214. package/fixtures/paper-sources/v11-two-blocks/tex-truth.json +30 -0
  215. package/fixtures/paper-sources/v13-percent-text/paper.tex +6 -0
  216. package/fixtures/paper-sources/v13-percent-text/refs.bib +3 -0
  217. package/fixtures/paper-sources/v13-percent-text/tex-truth.json +30 -0
  218. package/fixtures/paper-sources/v15-after-end/paper.tex +6 -0
  219. package/fixtures/paper-sources/v15-after-end/refs.bib +1 -0
  220. package/fixtures/paper-sources/v15-after-end/tex-truth.json +17 -0
  221. package/fixtures/paper-sources/v16-included-block/bibblock.tex +3 -0
  222. package/fixtures/paper-sources/v16-included-block/paper.tex +7 -0
  223. package/fixtures/paper-sources/v16-included-block/refs.bib +1 -0
  224. package/fixtures/paper-sources/v16-included-block/tex-truth.json +35 -0
  225. package/fixtures/paper-sources/v17-include-order/bibsetup.tex +1 -0
  226. package/fixtures/paper-sources/v17-include-order/first.bib +1 -0
  227. package/fixtures/paper-sources/v17-include-order/later.bib +1 -0
  228. package/fixtures/paper-sources/v17-include-order/paper.tex +7 -0
  229. package/fixtures/paper-sources/v17-include-order/tex-truth.json +40 -0
  230. package/fixtures/paper-sources/v2-overwrite/paper.tex +14 -0
  231. package/fixtures/paper-sources/v2-overwrite/refs.bib +6 -0
  232. package/fixtures/paper-sources/v2-overwrite/tex-truth.json +30 -0
  233. package/fixtures/paper-sources/v22-parked-thebibliography/paper.tex +7 -0
  234. package/fixtures/paper-sources/v22-parked-thebibliography/tex-truth.json +17 -0
  235. package/fixtures/paper-sources/v23-parked-include/old.bib +1 -0
  236. package/fixtures/paper-sources/v23-parked-include/paper.tex +7 -0
  237. package/fixtures/paper-sources/v23-parked-include/parked.tex +1 -0
  238. package/fixtures/paper-sources/v23-parked-include/refs.bib +1 -0
  239. package/fixtures/paper-sources/v23-parked-include/tex-truth.json +28 -0
  240. package/fixtures/paper-sources/v24-quoted-fields/paper.tex +6 -0
  241. package/fixtures/paper-sources/v24-quoted-fields/refs.bib +5 -0
  242. package/fixtures/paper-sources/v24-quoted-fields/tex-truth.json +32 -0
  243. package/fixtures/paper-sources/v25-string-differs/paper.tex +10 -0
  244. package/fixtures/paper-sources/v25-string-differs/refs.bib +2 -0
  245. package/fixtures/paper-sources/v25-string-differs/tex-truth.json +32 -0
  246. package/fixtures/paper-sources/v26-comment-in-names/one.bib +1 -0
  247. package/fixtures/paper-sources/v26-comment-in-names/paper.tex +7 -0
  248. package/fixtures/paper-sources/v26-comment-in-names/tex-truth.json +32 -0
  249. package/fixtures/paper-sources/v26-comment-in-names/two.bib +1 -0
  250. package/fixtures/paper-sources/v27-shared-string/abbreviations.bib +2 -0
  251. package/fixtures/paper-sources/v27-shared-string/paper.tex +6 -0
  252. package/fixtures/paper-sources/v27-shared-string/references.bib +6 -0
  253. package/fixtures/paper-sources/v27-shared-string/tex-truth.json +31 -0
  254. package/fixtures/paper-sources/v28-shared-string-block/abbreviations.bib +2 -0
  255. package/fixtures/paper-sources/v28-shared-string-block/paper.tex +14 -0
  256. package/fixtures/paper-sources/v28-shared-string-block/tex-truth.json +33 -0
  257. package/fixtures/paper-sources/v29-generated-input/paper.tex +9 -0
  258. package/fixtures/paper-sources/v29-generated-input/tex-truth.json +24 -0
  259. package/fixtures/paper-sources/v3-declared/paper.bib +6 -0
  260. package/fixtures/paper-sources/v3-declared/paper.tex +6 -0
  261. package/fixtures/paper-sources/v3-declared/tex-truth.json +28 -0
  262. package/fixtures/paper-sources/v30-name-next-line/paper.tex +14 -0
  263. package/fixtures/paper-sources/v30-name-next-line/tex-truth.json +30 -0
  264. package/fixtures/paper-sources/v4-commented/paper.tex +14 -0
  265. package/fixtures/paper-sources/v4-commented/refs.bib +6 -0
  266. package/fixtures/paper-sources/v4-commented/tex-truth.json +28 -0
  267. package/fixtures/paper-sources/v5-percent-entry/paper.tex +20 -0
  268. package/fixtures/paper-sources/v5-percent-entry/tex-truth.json +37 -0
  269. package/fixtures/paper-sources/v6-unclosed/paper.tex +6 -0
  270. package/fixtures/paper-sources/v6-unclosed/refs.bib +5 -0
  271. package/fixtures/paper-sources/v6-unclosed/tex-truth.json +37 -0
  272. package/fixtures/paper-sources/v8-jobname/paper.tex +9 -0
  273. package/fixtures/paper-sources/v8-jobname/tex-truth.json +30 -0
  274. package/fixtures/paper-sources/v9-two-bibliographies/one.bib +1 -0
  275. package/fixtures/paper-sources/v9-two-bibliographies/paper.tex +7 -0
  276. package/fixtures/paper-sources/v9-two-bibliographies/tex-truth.json +35 -0
  277. package/fixtures/paper-sources/v9-two-bibliographies/two.bib +1 -0
  278. package/fixtures/paper-typography/clean-paper/paper.tex +1 -1
  279. package/fixtures/paper-typography/messy-paper/paper.tex +1 -1
  280. package/hooks/CLAUDE.md +34 -0
  281. package/hooks/CLAUDE.md.spec.ts +30 -0
  282. package/lib/agent-cli-version.ts +1 -1
  283. package/package.json +3 -11
  284. package/plugin/CLAUDE.md +22 -0
  285. package/plugin/CLAUDE.md.spec.ts +22 -0
  286. package/scripts/check.test.ts +23 -1
  287. package/scripts/check.ts +7 -3
  288. package/scripts/coverage-config.test.ts +21 -11
  289. package/scripts/layer-legacy-frozen.test.ts +41 -2
  290. package/scripts/layer-legacy-frozen.ts +31 -2
  291. package/skills/CLAUDE.md +19 -0
  292. package/skills/CLAUDE.md.spec.ts +18 -0
  293. package/skills/grade-paper-writing/SKILL.md +4 -3
  294. package/skills/grade-paper-writing/SKILL.md.spec.ts +3 -2
  295. package/skills/grade-paper-writing/prose-lint.mjs +11 -2
  296. package/skills/grade-paper-writing/prose-lint.test.ts +52 -4
  297. package/skills/paper-pipeline/scripts/extract-ref-facts.harness.mjs +83 -33
  298. package/skills/paper-pipeline/scripts/extract-ref-facts.mjs +67 -115
  299. package/skills/paper-pipeline/scripts/extract-ref-facts.test.mjs +128 -121
  300. package/skills/plan-paper-timeline/plan-paper-timeline.effects.harness.mjs +21 -102
  301. package/skills/verify-citations/SKILL.md +7 -4
  302. package/skills/verify-citations/SKILL.md.spec.ts +6 -3
  303. package/skills/verify-citations/scripts/bib-authors.check.test.mjs +17 -19
  304. package/skills/verify-citations/scripts/bib-authors.cli.test.ts +129 -46
  305. package/skills/verify-citations/scripts/bib-authors.d.mts +22 -2
  306. package/skills/verify-citations/scripts/bib-authors.mjs +57 -111
  307. package/skills/verify-citations/scripts/verify-cites.cli.test.ts +16 -0
  308. package/skills/verify-citations/scripts/verify-cites.d.mts +19 -3
  309. package/skills/verify-citations/scripts/verify-cites.mjs +42 -108
  310. package/skills/verify-citations/scripts/verify-cites.test.mjs +23 -36
  311. package/src/CLAUDE.md +23 -1
  312. package/src/CLAUDE.md.spec.ts +72 -0
  313. package/src/adapters/bibtex/index.test.ts +163 -0
  314. package/src/adapters/bibtex/index.ts +155 -0
  315. package/src/adapters/latex/filecontents.ts +114 -0
  316. package/src/adapters/latex/includes.ts +18 -10
  317. package/src/adapters/latex/index.test.ts +73 -0
  318. package/src/adapters/latex/index.ts +2 -0
  319. package/src/adapters/latex/nodes.ts +64 -0
  320. package/src/adapters/latex/parse.test.ts +38 -0
  321. package/src/adapters/latex/parse.ts +67 -6
  322. package/src/adapters/memory/index.ts +17 -0
  323. package/src/adapters/references/index.test.ts +75 -21
  324. package/src/adapters/references/index.ts +37 -32
  325. package/src/adapters/sources-record/index.test.ts +87 -0
  326. package/src/adapters/sources-record/index.ts +82 -0
  327. package/src/adapters/tex-output/blg.ts +27 -0
  328. package/src/adapters/tex-output/fls.ts +24 -0
  329. package/src/adapters/tex-output/index.test.ts +171 -0
  330. package/src/adapters/tex-output/index.ts +12 -0
  331. package/src/bib-rules.test.ts +356 -0
  332. package/src/bib-rules.ts +228 -0
  333. package/src/bibliography-at.test.ts +286 -0
  334. package/src/build.test.ts +210 -0
  335. package/src/build.ts +101 -36
  336. package/src/claim-provenance.test.ts +33 -7
  337. package/src/claim-provenance.ts +2 -2
  338. package/src/cli.harness.mjs +20 -10
  339. package/src/cli.test.ts +14 -10
  340. package/src/cli.ts +37 -28
  341. package/src/domain/paper-source.test.ts +58 -20
  342. package/src/domain/paper-source.ts +38 -42
  343. package/src/domain/paper-sources.ts +94 -0
  344. package/src/domain/sources-record.test.ts +71 -0
  345. package/src/domain/sources-record.ts +136 -0
  346. package/src/domain/tex-run.test.ts +228 -0
  347. package/src/domain/tex-run.ts +139 -0
  348. package/src/heading-case.test.ts +24 -10
  349. package/src/latex-log.ts +20 -0
  350. package/src/latex-loop.harness.ts +1 -0
  351. package/src/latex-loop.ts +2 -0
  352. package/src/linted-set.test.ts +9 -1
  353. package/src/new-paper.harness.mjs +3 -2
  354. package/src/new-paper.test.ts +9 -5
  355. package/src/package-dirs.ts +3 -2
  356. package/src/paper-includes.test.ts +157 -38
  357. package/src/paper-includes.ts +39 -35
  358. package/src/paper-prose.test.ts +34 -5
  359. package/src/paper-prose.ts +2 -2
  360. package/src/paper-record.test.ts +173 -0
  361. package/src/paper-record.ts +66 -0
  362. package/src/paper-settings-commands.test.ts +5 -2
  363. package/src/paper-sources.ts +151 -0
  364. package/src/ports/bib-reader.ts +27 -0
  365. package/src/ports/check-references.ts +7 -3
  366. package/src/ports/latex.ts +19 -0
  367. package/src/ports/sources-codec.ts +11 -0
  368. package/src/ports/tex-output.ts +17 -0
  369. package/src/recorded-bibliography.ts +297 -0
  370. package/src/reference-rules.ts +217 -104
  371. package/src/references.test.ts +520 -177
  372. package/src/references.ts +185 -37
  373. package/src/register-bands.test.ts +5 -1
  374. package/src/register-bands.ts +3 -5
  375. package/src/register.test.ts +6 -1
  376. package/src/register.ts +2 -2
  377. package/src/rule-cases.test.ts +68 -12
  378. package/src/rule-docs.test.ts +0 -1
  379. package/src/sources-record.test.ts +308 -0
  380. package/src/sources-record.ts +231 -0
  381. package/src/sources-rules.test.ts +152 -0
  382. package/src/sources-rules.ts +117 -0
  383. package/src/tex-paper.test.ts +148 -78
  384. package/src/tex-paper.ts +31 -61
  385. package/src/tex-requirements.ts +1 -1
  386. package/src/tex-venue-rules.test.ts +36 -8
  387. package/src/tex-venue-rules.ts +3 -5
  388. package/src/toolchain.ts +1 -1
  389. package/dist/eslint-rules/bib-reachable-entry.d.ts +0 -22
  390. package/dist/eslint-rules/bib-reachable-entry.d.ts.map +0 -1
  391. package/dist/eslint-rules/bib-reachable-entry.js +0 -75
  392. package/dist/eslint-rules/bib-reachable-entry.js.map +0 -1
  393. package/eslint-rules/bib-reachable-entry.ts +0 -76
package/CONTRIBUTING.md CHANGED
@@ -40,10 +40,11 @@ by printing **which CI jobs it does not reproduce, and why**.
40
40
  that broke the suite: the gates were run afterwards and were green, but `npm test` and the
41
41
  install e2e were not among them, because there were eleven separate scripts and the only way
42
42
  to run them all was from memory. A subset flag re-creates exactly that — the cheap half gets run
43
- and reported as "the gates". If a step genuinely cannot run here, it says so out loud rather than
44
- being skipped quietly: an e2e test that finds no TeX or no pnpm is reported SKIPPED by vitest,
45
- and `npm run check` reads that count from vitest's JSON report and lists the gate as skipped
46
- instead of counting it as passed. The e2e areas also run alone: `npm run test:e2e:install`,
43
+ and reported as "the gates". Every gate runs with `CI=true`, as in CI, so the local check is the
44
+ CI check: libraries read it (typescript-eslint parses from disk in a single run; vitest refuses
45
+ `.only` and writes no snapshot), and the e2e tests are strict — one that finds no TeX or no pnpm
46
+ FAILS with what to install, as it does in CI. A test that still skips is read from vitest's JSON
47
+ report and listed as skipped, never counted as passed. The e2e areas also run alone: `npm run test:e2e:install`,
47
48
  `npm run test:e2e:tex`, or both with `npm run test:e2e`.
48
49
 
49
50
  Each gate's command is listed in `scripts/check.ts`; run one of them directly while iterating on
@@ -78,7 +79,7 @@ Most of the package's rules run on users' papers and are described for users in
78
79
  files.
79
80
 
80
81
  One rule checks one requirement, and a rule that judges a venue requirement is validated on real
81
- accepted papers built to PDF — both in [`CLAUDE.md`](CLAUDE.md#the-ten-rules-that-decide-what-may-live-here--and-what-may-not-be-written), rule 3.
82
+ accepted papers built to PDF — both in [`eslint-rules/CLAUDE.md`](eslint-rules/CLAUDE.md).
82
83
 
83
84
  A new rule ships with its page, `docs/rules/<group>/<rule>.md`, in these sections: What it
84
85
  catches · Why · Examples (failing / passing) · Options / preset fields · What it does not check ·
@@ -92,7 +93,7 @@ length, markers, hedges — drives papers toward clipped, unsignposted prose tha
92
93
  blog post, so a new one also has a floor, or measures the distance to accepted papers of the target
93
94
  venue, with its threshold measured by the same counter on those papers. What the parse tree can
94
95
  count is a rule; what needs reading (register, genre) is a skill criterion. The five principles are
95
- in [`CLAUDE.md`](CLAUDE.md#writing-checks--what-keeps-them-from-pushing-papers-toward-a-blog-post).
96
+ in [`eslint-rules/CLAUDE.md`](eslint-rules/CLAUDE.md#a-rule-that-judges-prose).
96
97
 
97
98
  ## Maintainer docs
98
99
 
package/README.md CHANGED
@@ -203,9 +203,10 @@ Every skill, by stage: [`docs/skills.md`](docs/skills.md).
203
203
  asks only about new or edited entries (and answers older than 30 days), so an unchanged
204
204
  bibliography usually builds without the network ([`docs/references.md`](docs/references.md)).
205
205
  - A paper whose body is in other files (`\input{sections/intro}`) is linted file by file: a finding
206
- lands at the file and line it is in, and `--fix` edits that file. The files are the ones
207
- `paper.tex` includes from its body, found where the build finds them — not every `.tex` beside it,
208
- and not an included `.bbl` (a tool's output, read only as part of the whole paper).
206
+ lands at the file and line it is in, and `--fix` edits that file. The files are the ones TeX read
207
+ after `\begin{document}` in the last build (`_build/sources.json`) — not every `.tex` beside it,
208
+ and not an included `.bbl` (a tool's output, read only as part of the whole paper). A paper that
209
+ was not built, or changed since, is linted as `paper.tex` alone, and `paper/sources-fresh` says so.
209
210
  - Lint also checks the pipeline's own records: `PIPELINE-STATUS.md`, reviews, notes on related
210
211
  papers ([`docs/rules.md`](docs/rules.md)).
211
212
  - The rules run on ESLint, so a deliberate exception is a comment on the line above:
@@ -0,0 +1,3 @@
1
+ declare const _default: import("vigiles/spec").ClaudeSpec;
2
+ export default _default;
3
+ //# sourceMappingURL=CLAUDE.md.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CLAUDE.md.spec.d.ts","sourceRoot":"","sources":["../src/CLAUDE.md.spec.ts"],"names":[],"mappings":";AAGA,wBAoEG"}
@@ -0,0 +1,62 @@
1
+ // Compiled to src/CLAUDE.md by `npx vigiles compile`. Edit THIS file, never the markdown.
2
+ import { enforce, file, instructionFile, prose } from "vigiles/spec";
3
+ export default instructionFile({
4
+ sections: {
5
+ "`src/`": prose `The package's TypeScript: the CLI, the build, the toolchain installer, and the measuring that feeds
6
+ the facts file. Loaded when working under \`src/\`; the repository-wide rules are in the root
7
+ \`CLAUDE.md\`.`,
8
+ "The two layer axes": prose `**\`src/\` is hexagonal on two axes, and the linter enforces both** (\`eslint.config.mjs\`; fixtures in
9
+ \`test/fixtures/layers/\`, run by ${file("test/eslint-layers.test.ts")}; issue #76).
10
+
11
+ **Axis A — knowledge. Core means the DOMAIN, not "no I/O".** A file belongs to an adapter when it
12
+ exists because of one external program or format: _if banal / pdf.js / TeX Live / ESLint / Claude
13
+ Code disappeared tomorrow, which files would change? Those are its adapter, wherever they sit
14
+ today._ The domain is what would not change if every one of them were swapped. Purity is not the
15
+ test — a parser for banal's JSON is pure and is still banal's.
16
+
17
+ | element | where | holds | may import |
18
+ | --------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------- |
19
+ | \`domain\` | \`src/domain/\` | values and decisions in the paper's vocabulary | \`domain\`; \`ts-essentials\`, \`node:path\`, \`node:crypto\` |
20
+ | \`port\` | \`src/ports/\` | interfaces **shaped by what the inside needs**, never by what a tool does (Graça: "created to fit the Application Core needs and not simply mimic the tools APIs") | \`domain\`, \`port\`; the same three externals |
21
+ | \`app\` | \`src/*.ts\` | use cases over ports; **no I/O defaults** — a use case without its deps does not compile | \`domain\`, \`port\`, \`app\`, the package's \`.mjs\`; Node's \`util\`/\`url\`/\`module\` |
22
+ | \`adapter\` | \`src/adapters/<tool>/\` | everything that knows \`<tool>\` exists, pure parsers included; used through its \`index.ts\` | \`domain\`, \`port\`, its own folder, its tool's packages, the package's \`.mjs\`. **Never** \`app\`, **never** another adapter |
23
+ | \`root\` | \`src/cli.ts\` | reads \`process.*\`, builds adapters, wires ports | anything |
24
+
25
+ Folders are ELEMENTS of \`eslint-plugin-boundaries\`, single files are CATEGORIES (\`root\`, \`app\`,
26
+ \`test\`, \`io\`): v7 matches element patterns as folders. Everyone — tests included — reaches an
27
+ adapter through its \`index.ts\`; the files inside one adapter import each other freely.
28
+
29
+ **Axis B — purity.** An effect (disk, process, network, env, clock, TTY) may be written only in
30
+ \`src/adapters/<tool>/<x>.io.ts\` and \`src/cli.ts\`. Every other file, adapters' parsers included,
31
+ takes a port. Test: _can a call here fail for a reason not in its arguments?_ Imports are checked
32
+ through the \`io\` file category in \`boundaries/dependencies\`; the \`process\` and \`fetch\` globals by
33
+ \`no-restricted-globals\`.
34
+
35
+ **The legacy app files are held by a ratchet, not exempted.** A site that still breaks either axis
36
+ carries \`// eslint-disable-next-line <rule> -- legacy <I/O|layer>, moves behind a port in #76\`.
37
+ Unused directives are errors (\`reportUnusedDisableDirectives\`), so a fixed site must drop its
38
+ comment; the per-file counts are frozen in \`scripts/layer-legacy.frozen.json\` and checked by
39
+ ${file("scripts/layer-legacy-frozen.ts")} (\`npm run check\`, CI), which counts ESLint's own
40
+ \`suppressedMessages\` and fails when a file's count grows, a file not in the list carries one, or
41
+ anything under \`src/domain/\`, \`src/ports/\` or \`src/adapters/\` does. A NEW module that needs the
42
+ world is a new \`*.io.ts\` in the adapter of the program it talks to — never a new directive.
43
+
44
+ Parse at the boundary, into types that cannot hold an invalid state (a banal path that exists only
45
+ after its sha256 and probe passed; a \`Ready\` only an installer mints; an outcome as a discriminated
46
+ union, not a string); the inside never re-validates.
47
+
48
+ ⚠️ **Two settings are load-bearing.** \`boundaries/root-path\`: without it the plugin matches paths
49
+ against \`process.cwd()\`, so lint started from any other directory classifies nothing and passes.
50
+ \`checkAllOrigins: true\`: without it no \`module:\` policy is evaluated, so axis B and the library bans
51
+ report nothing — dropping it turns the fixtures \`src/domain/reads-disk.ts\` and
52
+ \`src/adapters/one/disk.ts\` clean (measured).`,
53
+ "Readers and commands": prose `\`@retorquere/bibtex-parser\` is the one \`.bib\` reader, behind ${file("src/ports/bib-reader.ts")}.
54
+ Rejected on 2026-09-27, so not proposed again: a separate \`paperlint refs\` command; the slowness it
55
+ would have moved was a cache thrown away after every build (${file("docs/references.md")}).`,
56
+ },
57
+ rules: {
58
+ layers: enforce("eslint/boundaries/dependencies", "Both axes: what a layer may import, and where an effect may be written.", { render: "id" }),
59
+ "effect-globals": enforce("eslint/no-restricted-globals", "The process and fetch globals only where an effect may be written.", { render: "id" }),
60
+ },
61
+ });
62
+ //# sourceMappingURL=CLAUDE.md.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CLAUDE.md.spec.js","sourceRoot":"","sources":["../src/CLAUDE.md.spec.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErE,eAAe,eAAe,CAAC;IAC7B,QAAQ,EAAE;QACR,QAAQ,EAAE,KAAK,CAAA;;eAEJ;QAEX,oBAAoB,EAAE,KAAK,CAAA;oCACK,IAAI,CAAC,4BAA4B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8BpE,IAAI,CAAC,gCAAgC,CAAC;;;;;;;;;;;;;+CAaO;QAE3C,sBAAsB,EAAE,KAAK,CAAA,oEAAoE,IAAI,CAAC,yBAAyB,CAAC;;8DAEtE,IAAI,CAAC,oBAAoB,CAAC,IAAI;KACzF;IACD,KAAK,EAAE;QACL,MAAM,EAAE,OAAO,CACb,gCAAgC,EAChC,yEAAyE,EACzE,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;QACD,gBAAgB,EAAE,OAAO,CACvB,8BAA8B,EAC9B,oEAAoE,EACpE,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;KACF;CACF,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { BibReader } from "../../ports/bib-reader.ts";
2
+ export declare const bibReader: BibReader;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/bibtex/index.ts"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAkH3D,eAAO,MAAM,SAAS,EAAE,SAIvB,CAAC"}
@@ -0,0 +1,103 @@
1
+ /**
2
+ * The bibtex reader over `@retorquere/bibtex-parser` — the one `.bib` reader of paperlint
3
+ * (`src/ports/bib-reader.ts`).
4
+ *
5
+ * It reads a well-formed database as bibtex does: entries, fields (LaTeX read into text, so `{\"u}`
6
+ * is `ü` and `\url{x}` a link), name lists split into names, `@string`s expanded, `@preamble`. A
7
+ * second reading keeps each field as bibtex takes it, LaTeX as written: what two databases are
8
+ * compared by (`sameDatabase`), where `{\"u}` and `ü` must stay different. A malformed
9
+ * database is bibtex's to report: the build runs bibtex and fails with bibtex's own lines. The two
10
+ * readers also differ on one well-formed shape: bibtex has no comment syntax, so an entry behind
11
+ * `%` or inside `@comment{…}` is one bibtex reads and this reader does not. The build records what
12
+ * bibtex read, and `paper/refs-checked` names such an entry (`src/references.ts`).
13
+ *
14
+ * The parser gives each entry's text (`input`), not its place: each is found in the body in order.
15
+ *
16
+ * A database read after others starts with the `@string`s they left in force (`inherited`), as bibtex
17
+ * reads a paper's databases in sequence with one table of them: the parser takes them as its table of
18
+ * predefined `@string`s, which the database's own definitions override from where they stand. Each
19
+ * database is still parsed as its own text, so every entry keeps its place in the file that holds it.
20
+ */
21
+ import { parse, } from "@retorquere/bibtex-parser";
22
+ /** A title as written, not sentence-cased; no field kept as raw LaTeX. */
23
+ const OPTIONS = { sentenceCase: false, verbatimFields: [] };
24
+ /**
25
+ * Every field as bibtex takes it: `@string`s expanded where they are used, LaTeX left as written (no
26
+ * conversion, no name split, no outer braces dropped).
27
+ */
28
+ const AS_WRITTEN = {
29
+ raw: true,
30
+ sentenceCase: false,
31
+ verbatimFields: [/.*/],
32
+ removeOuterBraces: [],
33
+ };
34
+ /** A name's parts, those it has: the parser leaves the others out. */
35
+ const nameOf = (c) => Object.fromEntries(Object.entries({
36
+ lastName: c.lastName,
37
+ firstName: c.firstName,
38
+ prefix: c.prefix,
39
+ suffix: c.suffix,
40
+ name: c.name,
41
+ }).filter((kv) => kv[1] !== undefined));
42
+ const isText = (x) => typeof x === "string";
43
+ const isName = (x) => typeof x === "object" && x !== null;
44
+ /** An entry's fields and name lists, from the parser's one record of both. */
45
+ function fieldsOf(e) {
46
+ const pairs = Object.entries(e.fields);
47
+ const isNames = (k) => e.mode[k] === "creatorlist";
48
+ return {
49
+ // A list field (`keywords`, `publisher`) is joined as BibTeX writes it.
50
+ fields: Object.fromEntries(pairs
51
+ .filter(([k]) => !isNames(k))
52
+ .map(([k, v]) => [k, [v].flat().filter(isText).join(" and ")])),
53
+ names: Object.fromEntries(pairs
54
+ .filter(([k]) => isNames(k))
55
+ .map(([k, v]) => [k, [v].flat().filter(isName).map(nameOf)])),
56
+ };
57
+ }
58
+ /** Each entry the parser read, placed in the text: found in `source` in order, `source` at `offset`. */
59
+ function placed(parsed, source, offset) {
60
+ return parsed.reduce((acc, e) => {
61
+ const at = source.indexOf(e.input, acc.from);
62
+ const end = at + e.input.length;
63
+ const span = { start: offset + at, end: offset + end };
64
+ const entry = { type: e.type.toLowerCase(), key: e.key, span };
65
+ return { from: end, found: [...acc.found, { ...entry, ...fieldsOf(e) }] };
66
+ }, { from: 0, found: [] }).found;
67
+ }
68
+ /** The entries the parser finished: one it could not keeps no text — it is malformed, and bibtex reports it. */
69
+ const finished = (lib) => lib.entries.filter((e) => e.input !== "");
70
+ /** An entry as bibtex takes it; a list field (`keywords`) as one value. */
71
+ const writtenOf = (e) => ({
72
+ type: e.type.toLowerCase(),
73
+ key: e.key,
74
+ fields: Object.fromEntries(Object.entries(e.fields).map(([k, v]) => [
75
+ k,
76
+ [v].flat().filter(isText).join(", "),
77
+ ])),
78
+ });
79
+ /**
80
+ * The database in `body` of `text`, the text of the file at `path`, read with the `@string`s
81
+ * `inherited` in force. The parser is handed a copy of them: it writes into its own.
82
+ */
83
+ function read(path, text, body, inherited = {}) {
84
+ const source = text.slice(body.start, body.end);
85
+ const lib = parse(source, { ...OPTIONS, strings: { ...inherited } });
86
+ const asWritten = parse(source, { ...AS_WRITTEN, strings: { ...inherited } });
87
+ return {
88
+ path,
89
+ text,
90
+ body,
91
+ entries: placed(finished(lib), source, body.start),
92
+ written: finished(asWritten).map(writtenOf),
93
+ preamble: lib.preamble,
94
+ inherited,
95
+ // Its own as bibtex takes them: the reading that keeps LaTeX as written.
96
+ strings: { ...inherited, ...asWritten.strings },
97
+ };
98
+ }
99
+ export const bibReader = {
100
+ read,
101
+ readFile: (path, text, inherited) => read(path, text, { start: 0, end: text.length }, inherited),
102
+ };
103
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/bibtex/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACL,KAAK,GAKN,MAAM,2BAA2B,CAAC;AAYnC,0EAA0E;AAC1E,MAAM,OAAO,GAAsB,EAAE,YAAY,EAAE,KAAK,EAAE,cAAc,EAAE,EAAE,EAAE,CAAC;AAE/E;;;GAGG;AACH,MAAM,UAAU,GAAsB;IACpC,GAAG,EAAE,IAAI;IACT,YAAY,EAAE,KAAK;IACnB,cAAc,EAAE,CAAC,IAAI,CAAC;IACtB,iBAAiB,EAAE,EAAE;CACtB,CAAC;AAEF,sEAAsE;AACtE,MAAM,MAAM,GAAG,CAAC,CAAoB,EAAW,EAAE,CAC/C,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC;IACb,QAAQ,EAAE,CAAC,CAAC,QAAQ;IACpB,SAAS,EAAE,CAAC,CAAC,SAAS;IACtB,MAAM,EAAE,CAAC,CAAC,MAAM;IAChB,MAAM,EAAE,CAAC,CAAC,MAAM;IAChB,IAAI,EAAE,CAAC,CAAC,IAAI;CACb,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,EAA0B,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAC/D,CAAC;AAEJ,MAAM,MAAM,GAAG,CAAC,CAAU,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC;AAClE,MAAM,MAAM,GAAG,CAAC,CAAU,EAA0B,EAAE,CACpD,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,CAAC;AAEtC,8EAA8E;AAC9E,SAAS,QAAQ,CAAC,CAAkB;IAClC,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAA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MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IAChD,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,EAAE,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,EAAE,GAAG,SAAS,EAAE,EAAE,CAAC,CAAC;IACrE,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,EAAE,EAAE,GAAG,UAAU,EAAE,OAAO,EAAE,EAAE,GAAG,SAAS,EAAE,EAAE,CAAC,CAAC;IAC9E,OAAO;QACL,IAAI;QACJ,IAAI;QACJ,IAAI;QACJ,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC;QAClD,OAAO,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC;QAC3C,QAAQ,EAAE,GAAG,CAAC,QAAQ;QACtB,SAAS;QACT,yEAAyE;QACzE,OAAO,EAAE,EAAE,GAAG,SAAS,EAAE,GAAG,SAAS,CAAC,OAAO,EAAE;KAChD,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,SAAS,GAAc;IAClC,IAAI;IACJ,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,CAClC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,SAAS,CAAC;CAC9D,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * THE `filecontents` BLOCKS OF A SOURCE — where a `.bib` TeX wrote stands in the text that wrote it.
3
+ * Read from the parse tree, never decided: which file a block writes, and whether TeX ran it, is
4
+ * TeX's answer (`written` in `_build/sources.json`); this reader only says where each block's text
5
+ * is, so a finding about an entry TeX read can be shown at the block that holds it
6
+ * (docs/design/paper-sources.md §1).
7
+ *
8
+ * unified-latex reads a `filecontents` environment as verbatim; its option and file name are the
9
+ * first things in that node, white space between them — a line break too: `\begin{filecontents*}` with
10
+ * `{refs.bib}` on the next line writes `refs.bib` (measured with pdflatex) — and its body starts on the
11
+ * line after the name, as LaTeX's own reader starts it.
12
+ * A block is live when the tree keeps it: a comment is a node of its own, `\iffalse … \fi` is cut at
13
+ * parse (`conditionals.ts`), and nothing after `\end{document}` is read (`liveRoot`).
14
+ */
15
+ import type * as Ast from "@unified-latex/unified-latex-types";
16
+ import type { Filecontents } from "../../ports/latex.ts";
17
+ import { type ArgumentPiece } from "./nodes.ts";
18
+ import { type ParsedTex } from "./parse.ts";
19
+ /** Names and options as TeX reads them: off the tree, a comma between two names. */
20
+ type Name = readonly ArgumentPiece[];
21
+ /** What a name or an option is written as: its pieces joined, white space trimmed off. */
22
+ export declare const written: (name: Name) => string;
23
+ /**
24
+ * One verbatim `filecontents` node as a block: its name, option, and body. unified-latex reads the
25
+ * whole environment as verbatim, so its text is parsed on its own and the name read off that tree like
26
+ * a declaration's (`headOf`). The body starts on the line after the one the name ends on; what TeX
27
+ * ignores after the name on that line is no body.
28
+ */
29
+ export declare function blockOf(src: string, n: Readonly<Ast.VerbatimEnvironment>, jobname: string): readonly Filecontents[];
30
+ /** Every live `filecontents` block of a source whose main file's name is `jobname`, in source order. */
31
+ export declare const filecontentsOf: (t: ParsedTex, jobname: string) => readonly Filecontents[];
32
+ export {};
33
+ //# sourceMappingURL=filecontents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filecontents.d.ts","sourceRoot":"","sources":["../../../src/adapters/latex/filecontents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,KAAK,GAAG,MAAM,oCAAoC,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAML,KAAK,aAAa,EAEnB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAwB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAOlE,oFAAoF;AACpF,KAAK,IAAI,GAAG,SAAS,aAAa,EAAE,CAAC;AAErC,0FAA0F;AAC1F,eAAO,MAAM,OAAO,GAAI,MAAM,IAAI,KAAG,MAI1B,CAAC;AA2BZ;;;;;GAKG;AACH,wBAAgB,OAAO,CACrB,GAAG,EAAE,MAAM,EACX,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,mBAAmB,CAAC,EACpC,OAAO,EAAE,MAAM,GACd,SAAS,YAAY,EAAE,CAuBzB;AAKD,wGAAwG;AACxG,eAAO,MAAM,cAAc,GACzB,GAAG,SAAS,EACZ,SAAS,MAAM,KACd,SAAS,YAAY,EAIuB,CAAC"}
@@ -0,0 +1,65 @@
1
+ import { argumentPieces, inPlace, isNode, placeOf, visited, } from "./nodes.js";
2
+ import { liveRoot, parseLatex } from "./parse.js";
3
+ const FILECONTENTS = new Set([
4
+ "filecontents",
5
+ "filecontents*",
6
+ ]);
7
+ /** What a name or an option is written as: its pieces joined, white space trimmed off. */
8
+ export const written = (name) => name
9
+ .map((p) => p.text)
10
+ .join("")
11
+ .trim();
12
+ /** What may stand before the name: nothing, or one `[options]` — anything else is a block with no name. */
13
+ const OPTION = /^(?:\[[^\]]*\])?$/;
14
+ /** The head of a block whose text is `text`: the first group, with only white space and an option before it. */
15
+ function headOf(text) {
16
+ const nodes = parseLatex(text).root.content;
17
+ const at = nodes.findIndex((x) => x.type === "group");
18
+ const option = written(argumentPieces(nodes.slice(0, Math.max(at, 0)), null));
19
+ const name = nodes[at];
20
+ if (name === undefined || !OPTION.test(option))
21
+ return null;
22
+ return {
23
+ name,
24
+ options: option
25
+ .replace(/^\[|\]$/g, "")
26
+ .split(",")
27
+ .map((o) => o.trim()),
28
+ };
29
+ }
30
+ /**
31
+ * One verbatim `filecontents` node as a block: its name, option, and body. unified-latex reads the
32
+ * whole environment as verbatim, so its text is parsed on its own and the name read off that tree like
33
+ * a declaration's (`headOf`). The body starts on the line after the one the name ends on; what TeX
34
+ * ignores after the name on that line is no body.
35
+ */
36
+ export function blockOf(src, n, jobname) {
37
+ return inPlace(placeOf(n), (span) => {
38
+ // The node runs from `\begin{env}` to past `\end{env}`.
39
+ const headAt = span.start + `\\begin{${n.env}}`.length;
40
+ const end = span.end - `\\end{${n.env}}`.length;
41
+ const head = headOf(src.slice(headAt, end));
42
+ if (head === null)
43
+ return [];
44
+ return inPlace(placeOf(head.name), (named) => {
45
+ const after = headAt + named.end;
46
+ // What TeX ignores after the name, up to the end of its line.
47
+ const rest = src.slice(after, end).split("\n", 1).join("");
48
+ return [
49
+ {
50
+ writes: written(argumentPieces([head.name], jobname)),
51
+ overwrite: head.options.some((o) => o === "overwrite" || o === "force"),
52
+ span,
53
+ body: { start: Math.min(after + rest.length + 1, end), end },
54
+ },
55
+ ];
56
+ });
57
+ });
58
+ }
59
+ const isBlock = (n) => n.type === "verbatim" && FILECONTENTS.has(n.env);
60
+ /** Every live `filecontents` block of a source whose main file's name is `jobname`, in source order. */
61
+ export const filecontentsOf = (t, jobname) => visited(liveRoot(t), () => false)
62
+ .filter(isNode)
63
+ .filter(isBlock)
64
+ .flatMap((n) => blockOf(t.src, n, jobname));
65
+ //# sourceMappingURL=filecontents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filecontents.js","sourceRoot":"","sources":["../../../src/adapters/latex/filecontents.ts"],"names":[],"mappings":"AAgBA,OAAO,EACL,cAAc,EACd,OAAO,EACP,MAAM,EACN,OAAO,EACP,OAAO,GAGR,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAkB,MAAM,YAAY,CAAC;AAElE,MAAM,YAAY,GAAwB,IAAI,GAAG,CAAC;IAChD,cAAc;IACd,eAAe;CAChB,CAAC,CAAC;AAKH,0FAA0F;AAC1F,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAU,EAAU,EAAE,CAC5C,IAAI;KACD,GAAG,CAAC,CAAC,CAAC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,EACZ,OAAe,EACU,EAAE,CAC3B,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC;KAC9B,MAAM,CAAC,MAAM,CAAC;KACd,MAAM,CAAC,OAAO,CAAC;KACf,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC"}
@@ -1,10 +1,10 @@
1
1
  import type { Include } from "../../domain/paper-source.ts";
2
2
  import type { Span } from "../../domain/tex-document.ts";
3
- import type { ParsedTex } from "./parse.ts";
3
+ import { type ParsedTex } from "./parse.ts";
4
4
  /**
5
5
  * Every `\input`, `\include` and `\subfile` of the source, in source order — not in a comment (a
6
- * comment is a node of its own) and not in a macro definition's body, which is read where the macro
7
- * is used, and nothing here expands macros.
6
+ * comment is a node of its own), not in a macro definition's body, which is read where the macro
7
+ * is used, and nothing here expands macros; not after `\end{document}`, which TeX never reads.
8
8
  */
9
9
  export declare const includesOf: (t: ParsedTex) => readonly Include[];
10
10
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"includes.d.ts","sourceRoot":"","sources":["../../../src/adapters/latex/includes.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAYzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AA6B5C;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAI,GAAG,SAAS,KAAG,SAAS,OAAO,EAGU,CAAC;AAKrE;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,GAAG,SAAS,KAAG,IAAI,GAAG,IAWhD,CAAC"}
1
+ {"version":3,"file":"includes.d.ts","sourceRoot":"","sources":["../../../src/adapters/latex/includes.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAazD,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAoCtD;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAI,GAAG,SAAS,KAAG,SAAS,OAAO,EAGU,CAAC;AAKrE;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,GAAG,SAAS,KAAG,IAAI,GAAG,IAWhD,CAAC"}
@@ -1,21 +1,29 @@
1
1
  import { isDefinition } from "./hidden.js";
2
- import { inPlace, isNode, macroPlace, mandatory, placeOf, visited, } from "./nodes.js";
2
+ import { argumentPieces, inPlace, isNode, macroPlace, mandatory, placeOf, visited, } from "./nodes.js";
3
+ import { liveRoot } from "./parse.js";
3
4
  const INCLUDE_MACROS = new Map([
4
5
  ["input", "input"],
5
6
  ["include", "include"],
6
7
  ["subfile", "subfile"],
7
8
  ]);
8
9
  /**
9
- * The path an include names, as written: its braced argument, or — TeX's own form, `\input name` —
10
- * the name up to the next space. unified-latex gives the unbraced form an argument of the first
11
- * token only (`sections` of `sections/a`), so the source is read for it.
10
+ * The path an include names: its braced argument read off the tree as TeX reads it (a comment is no
11
+ * part of it; a macro stays as written: nothing here expands one), or — TeX's own form, `\\input name`
12
+ * — the name up to the next space. unified-latex gives the unbraced form an argument of the first
13
+ * token only (`sections` of `sections/a`), so the source is read for that one.
12
14
  */
13
15
  function argumentText(src, m) {
14
- const start = mandatory(m)[0]?.content[0]?.position?.start.offset;
15
- if (start === undefined)
16
+ const arg = mandatory(m)[0];
17
+ const start = arg?.content[0]?.position?.start.offset;
18
+ if (arg === undefined || start === undefined)
16
19
  return null;
20
+ // The parser gives both forms `{` as their open mark; the source says which one was written.
21
+ if (src[start - 1] === "{")
22
+ return argumentPieces(arg.content, null)
23
+ .map((p) => p.text)
24
+ .join("");
17
25
  const rest = src.slice(start);
18
- const stop = rest.search(src[start - 1] === "{" ? /\}/u : /[\s{}%]/u);
26
+ const stop = rest.search(/[\s{}%]/u);
19
27
  return stop < 0 ? rest : rest.slice(0, stop);
20
28
  }
21
29
  /** One include macro as an `Include`, or nothing when it names no file or has no place. */
@@ -28,10 +36,10 @@ function includeOf(src, m) {
28
36
  }
29
37
  /**
30
38
  * Every `\input`, `\include` and `\subfile` of the source, in source order — not in a comment (a
31
- * comment is a node of its own) and not in a macro definition's body, which is read where the macro
32
- * is used, and nothing here expands macros.
39
+ * comment is a node of its own), not in a macro definition's body, which is read where the macro
40
+ * is used, and nothing here expands macros; not after `\end{document}`, which TeX never reads.
33
41
  */
34
- export const includesOf = (t) => visited(t.root, isDefinition)
42
+ export const includesOf = (t) => visited(liveRoot(t), isDefinition)
35
43
  .filter(isNode)
36
44
  .flatMap((n) => (n.type === "macro" ? includeOf(t.src, n) : []));
37
45
  const isDocument = (n) => n.type === "environment" && n.env === "document";
@@ -1 +1 @@
1
- {"version":3,"file":"includes.js","sourceRoot":"","sources":["../../../src/adapters/latex/includes.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EACL,OAAO,EACP,MAAM,EACN,UAAU,EACV,SAAS,EACT,OAAO,EACP,OAAO,GAGR,MAAM,YAAY,CAAC;AAGpB,MAAM,cAAc,GAA0C,IAAI,GAAG,CAAC;IACpE,CAAC,OAAO,EAAE,OAAO,CAAC;IAClB,CAAC,SAAS,EAAE,SAAS,CAAC;IACtB,CAAC,SAAS,EAAE,SAAS,CAAC;CACvB,CAAC,CAAC;AAEH;;;;GAIG;AACH,SAAS,YAAY,CAAC,GAAW,EAAE,CAAQ;IACzC,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC;IAClE,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACrC,MA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ters/latex/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAcxD,OAAO,EACL,eAAe,EACf,aAAa,EACb,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,QAAQ,EACR,OAAO,EACP,UAAU,EACV,SAAS,EACT,QAAQ,EACR,OAAO,EACP,MAAM,GACP,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,mFAAmF;AACnF,eAAO,MAAM,WAAW,EAAE,WAYzB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/latex/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAexD,OAAO,EACL,eAAe,EACf,aAAa,EACb,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,QAAQ,EACR,OAAO,EACP,UAAU,EACV,SAAS,EACT,QAAQ,EACR,OAAO,EACP,MAAM,GACP,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,mFAAmF;AACnF,eAAO,MAAM,WAAW,EAAE,WAazB,CAAC"}
@@ -6,6 +6,7 @@ import { parseLatex } from "./parse.js";
6
6
  import { bodyEmphasis, bodyProse } from "./prose.js";
7
7
  import { renderedRuns } from "./rendered.js";
8
8
  import { layoutOverridesOf } from "./layout.js";
9
+ import { filecontentsOf } from "./filecontents.js";
9
10
  export { documentClassOf, parseTemplate, replaceDocumentClass, } from "./document-class.js";
10
11
  export { collapse, inPlace, macroPlace, mandatory, optional, placeOf, textOf, } from "./nodes.js";
11
12
  export { documentBodyOf, includesOf } from "./includes.js";
@@ -28,5 +29,6 @@ export const latexReader = {
28
29
  template: parseTemplate,
29
30
  withDocumentClass: (src, want) => replaceDocumentClass(parseLatex(src), want),
30
31
  layoutOverrides: (src) => layoutOverridesOf(parseLatex(src)),
32
+ filecontents: (src, jobname) => filecontentsOf(parseLatex(src), jobname),
31
33
  };
32
34
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/latex/index.ts"],"names":[],"mappings":"AAuBA,OAAO,EACL,eAAe,EACf,aAAa,EACb,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,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,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,oBAAoB,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC;IAC7E,eAAe,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,iBAAiB,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IAC5D,YAAY,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;CACzE,CAAC"}
@@ -55,4 +55,16 @@ export declare const isList: (v: Visited) => v is readonly (Node | Argument)[];
55
55
  export declare const isArgument: (v: Visited) => v is Argument;
56
56
  /** A node, as opposed to a node list or an argument (which visit also reports). */
57
57
  export declare const isNode: (v: Visited) => v is Node;
58
+ /** A piece of an argument as TeX reads it: text, or a macro this reader leaves as written (`\x`). */
59
+ export interface ArgumentPiece {
60
+ readonly text: string;
61
+ readonly macro: boolean;
62
+ }
63
+ /**
64
+ * An argument's nodes as TeX reads them, off the tree: a comment is no part of it, a group's braces
65
+ * are none, and white space is one space. `\jobname` is the main file's name when `jobname` is given;
66
+ * every other macro — `\jobnamebib` included, a control sequence of its own — is a piece of its own,
67
+ * written as it stands, and so is anything else (math, verbatim) a name cannot hold.
68
+ */
69
+ export declare function argumentPieces(nodes: readonly Node[], jobname: string | null): readonly ArgumentPiece[];
58
70
  //# sourceMappingURL=nodes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../../src/adapters/latex/nodes.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,OAAO,KAAK,KAAK,GAAG,MAAM,oCAAoC,CAAC;AAE/D,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAGhE,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAExD,4EAA4E;AAC5E,MAAM,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,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I,GAAG,OAAO,KAAG,CAAC,IAAI,SAAS,CAAC,IAAI,GAAG,QAAQ,CAAC,EACjD,CAAC;AAEnB,+CAA+C;AAC/C,eAAO,MAAM,UAAU,GAAI,GAAG,OAAO,KAAG,CAAC,IAAI,QACR,CAAC;AAEtC,mFAAmF;AACnF,eAAO,MAAM,MAAM,GAAI,GAAG,OAAO,KAAG,CAAC,IAAI,IACiB,CAAC;AAE3D,qGAAqG;AACrG,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,SAAS,IAAI,EAAE,EACtB,OAAO,EAAE,MAAM,GAAG,IAAI,GACrB,SAAS,aAAa,EAAE,CAE1B"}
@@ -104,4 +104,43 @@ export const isList = (v) => Array.isArray(v);
104
104
  export const isArgument = (v) => !isList(v) && v.type === "argument";
105
105
  /** A node, as opposed to a node list or an argument (which visit also reports). */
106
106
  export const isNode = (v) => !isList(v) && v.type !== "argument" && v.type !== "root";
107
+ /**
108
+ * An argument's nodes as TeX reads them, off the tree: a comment is no part of it, a group's braces
109
+ * are none, and white space is one space. `\jobname` is the main file's name when `jobname` is given;
110
+ * every other macro — `\jobnamebib` included, a control sequence of its own — is a piece of its own,
111
+ * written as it stands, and so is anything else (math, verbatim) a name cannot hold.
112
+ */
113
+ export function argumentPieces(nodes, jobname) {
114
+ return nodes.flatMap((n) => pieceOf(n, jobname));
115
+ }
116
+ const NAMELESS = new Set([
117
+ "root",
118
+ "environment",
119
+ "mathenv",
120
+ "inlinemath",
121
+ "displaymath",
122
+ "verb",
123
+ "verbatim",
124
+ ]);
125
+ const isNameless = (n) => NAMELESS.has(n.type);
126
+ /** One node of an argument as `argumentPieces` reads it. */
127
+ function pieceOf(n, jobname) {
128
+ if (isNameless(n))
129
+ return [{ text: `\\${n.type}`, macro: true }];
130
+ switch (n.type) {
131
+ case "comment":
132
+ return [];
133
+ case "string":
134
+ return [{ text: n.content, macro: false }];
135
+ case "whitespace":
136
+ case "parbreak":
137
+ return [{ text: " ", macro: false }];
138
+ case "group":
139
+ return argumentPieces(n.content, jobname);
140
+ case "macro":
141
+ return n.content === "jobname" && jobname !== null
142
+ ? [{ text: jobname, macro: false }]
143
+ : [{ text: `\\${n.content}`, macro: true }];
144
+ }
145
+ }
107
146
  //# sourceMappingURL=nodes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nodes.js","sourceRoot":"","sources":["../../../src/adapters/latex/nodes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,yCAAyC,CAAC;AAEhF,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAexD,uDAAuD;AACvD,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAa,EAAS,EAAE,CAC9C,CAAC,CAAC,QAAQ,KAAK,SAAS;IACtB,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE;IACtB,CAAC,CAAC;QACE,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE;KACrE,CAAC;AAER,2FAA2F;AAC3F,MAAM,CAAC,MAAM,OAAO,GAAG,CACrB,CAAQ,EACR,CAA+B,EACjB,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAEtD,yEAAyE;AACzE,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAQ,EAAuB,EAAE,CAAC,CAAC,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AAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAClD,CAAC;AACH,CAAC"}
@@ -37,6 +37,12 @@ export interface ParsedTex {
37
37
  readonly [PARSED]: true;
38
38
  }
39
39
  /** A LaTeX source → its tree, without the branches `\iffalse … \fi` hides (`conditionals.ts`). */
40
- export declare const parseLatex: (src: string) => ParsedTex;
40
+ export declare function parseLatex(src: string): ParsedTex;
41
+ /**
42
+ * The part of a source's tree TeX reads: everything up to and with the `document` environment.
43
+ * TeX stops at `\end{document}`, so a `\bibliography`, a `thebibliography`, a block or an `\input`
44
+ * parked after it is never read. A source with no `document` environment is read whole.
45
+ */
46
+ export declare function liveRoot(t: ParsedTex): Readonly<Ast.Root>;
41
47
  export {};
42
48
  //# sourceMappingURL=parse.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../src/adapters/latex/parse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,KAAK,GAAG,MAAM,oCAAoC,CAAC;AAW/D,oGAAoG;AACpG,eAAO,MAAM,eAAe,EAAE,WAAW,CAAC,MAAM,CAgB9C,CAAC;AAEH,yFAAyF;AACzF,eAAO,MAAM,cAAc,EAAE,QAAQ,CACnC,MAAM,CAAC,MAAM,EAAE;IAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAwB9C,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAGnD,CAAC;AAcH;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAWhD,CAAC;AAOH,QAAA,MAAM,MAAM,eAAsB,CAAC;AAEnC,0GAA0G;AAC1G,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC;IACxB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