geometor.altshiller_court.codex_items¶
Folio depagination and item-per-page decomposition for College Geometry.
Transforms atomic diplomatic folio files (<NNNN>.rst and <NNNN>.notes.rst)
into structured chapter sections, leaf items, and sub-collections (such as the
twelve fundamental loci of § 11) with co-located .euclid-graphic SVGs and
paired commentary.rst companion tracks.
Attributes¶
Classes¶
A single top-level RST block carrying its source folio provenance. |
|
A single compiled leaf page (or |
|
A chapter section container holding intro blocks and ordered |
Functions¶
|
Parse |
|
Rewrite RST underline characters according to |
|
Remove top RST heading underlined with |
|
If |
|
Convert consecutive folios into |
|
Render |
|
Decompose transcribed chapter folios into |
|
Decompose Chapter I ( |
|
Decompose Frontmatter ( |
|
Copy ONLY the |
Module Contents¶
- geometor.altshiller_court.codex_items.HEADING_CHARS¶
- geometor.altshiller_court.codex_items.ARTICLE_INLINE_RE¶
- geometor.altshiller_court.codex_items.ENUN_ARTICLE_RE¶
- geometor.altshiller_court.codex_items.PROBLEM_ENUN_RE¶
- geometor.altshiller_court.codex_items.LOCUS_ENUN_RE¶
- geometor.altshiller_court.codex_items.PICTURE_RE¶
- geometor.altshiller_court.codex_items.GEOM_GID_RE¶
- geometor.altshiller_court.codex_items.ENUM_ITEM_RE¶
- class geometor.altshiller_court.codex_items.FolioBlock¶
A single top-level RST block carrying its source folio provenance.
- text: str¶
- folios: list[tuple[str, str]] = []¶
- property primary_folio: tuple[str, str]¶
Return
(folio_id, page_str)where this block begins.
- class geometor.altshiller_court.codex_items.CodexItem¶
A single compiled leaf page (or
§ 11locus sub-collection) with commentary.- slug: str¶
- title: str¶
- anchor: str¶
- item_type: str¶
- order: int¶
- canonical_id: str¶
- blocks: list[FolioBlock] = []¶
- child_collection_type: str | None = None¶
- excerpt: str | None = None¶
- card_image: str | None = None¶
- all_folios() list[tuple[str, str]]¶
Ordered unique
(folio_id, page_str)pairs spanned by this item and its children.
- class geometor.altshiller_court.codex_items.CodexSection¶
A chapter section container holding intro blocks and ordered
CodexItemchildren.- slug: str¶
- code: str¶
- title: str¶
- anchor: str¶
- canonical_id: str¶
- order: int¶
- overview: str¶
- intro_blocks: list[FolioBlock] = []¶
- geometor.altshiller_court.codex_items.parse_folio_rst(rst_path: pathlib.Path) tuple[dict[str, str], str]¶
Parse
:key: valuemetadata header and RST body from a<NNNN>.rstfile.
- geometor.altshiller_court.codex_items.demote_headings(text: str, map_chars: dict[str, str]) str¶
Rewrite RST underline characters according to
map_chars.
- geometor.altshiller_court.codex_items.strip_top_heading(body: str, underline_char: str = '=') str¶
Remove top RST heading underlined with
underline_charif present.
- geometor.altshiller_court.codex_items.heading_info(block_text: str) tuple[str, str] | None¶
If
block_textis a 2-line RST heading, return(title, underline_char).
- geometor.altshiller_court.codex_items.extract_depaginated_blocks(folio_entries: list[tuple[str, str, dict[str, str], str]], strip_chapter_heading: bool = False, demote_frontmatter: bool = False) list[FolioBlock]¶
Convert consecutive folios into
FolioBlockitems, reflowing mid-sentence splits.
- geometor.altshiller_court.codex_items.render_blocks_with_folios(blocks: list[FolioBlock]) str¶
Render
FolioBlocklist to seamless RST prose (source folios live in:folios:frontmatter).
- geometor.altshiller_court.codex_items.CH01_SECTION_META: dict[str, tuple[str, str, str, str]]¶
- geometor.altshiller_court.codex_items.CH03_SECTION_META: dict[str, tuple[str, str, str, str]]¶
- geometor.altshiller_court.codex_items.CHAPTER_SECTION_META_BY_INDEX: dict[int, tuple[str, str, dict[str, tuple[str, str, str, str]]]]¶
- geometor.altshiller_court.codex_items.ITEM_EXCERPTS: dict[str, str]¶
- geometor.altshiller_court.codex_items.ITEM_CARD_IMAGES: dict[str, str]¶
- geometor.altshiller_court.codex_items.decompose_chapter_folios(folio_entries: list[tuple[str, str, dict[str, str], str]], chap_prefix: str, chap_roman: str, section_meta_map: dict[str, tuple[str, str, str, str]]) list[CodexSection]¶
Decompose transcribed chapter folios into
CodexSectioncontainers and leafCodexItemunits.
- geometor.altshiller_court.codex_items.decompose_chapter_one(folio_entries: list[tuple[str, str, dict[str, str], str]]) list[CodexSection]¶
Decompose Chapter I (
0020–0052) into 5CodexSectioncontainers and leaf items.
- geometor.altshiller_court.codex_items.FRONTMATTER_UNITS: list[tuple[str, str, str, str, str, str]] = [('01-cover', 'Dover Front Cover', '0001', '0001', 'Frontmatter.Cover', "Unabridged 2007 Dover...¶
- geometor.altshiller_court.codex_items.decompose_frontmatter(folio_entries: list[tuple[str, str, dict[str, str], str]]) list[CodexItem]¶
Decompose Frontmatter (
0001–0019) into 6 leafCodexItemunits.
- geometor.altshiller_court.codex_items.copy_referenced_graphics(blocks: list[FolioBlock], source_chap_dir: pathlib.Path, dest_item_dir: pathlib.Path) tuple[int, int]¶
Copy ONLY the
.g*.svgand.g*.pngfiles referenced by.. picture::inblocks.