Skip to content

Spec 001 T028: the book's contents, second pass - #151

Closed
adamjohnwright wants to merge 2 commits into
mainfrom
t028/contents
Closed

adamjohnwright wants to merge 2 commits into
mainfrom
t028/contents

Conversation

@adamjohnwright

Copy link
Copy Markdown
Contributor

Spec 001, task T028.

What: reprintFront (src/print/contents.ts): after a PDF's parts are joined, each contents entry's target page is read from its probe (counted from the PDF's first page, as the stamps count); the front part is laid out again with those numbers, printed, and swapped in for the first print's pages, before T026's links and T027's stamps run, so its links and stamps are done like the rest. The objects only the old front pages held are deleted (pdf-lib's removePage deletes the page alone). It refuses, unchanged, if the reprint's page count or a front heading's page differs, if a target has no probe, if an anchor is probed twice, or if the parts don't make the PDF. T029's task text now gives the order in joined: reprintFront, rewriteLinks, writeOutline, stampPages.

From #148's review (T027's lows): the stamp-twice guard is set before the first await (two at once now refused); marginText collapses only [ \t\n\r\f], keeping NBSP, thin and ideographic spaces as a margin box nearly does; an empty header is refused; ci/measure/join.ts embeds the WOFF1 file; T027's note corrected.

Tests: test/print/contents.test.ts (7) and new stamp tests; 330 in all. Mutants in tasks.md.

🤖 Generated with Claude Code

adamjohnwright and others added 2 commits November 3, 2026 20:43
…gain

reprintFront reads each probe's page in the joined PDF, prints the front
part again with the numbers and swaps its pages in before the links are
rewritten and the pages stamped, deleting what only the first print held.
A reprint whose pages or front headings move is refused.

From #148's review: the stamp-twice guard is held before the first await;
marginText collapses only CSS's collapsible white space; a name leaving no
header is refused; the join measurement embeds Roboto's WOFF file; T027's
note corrected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@adamjohnwright

Copy link
Copy Markdown
Contributor Author

Replaced after review: marginText let undrawable space characters through, refusing the PDF at stamping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant