Expand description
Output-path templates for the -o / --output CLI flag.
The model is Ghostscript’s: the path the user supplies is a literal
template, and the decision about per-page naming is made from the string
alone rather than from the number of pages. A template containing a %d
conversion expands once per page; one without it names a single file.
Deciding from the string matters because PostScript page counts are not
knowable in advance — pages arrive as showpage executes, so the name of
page 1 has to be committed before anyone knows whether a page 2 exists.
Ghostscript resolves this by opening the literal path once and streaming
every page into it, which silently produces a file holding several
concatenated images (measured against gs 10.05.1: three PNG signatures and
three IEND chunks in one .png, exit 0, no warning). stet accepts the
same templates but raises ExpandError::MultiPageNeedsToken on the
second page instead, leaving page 1 on disk intact.
Structs§
- Output
Template - A parsed
-o/--outputtemplate.
Enums§
- Expand
Error - Why a template could not be expanded for a given page.
- Template
Error - Why a template could not be parsed.
Functions§
- insert_
page_ number - Insert a
-NNNpage number before a path’s extension. - split_
extension - Split a path into (stem, extension-with-dot) at the final
.of the last path component. ReturnsNonewhen that component has no extension.