Skip to main content

Module document

Module document 

Source
Expand description

Post-processing document wrapper with XML/DOM, ID management, and caching.

Port of LaTeXML::Post::Document. Wraps an XML::LibXML::Document (via the libxml crate) and provides:

  • Namespace management
  • ID tracking (idcache, reusable, reserved)
  • XPath queries with registered namespaces
  • Node manipulation (addNodes, removeNodes, cloneNode, etc.)
  • Persistent cache (key-value store)

Structs§

DocCache
Perl’s document cache (Post.pm L1510-1548): a key-value store per destination directory, persisted there as CACHE_FILE (kv(key, value), Perl’s keys and values) unless nocache (Perl’s option, Post.pm L678; the cortex worker, whose every paper gets a fresh directory) or the document has no destination directory (the API): then in memory. Opened lazily, at the first lookup; every page of a run shares one (PostDocumentOptions::cache) as Perl’s split pages share their parent’s (new_internal clones it, L687-690).
PostDocument
Post-processing document: wraps an XML document with ID management, namespace tracking, XPath helpers, and a persistent cache.
PostDocumentOptions
Options for creating a PostDocument.

Enums§

Conjunction
Conjunction for joining node lists.
NodeData
Recursive representation for building XML nodes.
XMBranch
Which branch of an ltx:XMDual to follow — Perl’s $branch string argument to realizeXMNode, which is only ever 'content' or 'presentation'.

Constants§

CACHE_FILE
The cache’s file name in a destination directory: Perl’s LaTeXML.cache (Post.pm L1537) is a DB_File, which a Perl run into the same directory keeps reading, so ours, SQLite, has a name of its own.
LTX_NSURI
The LaTeXML namespace URI.

Functions§

element_children
Get element children of a node (skipping text, comments, etc.).
element_children_iter
Iterator version of element_children — walks the sibling chain lazily. Prefer this in hot paths that only need to read or filter children without materializing a Vec. Callers that need len() or random access still want the Vec version.
escape_xml
Escape a string for XML text content or a double-quoted attribute value.
get_xml_id
Get the xml:id attribute value from a node. Handles both namespace-aware and plain attribute access.
is_cache_file
Whether basename is the cache file or one of its SQLite side files, which no package carries.
kv_get
The value under key.
kv_put
Store value under key (remove it for None).