Struct tectonic::Spx2HtmlEngine
source · pub struct Spx2HtmlEngine { /* private fields */ }
Expand description
An engine that converts SPX to HTML.
Implementations§
source§impl Spx2HtmlEngine
impl Spx2HtmlEngine
sourcepub fn assets_spec_path<S>(&mut self, path: S) -> &mut Spx2HtmlEnginewhere
S: ToString,
pub fn assets_spec_path<S>(&mut self, path: S) -> &mut Spx2HtmlEnginewhere
S: ToString,
Emit an asset specification file and not actual assets.
“Assets” are files like fonts and images that accompany the HTML output
generated during processing. SPX files contain commands that implicitly
and explicitly create assets. By default, these are emitted during
processing. If this method is called, the assets will not be created,
as if you called Self::do_not_emit_assets
. Instead, an “asset
specification” file will be emitted to the given output path. This
specification file contains the information needed to generate the
assets upon a later invocation. Asset specification files can be merged,
allowing the results of multiple separate TeX compilations to be
synthesized into one HTML output tree.
Currently, the asset specification is written in JSON format, although it is not guaranteed that this will always be the case. It will always be a UTF8-encoded, line-oriented textual format, though.
sourcepub fn precomputed_assets(
&mut self,
assets: AssetSpecification
) -> &mut Spx2HtmlEngine
pub fn precomputed_assets( &mut self, assets: AssetSpecification ) -> &mut Spx2HtmlEngine
Specify that this session should use a precomputed asset specification.
If this function is used, subsequent runs will generate HTML outputs assuming the information given in the asset specification. If the input calls for new assets or different options inconsistent with the specification, processing will abort with an error.
The purpose of this mode is to allow for a unified set of assets to be created from multiple independent runs of the SPX-to-HTML stage. First, the different inputs should be processed independently, and their individual assets should saved. These should then be merged. Then the inputs should be reprocessed, all using the merged asset specification. In one — but only one — of these sessions, the assets should actually be emitted.
sourcepub fn do_not_emit_files(&mut self) -> &mut Spx2HtmlEngine
pub fn do_not_emit_files(&mut self) -> &mut Spx2HtmlEngine
Specify that templated output files should not actually be created.
You probably want this engine to actually write its outputs to the filesystem. If you call this function, it will not. This mode can be useful if the main purpose of the processing run is to gather information about the assets that will be generated.
sourcepub fn do_not_emit_assets(&mut self) -> &mut Spx2HtmlEngine
pub fn do_not_emit_assets(&mut self) -> &mut Spx2HtmlEngine
Specify that supporting “asset” files should not actually be created.
You probably want this engine to actually write these assets to the filesystem. If you call this function, it will not. This mode can be useful if the main purpose of the processing run is to gather information about the assets that will be generated.
Calling Self::assets_spec_path
has the same effect as this function,
but also causes an asset specification file to be written to in
Tectonic’s virtual I/O backend.
sourcepub fn output_base(
&mut self,
out_base: impl Into<PathBuf>
) -> &mut Spx2HtmlEngine
pub fn output_base( &mut self, out_base: impl Into<PathBuf> ) -> &mut Spx2HtmlEngine
Specify the root path for output files.
Because this driver will, in the generic case, produce a tree of HTML output files that are not going to be used as a basis for any subsequent engine stages, it outputs directly to disk rather than using the I/O layer. I don’t like hardcoding use of the filesystem, but I don’t want to build up some extra abstraction layer right now.
sourcepub fn process_to_filesystem(
&mut self,
hooks: &mut dyn DriverHooks,
status: &mut dyn StatusBackend,
spx: &str
) -> Result<(), Error>
pub fn process_to_filesystem( &mut self, hooks: &mut dyn DriverHooks, status: &mut dyn StatusBackend, spx: &str ) -> Result<(), Error>
Process SPX into HTML.
Before calling this function, you must explicitly specify the output
mode by calling either Self::do_not_emit_files
or
Self::output_base
. If you do not, this function will panic.