Faceted content
One source, several editions — a draft with editorial notes and a clean final, a public report and an internal one. Model each facet as a data flag, gate content on it, and give each edition its own root file when the file set differs.
Gate blocks on a flag
#edition: { audience: public, status: draft } !! (h2 Results h2) Response rates rose in every region. (if @edition.status is draft) (aside(class: editorial) Check the Q3 figures with finance. aside) (end) (if @edition.audience is internal) @section (h3 Appendix: raw survey data h3) Respondent-level tables follow. section@ (end)
Results
Response rates rose in every region.
<h2>Results</h2> <p>Response rates rose in every region.</p> <aside class="editorial"><p>Check the Q3 figures with finance.</p></aside>
Change status: draft to final and the aside
disappears; set audience: internal and the appendix appears.
Inline notes that vanish
Put the condition inside a definition to gate a phrase mid-sentence:
#edition: { status: draft } !! #todo (if @edition.status is draft)@strong TODO: strong@ ::body::(end) todo# Rates rose in every region. @todo check the Q3 figures. todo@ Margins held.
Rates rose in every region. TODO: check the Q3 figures. Margins held.
<p>Rates rose in every region. <strong>TODO:</strong> check the Q3 figures. Margins held.</p>
In the final edition the note renders nothing. For notes that never render, use
a comment: ~ check with finance.
Membership
There is no contains or or. Keep one boolean per facet
and test it directly:
#edition: { public: true, internal: false } !! (if @edition.internal) Internal only. (end) (if @edition.public) Everyone sees this. (end)
Everyone sees this.
That renders Everyone sees this. For anything richer, filter in a <% %> script.
One root file per edition
To ship different sets of files, write a small root per edition that sets the
flags, references what that edition includes and places it. A reference inside (if …) is not loaded, so choose
the root instead (see Multi-file documents).
~ report-internal.wit #edition: { audience: internal, status: final } !! reference ./shared/body.wit reference ./appendix/raw-data.wit @body @appendix
Build each root separately: wit build report-internal.wit.
See also
Conditionals · Multi-file documents · Derived content · Self-organising documents