all2md.parsers.odt

ODT (OpenDocument Text) to AST converter.

This module provides conversion from ODT text document files to AST representation. It replaces the combined ODF parser with a focused text document parser.

class all2md.parsers.odt.OdtToAstConverter

Bases: BaseParser

Convert ODT text documents to AST representation.

This converter processes ODT (OpenDocument Text) files and builds an AST that can be rendered to various markdown flavors.

Parameters:

options (OdtOptions or None) – Conversion options

Initialize the ODT parser with options and progress callback.

__init__(options: OdtOptions | None = None, progress_callback: Callable[[ProgressEvent], None] | None = None)

Initialize the ODT parser with options and progress callback.

parse(input_data: str | Path | IO[bytes] | bytes) Document

Parse ODT document into an AST.

Parameters:

input_data (str, Path, IO[bytes], or bytes) – The input ODT document to parse

Returns:

AST Document node representing the parsed document structure

Return type:

Document

Raises:
convert_to_ast(doc: odf.opendocument.OpenDocument) Document

Convert ODT document to AST Document.

Returns:

AST document node

Return type:

Document

extract_metadata(document: Any) DocumentMetadata

Extract metadata from ODT document.

Parameters:

document (opendocument.OpenDocument) – ODT document object from odfpy

Returns:

Extracted metadata

Return type:

DocumentMetadata