1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use failure::Error;
use mdbook::renderer::RenderContext;
use std::path::PathBuf;
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(default, rename_all = "kebab-case")]
pub struct Config {
pub additional_css: Vec<PathBuf>,
pub use_default_css: bool,
}
impl Config {
pub fn from_render_context(ctx: &RenderContext) -> Result<Config, Error> {
match ctx.config.get("output.epub") {
Some(table) => table.clone().try_into().map_err(Error::from),
None => Ok(Config::default()),
}
}
}
impl Default for Config {
fn default() -> Config {
Config {
use_default_css: true,
additional_css: Vec::new(),
}
}
}