pdf-untangle 0.0.1

Untangle garbled PDF text: layout-aware extraction that reconstructs reading order, strips page furniture, and splits documents into structured, citable sections
Documentation
//! # pdf-untangle
//!
//! Untangle garbled PDF text: layout-aware extraction that reconstructs reading
//! order, strips page furniture (headers/footers/page numbers), repairs
//! hyphenation and page-break flow, and — with a *profile* — splits a document
//! into structured, citable provisions (rules, statutes, sections).
//!
//! A PDF stores text as thousands of individually positioned glyphs with no
//! notion of paragraphs, columns, headings, or reading order. Naive extraction
//! yields the familiar mishmash. This crate rebuilds the logical document in
//! three layers:
//!
//! 1. **extract** — PDF → positioned text runs per page (pluggable backends)
//! 2. **layout** — runs → ordered lines/blocks (columns, furniture, flow)
//! 3. **structure** — blocks → provisions, driven by a declarative TOML
//!    [`Profile`] (heading patterns, citation template, date formats)
//!
//! The same crate ships a CLI (`cargo install pdf-untangle`).
//!
//! ## Status
//!
//! Phase 0 scaffold: the public API shape is in place; Layers 1–3 land in
//! Phases 1–3 (see `docs/DESIGN.md`). Calling [`extract`] currently returns an
//! error stating what is not yet implemented.

pub mod extract;
pub mod layout;
pub mod output;
pub mod profile;
pub mod structure;

pub use output::{Document, Provision};
pub use profile::Profile;

use std::path::Path;

use anyhow::Result;

/// Extract structured provisions from a text-based PDF using `profile`.
///
/// This is the single high-level entry point: Layer 1 (extraction) → Layer 2
/// (layout reconstruction) → Layer 3 (profile-driven structure detection).
pub fn extract(pdf: &Path, profile: &Profile) -> Result<Document> {
    let _ = (pdf, profile);
    anyhow::bail!(
        "pdf-untangle {}: extraction pipeline not yet implemented (Phase 1-3 of docs/DESIGN.md)",
        env!("CARGO_PKG_VERSION")
    )
}