Expand description
The Core of latexml - roughly the equivalent of TeX conversion.
Re-exports§
pub use crate::common::error::*;
Modules§
- alignment
- Support for TeX-like Alignments
- aux_
macros - Auxiliary macros Helper macros for quicker and more idiomatic construction and access to data structures.
- binding
- The programmable API foundation for creating bindings of LaTeX sty/cls libraries
- comment
- TeX comments as standalone objects
- common
- Common abstractions that are useful at various stages of Core processing
- cycle_
guard - Windowed cycle-detection infinite-loop guard.
- definition
- All possible definitions for TeX-native commands (expandable, primitive, constructor,…)
- digested
- a shared interface for digested objects Interface layer for the full range of digested objects
- document
- An abstraction layer over the converted XML document
- dump_
codegen - Code generator: dump file → compiled Rust module Generate Rust source code from a kernel dump file.
- dump_
reader - Reader for Rust-native kernel dump files Reader for Rust-native kernel dump files (produced by dump_writer.rs).
- dump_
writer - Writer for Rust-native kernel dump files Writer for Rust-native kernel dump files.
- gullet
- The Gullet is responsible for reading Tokens and other data from the Mouth
- keyval
- A LaTeX-like Key-Value object Key-Value Definitions
- keyvals
- A collection of Key-Value objects, typically from a single LaTeX argument
- ligature
- Rules for combining together characters and other text rules
- list
- A list of
Digestedobjects - mouth
- The mouth is a thin interface over a file, responsible for reading characters and associating them with catcodes
- parameter
- The abstraction layer used by the Gullet to read arguments for the various kinds of TeX object definitions
- rewrite
- Rules for rewriting the constructed XML document, after core processing has completed
- stack_
guard - Configurable native-stack growth guard for deeply-recursive digestion.
- state
- A global, singleton, mutable state - hosts almost all TeX-facing runtime information for the conversion
- stomach
- The stomach is an abstraction responsible for digesting
TokensandRegisters prepared by the Gullet into Boxes - sxml
- Streaming XML substrate for fragmented (bounded-memory) conversion. Streaming XML substrate — the shared representation layer for fragmented (bounded-memory) conversion.
- tbox
- A TeX-like digested Box
- telemetry
- Per-job structured telemetry: phase wall times, counts, resource peaks.
See
docs/performance/TELEMETRY.mdfor the design contract. Per-job telemetry: phase wall times, counts, and resource peaks. - token
- The Token and its Catcode
- tokens
- Grouping Tokens together Token List constructors.
- util
- Auxilary utilities that do not participate in the main conversion abstraction
- watchdog
- Main-level wall-clock watchdog that forcibly aborts the process after a deadline.
Complements the cooperative
stomach::check_timeoutpolling for native-code hotspots (Marpa, libxml2, libxslt) that don’t return to the digestion loop. Wall-clock watchdog that forcibly aborts the process after a deadline. - whatsit
- A TeX-like digested Whatsit
Macros§
- Assign
Register - Char
Token - Special case: a character needs swift string conversion, so let’s use a dedicated macro
- Debug
- Debug
Feature - Feature-gated debug logging — Perl’s
Debug(...) if $LaTeXML::DEBUG{feature}. Usage:DebugFeature!("frontmatter", "FRONT Add {}", entry). Logs with the feature name as thelogtarget (so output matches the previouslog::debug!(target: "frontmatter", ...)form) and counts a Debug in the status report, likeDebug!. NB deliberately does NOT forward toDebug!— its 3-expr(category, object, message)arm would mis-capture a format string with two arguments. - Error
- Explode
- Explode a string into a list of tokens, all w/catcode OTHER (except space). Note: newlines are converted to OTHER, NOT SPACE (Perl #2700 reverted #2646). ^^J in TeX decodes to CC_OTHER by default; let the tokenizer handle catcode reassignment if needed.
- Explode
Chars - Explode
Text - Similar to Explode, but convert letters to catcode LETTER and others to OTHER Hopefully, this is essentially correct WITHOUT resorting to catcode lookup? Perl sync: newlines are OTHER, not SPACE (matches Perl #2700 revert of #2646).
- Fatal
- Font
- build a Font from key=>val pairs
- Font
Directive - build a FontDirective from key=>val pairs (currently only FontDirective::Asset is supported in this macro)
- Info
- NewDefault
- given a struct
$name, create a new instance of it using the given key=>val pairs and complete the remaining entries via the Default instance - NewDefaultV
- Just like NewDefault, but adds a mandatory
.into_option()to all values - Note
- Progress note to BOTH the log and stderr — Perl
Note(_printline): the LOG always (if a buffer is bound, ANSI-stripped), STDERR only when the verbosity admits it ($USE_STDERR && $VERBOSITY>=0≈max_level >= Info). - NoteLog
- Progress note to the LOG only — Perl
NoteLog(print $LOG … if $LOG). Always written to the bound log buffer (the log is the verbose record), never stderr. - NoteSTDERR
- Progress note to STDERR only — Perl
NoteSTDERR(if $USE_STDERR && $VERBOSITY>=0). Never touches the log. - Number
- Roman
- Convert the number to upper case roman numerals, returning a list of LaTeXML::Core::Token
- SetCounter
- SymExplode
Text - T_
ACTIVE - macro for an ACTIVE char token
- T_ALIGN
- macro for an ALIGN “&” token
- T_ARG
- macro for a numbered ARG token
- T_BEGIN
- macro for a BEGIN “{” token
- T_
COMMENT - macro for a COMMENT content token
- T_CR
- macro for a CR “\n” token
- T_CS
- macro for a command sequence token
- T_END
- macro for a new END “{” token
- T_
LETTER - macro for a LETTER token
- T_
MARKER - macro for a tracing MARKER token
- T_MATH
- macro for a MATH “$” token
- T_OTHER
- macro for an OTHER code token
- T_
OTHER_ CHAR - T_OTHER from a single character
- T_PARAM
- macro for a PARAM “#” token
- T_RELAX
- macro for T_CS(“\relax”)
- T_SPACE
- macro for a SPACE token (default “ “)
- T_SUB
- macro for a SUB “_” token
- T_SUPER
- macro for a SUPER “^” token
- Token
- Token constructor macro (defaults to OTHER code)
- Tokens
- convenience macro for assembling a Tokens object from different pieces (
Token,Vec<Token>,Tokens) - Warn
- after_
digest - after_
digest_ simple - after_
digest_ single - before_
digest - before_
digest_ simple - before_
digest_ single - construct
- count_
unpack_ ref - fatal
- fontmap
- Instantiates a
Font, using theFontfields as keys, and calling.into()for each value. The specification can be partial - missing fields are taken via theDefaulttrait. - forbid
Math - generate_
message - getter
- A closure for obtaining a
RegisterValue, usually owned by aRegistergetter. - map
- A flexary macro for constructing
HashMap<String, T>maps, whereTis generic. - mixrc
- A variant on
mixvec!where each argument receives an additional.into()call best used with an outer context that explicitly provides the expected type, such as - mixvec
- A variant on
vec!where each argument receives an additional.into()call best used with an outer context that explicitly provides the expected type, such as - noreplacement
- pin
- Call-site-cached interning for string literals — the first call on
a thread pins the literal via
pin_static, later calls return the cachedSymStrdirectly (thread-localOnceCellload, no arena access). Use this from hot state-key lookup sites so you can keep writing string literals at the call site and still skip the per-callpin()hash probe: - predigest
- print_
stderr - prints a to STDERR without a line break
- println_
stderr - prints a single line to STDERR
- prop_
bool - prop_
digested - prop_
str - prop_
string - prop_
whatsit - properties
- raw_
char_ map - A flexary macro for constructing
HashMap<char, T>maps, whereTis generic - raw_map
- A flexary macro for constructing
HashMap<K, V>maps, whereKandVare both generic (inferred at time of use) - reader
- replacement
- report
- report_
mut - require
Math - reversion
- reversion_
digested - rewrite_
replace_ sub - roman
- Convert the number to lower case roman numerals, returning a list of LaTeXML::Core::Token
- s
- The
s!macro is a briefer alias forformat! - set
- Simple generic helper for
HashSet<K,V>creation Source: https://riptutorial.com/rust/example/4149/create-a-hashset-macro - setter
- sizersub
- some
- The
some!macro transforms data in typeStoOption<Into<T>>(always wrapping withSome) - static_
map - A flexary macro for constructing
HashMap<&'static str, &'static str>maps - stored_
map - A flexary macro for constructing
SymHashMap<Stored>maps - string_
keys_ map - A flexary macro for constructing
HashMap<String, T>maps - string_
map - A flexary macro for constructing
HashMap<String, String>maps - sym_map
- A flexary macro for constructing
SymHashMap<T>maps - tagsub
- transfer_
opt_ default - Transfers a mutable pointer to a hashmap entry, or fills in with a default if missing.
- unpack_
opt - Try to efficiently unwrap a
Vec<T>into a[T;n]for$arg1…$argn - unpack_
opt_ ref - Try to efficiently unwrap a
&Vec<T>into a&[T;n]for$arg1…$argn - unported
- unref
- Convenience macro to flexibly unpack a collection of
Vec<ArgWrap>arguments into individualTokensvariables.
Structs§
- Core
- The Core conversion runtime
- Core
Options - Configuration for the Core processing
Enums§
- TexMode
- The current TeX processing mode
Statics§
Traits§
- BoxOps
- Common operations for Box-like (digested) data
Functions§
- ensure_
libxml_ init - Initialize libxml2 for thread safety. Must be called before any libxml2
operations that don’t go through
libxml::parser::Parser. Delegates to the safe wrapper in rust-libxml, which uses its ownstd::sync::Onceto guarantee exactly-once initialisation even across threads. - reset_
thread_ engine - Free this thread’s accumulated engine state — the three
Statesingletons (STATE,STD_STATE,STY_STATE) and the string-interner arena — returning them to a fresh baseline.