pub struct Converter { /* private fields */ }Implementations§
Source§impl Converter
impl Converter
pub fn from_config(opts: Config) -> Converter
Sourcepub fn note_main_source(&mut self, source: &str)
pub fn note_main_source(&mut self, source: &str)
Records, before a session’s preloads load, whether source (a path or literal: content) is a plain TeX
document: arXiv AutoTeX’s tex-vs-latex test (compile_route’s cues). latexml.sty’s preload registers an
\AddToHook, which autoloads the LaTeX format; for a plain document that rebound \end, so the document’s own
\end raised “\endgroup Attempt to close a group that switched to mode vertical” (stopped full-arXiv run 329:
27 of 16,333 papers, 0911.4241, 1001.3079, hep-th9310069), and pstricks.tex took its LaTeX branch (repro
loader/latexml_preload_keeps_plain.tex). A LaTeX document keeps the format at preload time, pdflatex’s order.
Also records a DVI driver class option. Every caller that prepares a session first tells it its source; a
streaming restart or a supplement is a converter of its own and is told again.
Sourcepub fn initialize_session(&mut self) -> Result<()>
pub fn initialize_session(&mut self) -> Result<()>
Prepare the session, logging it (a failing --preload, the dump loads) into the session log, as Perl’s
initialize_session binds the log first (LaTeXML.pm:98).
pub fn bind_log(&mut self)
pub fn flush_log(&mut self) -> String
pub fn convert(self, source: String) -> ConversionResponse
Sourcepub fn convert_content_with_provenance(
self,
name: &str,
content: String,
) -> ConversionResponse
pub fn convert_content_with_provenance( self, name: &str, content: String, ) -> ConversionResponse
Convert in-memory content under the source name name, producing the
HTML5-format core XML (the persistent server then post-processes it).
Unlike Converter::convert (literal: → anonymous source), the source
is named, so --source-map stamps its locators. Focused on the
Document/HTML5 path the server uses — no amble wrapping, no TeX/Box
output formats.
pub fn prepare_session<'preplifetime>( &'preplifetime mut self, _opts: &'preplifetime Config, ) -> Result<()>
Sourcepub fn digest_content_with_provenance(
&mut self,
name: &str,
content: String,
) -> Result<Digested>
pub fn digest_content_with_provenance( &mut self, name: &str, content: String, ) -> Result<Digested>
Digest in-memory content as the main document named name, leaving
the thread-local engine state live. Used by the persistent server to
warm a preamble once (then resume body digestion in a fork child over the
inherited state) and by Converter::convert_content_with_provenance for
the in-process path.
This is the in-memory twin of crate::core_interface::DigestionAPI::digest_file:
same top-level spine — establish the source context, open the source,
digest_internal — but the content is supplied rather than read from
disk. It shares core_interface::establish_source_context with
digest_file (so SOURCEFILE/SOURCEDIRECTORY/SEARCHPATHS/
GRAPHICSPATHS/\jobname can’t drift), making sibling
\usepackage/\input/\includegraphics of local files resolve. The
source is opened as a named mouth (not the anonymous literal:
protocol) so locators carry name — the provenance that
--source-map needs (stamp_source_locator only stamps
.tex/.ltx/.bbl/.bib user sources). Initializes the session if
needed; does not finalize a document.