photon_platform.publish.book

Book subtree inheritance and multi-track context injection for the ‘Website in a Website’ Codex layout.

Attributes

nodes

Functions

peek_metadata(filepath) → Dict[str, str]

Peek at the beginning of an RST file to extract top field-list metadata.

detect_companion_tracks(env, pagename) → List[Dict[str, Any]]

Detect companion tracks for pagename in env.found_docs.

resolve_book_context(env, pagename[, doctree]) → Dict[str, Any]

Resolve book subtree inheritance and companion tracks for pagename.

filter_epub_book_sources(app, docname, source) → None

Clean up non-book editorial references in source RST when building an EPUB.

resolve_book_doctree(app, doctree, fromdocname) → None

Consolidate footnote targets and apply EPUB 3 doctree transformations.

resolve_epub_missing_reference(app, env, node, contnode) → Optional[Any]

Gracefully degrade excluded website references (e.g. about-*) to plain text in EPUB builds.

setup_book_page_context(app, pagename, templatename, ...) → Optional[str]

Sphinx html-page-context hook to inject Book Codex context and select book_layout.html.

setup(app) → Dict[str, Any]

Register the book subtree inheritance and EPUB 3 hooks with Sphinx.

Module Contents

photon_platform.publish.book.nodes = None
photon_platform.publish.book.peek_metadata(filepath: str) → Dict[str, str]

Peek at the beginning of an RST file to extract top field-list metadata.

photon_platform.publish.book.detect_companion_tracks(env: Any, pagename: str) → List[Dict[str, Any]]

Detect companion tracks for pagename in env.found_docs.

Supports: - Elements 2.0 tracks: index (Pseudocode), video (Video), code (Code), heath (Heath) - Euclid tracks: index / proposition, commentary, notes, folio

or <pagename>.commentary, <pagename>.notes

  • Pacioli tracks: <stem>_en, <stem>_it, <stem>_de, <stem>_notes, index

  • Hoenen tracks: <stem> (Latin), <stem>-en, <stem>-summary, translation-notes-<stem>

photon_platform.publish.book.resolve_book_context(env: Any, pagename: str, doctree: docutils.nodes.document | None = None) → Dict[str, Any]

Resolve book subtree inheritance and companion tracks for pagename.

photon_platform.publish.book.filter_epub_book_sources(app: Any, docname: str, source: List[str]) → None

Clean up non-book editorial references in source RST when building an EPUB.

photon_platform.publish.book.resolve_book_doctree(app: Any, doctree: Any, fromdocname: str) → None

Consolidate footnote targets and apply EPUB 3 doctree transformations.

photon_platform.publish.book.resolve_epub_missing_reference(app: Any, env: Any, node: Any, contnode: Any) → Any | None

Gracefully degrade excluded website references (e.g. about-*) to plain text in EPUB builds.

photon_platform.publish.book.setup_book_page_context(app: Any, pagename: str, templatename: str, context: Dict[str, Any], doctree: docutils.nodes.document | None) → str | None

Sphinx html-page-context hook to inject Book Codex context and select book_layout.html.

photon_platform.publish.book.setup(app: Any) → Dict[str, Any]

Register the book subtree inheritance and EPUB 3 hooks with Sphinx.