modules

geometor.pacioli

Tools for parsing and processing “De Divina Proportione” by Luca Pacioli.

Key Components:

  • Parser: The PacioliParser class extracts chapters and content from the transcribed text.

  • Execution: The run_parse.py script executes the parsing process.

Usage:

Initialize PacioliParser with resources and output directories, then call parse().

Submodules

Classes

PacioliParser

Package Contents

class geometor.pacioli.PacioliParser(resources_dir: pathlib.Path, output_dir: pathlib.Path)
resources_dir
output_dir
transcribed_file
parse()

Execute the parsing process.

This method orchestrates the extraction of TOC and text chapters, merges them, and generates the RST output structure.

create_root_index(book_names: List[str])
process_book(lines: List[str], book_config: Dict)
extract_chapters(lines: List[str], start_marker: str, end_marker: str, prefix: str) Dict[str, Dict]

Extract chapters from a section of lines.

Parameters:
  • lines – The list of lines to process.

  • start_marker – The string marking the start of the section.

  • end_marker – The string marking the end of the section.

  • prefix – The prefix for chapter headers (e.g., “Cap”, “Gap”).

Returns:

A dictionary of chapters keyed by Roman Numeral ID.

Return type:

dict

merge_chapters(toc_chapters: Dict, text_chapters: Dict) List[Dict]

Merge TOC and Text chapters into a single list.

Parameters:
  • toc_chapters – Dictionary of chapters extracted from the TOC.

  • text_chapters – Dictionary of chapters extracted from the text.

Returns:

A list of merged chapter dictionaries, sorted by Roman Numeral ID.

Return type:

list

generate_rst_structure(chapters: List[Dict], output_dir: pathlib.Path)

Generate the RST folder structure and files for the chapters.

Parameters:
  • chapters – List of chapter dictionaries.

  • output_dir – The directory where RST files will be generated.

create_main_index(chapters: List[Dict], output_dir: pathlib.Path)
create_chapter_files(chapter_dir: pathlib.Path, chapter: Dict)
indent_text(text: str, indent: str = '   ') str