Skip to content

Rebuild the EPUB and PDF downloads every time the book changes - #131

Draft
robertbpugh wants to merge 4 commits into
sync/manifest-and-footnotesfrom
build/ebooks
Draft

robertbpugh wants to merge 4 commits into
sync/manifest-and-footnotesfrom
build/ebooks

Conversation

@robertbpugh

@robertbpugh robertbpugh commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

The EPUB and PDF downloads now rebuild every time the book changes, so readers stop getting the 2015 and 2023 text with every later fix missing.

Today the downloads are hand-made files that nothing updates, and #122 asked for a release with proper download links. This adds both.

What it does

bin/build-books.py builds an EPUB and a PDF of each volume with pandoc, reading chapters in the order manifest.json lists them, so chapter 10 doesn't sort before chapter 2. Volume 1 gets its Part headings, both volumes get their original covers, and each chapter keeps its own footnotes.

The PDF goes through WeasyPrint instead of pandoc's default LaTeX route. That route quietly drops raw HTML, and these chapters use HTML for most of their images and many links.

The Build books workflow runs it on every pull request that touches the book and checks both EPUBs with epubcheck. On trunk it also publishes the four files to a release tagged latest, so these links always serve the current text:

They'll work once this merges and the first build publishes. The README points there now. The designed original editions stay in Formats/ with a note that they don't include later fixes. MOBI isn't built, since Kindle reads EPUB directly.

Fixes the build turned up

epubcheck and a test build found four real problems in the chapters, fixed in a separate commit:

  • WordPress Incorporated pulled its spam screenshot from the old WordPress/book repo path, which now returns 404.
  • Building Blocks chapter 4 linked to automattic.com without https://, so the link went nowhere.
  • One image in Happy Cog Redesign had its width in curly quotes, and one in Habari wasn't closed.

Testing

I ran the build in an Ubuntu 24.04 container with the same apt packages the workflow installs (pandoc 3.1.3, WeasyPrint 61.1, epubcheck):

  • All four files build. Volume 1's PDF is 294 pages and Volume 2's is 124.
  • Both EPUBs pass epubcheck with 0 errors and 0 warnings, and each chapter is its own section in the reader's table of contents.
  • The Volume 1 PDF holds all of the source text (63,523 words against 62,988 in the Markdown, the difference being the table of contents and Part headings).
  • I checked the cover, table of contents, photo pages and footnote pages by eye. Footnotes sit at the end of each chapter, and each chapter starts on a new page.

This is stacked on #130, so it includes #129 and #130 until they merge.

Closes #122.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MXBwXzdG2XPckiBuLKiFZ1

robertbpugh and others added 2 commits October 7, 2026 17:21
Found while building the ebooks:
- WordPress Incorporated pointed its spam screenshot at the old
  WordPress/book repo path, which now returns 404.
- Building Blocks chapter 4 linked to "automattic.com" with no https://,
  which resolves as a relative path.
- An image in Happy Cog Redesign had its width in curly quotes, and one
  in Habari was not self-closed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MXBwXzdG2XPckiBuLKiFZ1
bin/build-books.py builds both volumes with pandoc, in the order
manifest.json lists the chapters, and the PDF goes through WeasyPrint so
the book's HTML images and links survive. The Build books workflow runs
it on pull requests (with epubcheck) and, on trunk, publishes the files
to a "latest" release. The README links there; the designed original
editions stay in Formats/. The Volume 2 cover comes from its original
EPUB. Closes #122.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MXBwXzdG2XPckiBuLKiFZ1
@robertbpugh robertbpugh self-assigned this Oct 7, 2026
robertbpugh and others added 2 commits October 7, 2026 17:32
- Premium Themes had curly quotes around an alt attribute, and Problem
  with Post Formats was missing alt= before its text, so both images
  showed as raw HTML.
- Building Blocks chapters 5 and 8 used ## for sections, the same level
  as the chapter title, where every other chapter (and the live site)
  uses ###.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MXBwXzdG2XPckiBuLKiFZ1
…ases

- Leave the Introduction's section headings at ## so the outline doesn't
  skip a level and they stay in the table of contents.
- Normalize width and height px values independently.
- Never publish an older build over a newer one when a run is re-run.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MXBwXzdG2XPckiBuLKiFZ1
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