Struct crowbook::ResourceHandler
[−]
[src]
pub struct ResourceHandler { /* 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 ResourceHandler
[src]
pub fn new() -> ResourceHandler
[src]
Creates a new, empty Resource Handler
ⓘImportant traits for &'a mut Wpub fn set_images_mapping(&mut self, b: bool) -> &mut Self
[src]
ⓘImportant traits for &'a mut W
Turns on mapping for image files
Argument: an offset (should be book.root)
pub fn set_base64(&mut self, b: bool)
[src]
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
pub fn map_image<'a, S: Into<Cow<'a, str>>>(
&'a mut self,
source: &Source,
file: S
) -> Result<Cow<'a, str>>
[src]
&'a mut self,
source: &Source,
file: S
) -> Result<Cow<'a, str>>
Add a local image file and get the resulting transformed file name
pub fn add_link<S1: Into<String>, S2: Into<String>>(&mut self, from: S1, to: S2)
[src]
Add a match between an original file and a dest file
pub fn get_link<'a>(&'a self, from: &'a str) -> &'a str
[src]
Get a destination link from an original link
pub fn contains_link(&self, from: &str) -> bool
[src]
Tell whether a file name is a local resource or net
pub fn is_local(path: &str) -> bool
[src]
pub fn add_offset(link_offset: &Path, image_offset: &Path, ast: &mut [Token])
[src]
Add a path offset to all linked urls and images src