Branch: tkp/details
Goal: Allow more granular configuration of document sections (cover, frontmatter, chapters, endmatter, etc.) with per-section page layout overrides.
Initial commit (6d72cce) introduced the structural model. Subsequent work wired up all plumbing and implemented section-aware generation.
Sectionliteral type — 13-valueLiteralcovering the full document structure fromprematterthroughrearmatter.- Expanded
ContentMarshall— from 4 fields to 13 granular section fields, with private per-group aggregation attributes,sections()iterator, andSECTION_ORDER/SECTION_GROUPSconstants. PageGlobalsubclass ofPage— holdssize/orientationand apages: dict[Section, Page]for per-section page overrides; generates@page sectionNameCSS rules.- Moved
page.pyintoconfig/core/— co-locates with the rest of the core config. - Section-aware
Configuration.generate()— iterates by section, tags cells withnbprint:section:{name}andnbprint:section-group:{group}. - Per-section page CSS —
PageGlobal.render()generates named page rules and element selectors for Paged.js. counter_reset/counter_style— per-section page numbering control (e.g., roman numerals for frontmatter).
- 1.1 Fix
ContentMarshall._allvalidator — include all 13 sections in correct document order; populate private per-group attributes. - 1.2 Switch
Configuration.pagetoPageGlobal— update field type and validator; ensure backward compat with existing region-only configs. - 1.3 Verify
_convert_content_from_dict— confirm it handles all 13 section keys when hydrating from YAML/dict. - 1.4 Unit tests —
Sectionliteral,ContentMarshallwith content in various sections,PageGlobalwith per-section overrides, backward compat with list-only content.
- 2.1 Section-aware
Configuration.generate()— iterate by section group instead of flatcontent.all; inject section-boundary metadata/tags. - 2.2 Per-section page style application — look up
page.pages[section]during generation to apply section-specific page regions/CSS. - 2.3 CSS generation for named pages — generate
@page sectionName { ... }rules and[data-nbprint-section]element attributes for Paged.js.
- 3.1 YAML example: structured sections —
examples/sections.yamlusing dict-stylecontent:with section keys and per-section page overrides. - 3.2 Hydra config example —
examples/hydra/content/sections.yamlfor section-level content overrides. - 3.3 Documentation — updated
docs/src/configuration.mdwith section model,Sectionvalues, and per-section page customization examples.
- 4.1
middlematter_separatorsinterleaving — support list-of-lists middlematter with chapter separator/title pages. Requires schema change to support nested content lists; separators currently render as a standalone section in document order. - 4.2 Auto table of contents — optionally auto-generate TOC from middlematter headings when
table_of_contentsis declared but empty. Users can currently placeContentTableOfContentsin thetable_of_contentssection explicitly. - 4.3 Page numbering per section —
counter_resetandcounter_stylefields onPage, used in per-section CSS generation (e.g.,counter(page, lower-roman)).
- Migrate hydra → lerna — replaced all
from hydraimports withfrom lernaequivalents; removedhydra-corefrompyproject.tomldependencies. Lerna is a drop-in replacement with the same API.