Wit

A bibliography across files

Let each chapter declare its own sources and have one bibliography assemble itself at the end. Add a chapter and the list grows on its own — no central index to maintain.

Step 1 — Register an entry per chapter

An additive partial — a definition whose name begins with a leading plus — merges instead of overwriting when the same name is declared more than once.

~ in chapters/01-introduction.wit

+#bibliography: @entry Berger, John (1972). Ways of Seeing. Penguin. entry@

Step 2 — Wrap each entry

Give each entry a tiny value definition so one partial renders as one clean block. Without the wrapper, inline runs fragment into stray paragraphs.

~ in shared/schema.wit

#entry: ... !!

Step 3 — Emit the merged list once

Place the assembled list wherever you want it — usually a References section in the final chapter.

~ in chapters/04-conclusion.wit

@section |title References|
@bibliography bibliography@

Step 4 — Build the master

wit build master.wit --fragment
Result.

Every additive declaration across the chapters merges, and the single emit in the conclusion renders the combined list. The worked examples/thesis does exactly this and builds green.

Pitfalls

  • Keep entry titles plain. Inline emphasis inside an additive-partial body fragments the entry into one paragraph per run — the working example uses plain-text titles for exactly this reason.
  • An additive list isn't a collection. You can't iterate a merged bibliography with a loop — it is a node definition, not data. To iterate a list of sources, keep a separate collection literal alongside it.

Variations

The shared-anchor pattern: define full citations once in shared/sources.wit, reference it from every chapter, cite short by idea in prose, and list the full entries at the end. This gives you in-text citations and a bibliography from one source of truth.

See also

A manuscript in chapters

is the multi-file spine this builds on; A thesis to a print-ready PDF covers a single-file Works Cited list.