1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//! # 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 use ;
pub use Profile;
use Path;
use 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).