Skip to main content

Crate xberg_libwpd

Crate xberg_libwpd 

Source
Expand description

WordPerfect structured document extraction for Xberg.

Thin, safe wrapper over libwpd and its document-model dependency librevenge, both built from source against their MPL-2.0 arm (see build.rs). libwpd covers the whole WordPerfect binary family (WP 4.2 through the X-series).

libwpd has no extract() entry point; it drives a librevenge callback interface. A hand-written C++ shim (src/shim.cpp) implements that interface, records a flat, format-agnostic internal document as libwpd walks the input, and serializes that one document into a versioned binary blob exposed through a flat C API this crate wraps. extract_document decodes that blob into a typed WpdDocument: an ordered WpdEvent stream (text runs, formatting spans, list items, table structure with column/row spans and header-row flags, hyperlinks, fields, footnotes and endnotes kept as distinct sequences, headers/footers, and comment/text-box asides) plus WpdMetadata (title, author, subject, keywords, and every raw key/value pair libwpd reported). This crate performs no text or Markdown rendering; producing a flattened string from the structured model is left to the caller. WordPerfect support targets Linux, macOS and Windows; on other platforms extract_document returns WpdError::UnsupportedPlatform.

Structs§

WpdDocument
The structured WordPerfect document model: an ordered event stream plus document-level metadata.
WpdMetadata
Document metadata captured from libwpd’s setDocumentMetaData callback.

Enums§

WpdError
Errors returned when extracting a WordPerfect document.
WpdEvent
A single event recorded from the librevenge callback walk, decoded 1:1 from the binary stream shim.cpp produces. Events are strictly ordered and properly nested (each *Start has a matching *End), mirroring the order libwpd invoked the corresponding callbacks in.

Functions§

extract_document
Extract the structured document model of a WordPerfect document held entirely in memory.
is_supported
Returns true if data looks like a WordPerfect document libwpd can parse.