modules

geometor.euclid

Tools for modeling and rendering geometric constructions from Euclid’s Elements.

Key Components:

Usage:

Use the provided functions to parse XML files and generate documentation.

Submodules

Functions

parse_element_xml(→ Dict[str, Any])

Parse a single element XML file.

generate_rst_from_xml(→ None)

Generate an RST file from an XML element file.

build_rst_docs(→ None)

Parses all XML files in xml_dir and generates RST files in output_dir.

build_graph(→ tuple[networkx.DiGraph, list[dict]])

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:

dict

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:

tuple

indices