modules¶
geometor.euclid¶
Tools for modeling and rendering geometric constructions from Euclid’s Elements.
Key Components:¶
XML Parsing: Tools (
parse_element_xml()) to parse the XML source of Euclid’s Elements.RST Generation: Tools (
generate_rst_from_xml()) to convert XML to ReStructuredText.Graphing: Tools (
build_graph(),generate_g_index()) to build dependency graphs and indexes.
Usage:¶
Use the provided functions to parse XML files and generate documentation.
Submodules¶
Functions¶
|
Parse a single element XML file. |
|
Generate an RST file from an XML element file. |
|
Parses all XML files in xml_dir and generates RST files in output_dir. |
|
Build a NetworkX dependency graph from the XML source files. |
Package Contents¶
- geometor.euclid.parse_element_xml(file_path: pathlib.Path) Dict[str, Any]¶
Parse a single element XML file.
- Parameters:
file_path (Path) – The path to the XML file.
- Returns:
A dictionary containing the parsed element data (id, type, head, enunciation, etc.).
- Return type:
- geometor.euclid.generate_rst_from_xml(xml_file_path: pathlib.Path, output_dir: pathlib.Path) None¶
Generate an RST file from an XML element file.
- Parameters:
xml_file_path (Path) – The path to the input XML file.
output_dir (Path) – The directory where the output RST file will be saved.
- geometor.euclid.build_rst_docs(xml_dir: pathlib.Path, output_dir: pathlib.Path) None¶
Parses all XML files in xml_dir and generates RST files in output_dir.
- geometor.euclid.build_graph(xml_dir: pathlib.Path | None = None) tuple[networkx.DiGraph, list[dict]]¶
Build a NetworkX dependency graph from the XML source files.
- Parameters:
xml_dir (Path, optional) – The directory containing the XML book files. Defaults to ‘resources/xml/books’ in the project root.
- Returns:
A tuple containing the NetworkX DiGraph and a list of book data dictionaries.
- Return type: