Expand description
XML/HTML output sink — port of LaTeXML::Post::Writer.
Two related concerns live here:
- The
Writerpost-processor (last in the chain) that serializes aPostDocumentto itsdestination, handling DOCTYPE removal, TEMPORARY_DOCUMENT_ID cleanup, and HTML vs XML serialization. - Free-standing helpers (
write_output,ensure_parent_dir) used by binary main()s that already have the serialized string in hand (post-processing returns aString) and need to route it to a destination path or stdout. Replaces the duplicatedFile::create + write! + ensure_parent_dirboilerplate that used to live inlatexml_oxide.rs(and the now-retiredlatexmlpost_oxide.rs).
Companion module: crate::pack (the LaTeXML::Post::Pack analog)
handles archive bundling when the destination is a zip.
Structs§
- Writer
- Writer post-processor: serializes document to file.
Enums§
- Output
Format - Output format for the writer.
Functions§
- ensure_
parent_ dir - Ensure the parent directory of
pathexists, creating it (and any missing ancestors) as needed. No-op whenpathhas no parent or the parent is the current directory. - write_
output - Write the serialized output
contenttodestifSome, else to stdout. Creates parent directories as needed. - write_
output_ segments - Like
write_outputbut writes several segments back-to-back without concatenating them into one buffer first. Used for the conversion log, where the core and post-phase segments are each already-allocated and large for real articles — aformat!("{core}{post}")would allocate a third copy of their combined size on the conversion hot path. Segments are written verbatim and in order through a singleBufWriter(one file open/truncate); insert any separators (e.g."\n") as their own segments.