pub trait PathResolver: Debug {
// Required method
fn web_path(&self, target: &str, start: Option<&str>) -> String;
}Expand description
A PathResolver handles all operations for resolving, cleaning, and joining
paths, covering both web paths (request URIs) and system paths.
The crate calls web_path to turn an asset target (an
image src, a stylesheet href, and so on) – optionally relative to a start
path – into the clean, resolved path that appears in the rendered output.
Clean paths are void of duplicate parent and current directory references in
the path name.
This is one of the crate’s extensibility seams, alongside
IncludeFileHandler, ImageFileHandler, SvgFileHandler,
DocinfoFileHandler, ReferenceResolver, and
InlineSubstitutionRenderer. A host that needs custom path or URL
rewriting – a virtual filesystem, a content root, URL slugs (as an
Antora- or Zola-style site generator might) – can supply its own
implementation via Parser::with_path_resolver. The default
implementation, DefaultPathResolver, mirrors Ruby Asciidoctor’s
PathResolver.
Required Methods§
Sourcefn web_path(&self, target: &str, start: Option<&str>) -> String
fn web_path(&self, target: &str, start: Option<&str>) -> String
Resolve a web path from the target and start paths.
The main function of this operation is to resolve any parent references and remove any self references.
The target is assumed to be a path, not a qualified URI. That check should happen before this method is invoked.
Returns a path that joins the target path with the start path with any parent references resolved and self references removed.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".