Skip to content

feat(memo): write Title, Author and Subject into a talk deck.pdf - #473

Merged
tieubao merged 4 commits into
mainfrom
feat/talk-pdf-metadata
Nov 3, 2026
Merged

tieubao merged 4 commits into
mainfrom
feat/talk-pdf-metadata

Conversation

@tieubao

@tieubao tieubao commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

What's this PR do?

A downloaded talk deck had no Title or Author: joining the slide pages drops all document info, and the live pilot deck.pdf shows only Producer: GPL Ghostscript.

  • _meta/scripts/talk-build.mjs: new stampMeta() writes /Title (post title), /Author and /Subject (post description) into deck.pdf with a Ghostscript pdfmark, in both build paths. Author is the name in _meta/talk-template/speakers/<handle>.json for the first authors handle when that file exists, else the handle. Text goes in as UTF-16BE hex, so accents, "Đ", quotes and parentheses survive. Without gs the build warns and skips; nothing is installed.
  • talk-build.mjs also writes talk.speaker into the post frontmatter from the speaker file's name for the first author, the way it writes talk.ratio. A value set by hand is never overwritten; no speaker file leaves the field absent. The foundation-apps Download button reads it. Documented beside talk.ratio in handbook/memo/contribute-to-memo.md.
  • _meta/scripts/talk-build-meta.test.mjs: seven cases. Four read the built deck back with pdfinfo (Title, Subject, speaker-file Author, handle fallback, Vietnamese title, rebuild keeps the fields); three cover talk.speaker (written from the speaker file, hand-set kept, absent without a speaker file). It skips when a required binary is missing.
  • handbook/memo/assets/publish-a-talk/deck.pdf and the pilot frontmatter (talk.speaker: "Han Ngo"): the pilot rebuilt from deck-src. Media-sync re-uploads it on merge.
  • _meta/docs/verification/talk-pdf-metadata.md: the proof, under _meta/ so the export ignores it.

The Ghostscript compression is not in talk-build.mjs: it is compress-media.sh, run by media-sync after merge. It keeps document info (shown in the proof), so the stamp survives the upload.

Companion: dwarvesf/foundation-apps#434 names the downloaded file <post-slug>-<speaker-slug>.pdf.

Test plan

node --test _meta/scripts/talk-build-meta.test.mjs   -> pass 7, fail 0
node --test _meta/scripts/post-check-talk.test.mjs   -> pass 19, fail 0
pdfinfo handbook/memo/assets/publish-a-talk/deck.pdf
-> Title: How to publish a talk on memo
-> Author: Han Ngo
-> Subject: A talk post puts each slide beside what you said over it, ...

Negative control: with stampMeta() commented out the metadata cases fail 4 of 4, and with writeSpeaker() commented out the speaker case fails; both green after restore. After merge, run pdfinfo on the R2 copy of the pilot deck once the strip commit lands.

Any background context you want to provide? (if appropriate)

The pilot's slides are no longer in git, so the deck was rebuilt from deck-src in headless Helium. Only deck.pdf is committed; the rebuilt slides and og.png are unchanged inputs.

@tieubao
tieubao marked this pull request as ready for review November 3, 2026 17:34
@tieubao
tieubao merged commit d4da186 into main Nov 3, 2026
1 check passed
@tieubao
tieubao deleted the feat/talk-pdf-metadata branch November 3, 2026 17:42
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