Struct crowbook::ResourceHandler
[−]
[src]
pub struct ResourceHandler<'r> { /* fields omitted */ }
Resource Handler.
Its task is to make sure that some resource (image, link) is available for the book and to list images used in Markdown files so they can be used for the book
Methods
impl<'r> ResourceHandler<'r>
[src]
fn new(logger: &'r Logger) -> ResourceHandler
Creates a new, empty Resource Handler
fn set_images_mapping(&mut self, b: bool)
Turns on mapping for image files
Argument: an offset (should be book.root)
fn set_base64(&mut self, b: bool)
Sets base64 mode for image mapping
If set to true, instead of returning a destination file path,
map_image
will include the image as base64
fn map_image<'a, S: Into<Cow<'a, str>>>(&'a mut self, source: &Source, file: S) -> Result<Cow<'a, str>>
Add a local image file and get the resulting transformed file name
fn add_link<S: Into<String>>(&mut self, from: S, to: S)
Add a match between an original file and a dest file
fn get_link<'a>(&'a self, from: &'a str) -> &'a str
Get a destination link from an original link
fn is_local(path: &str) -> bool
Tell whether a file name is a local resource or net
fn add_offset(link_offset: &Path, image_offset: &Path, ast: &mut [Token])
Add a path offset to all linked urls and images src