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
34
35
36
37
38
pub use self::links::LinkPreprocessor;
mod links;
use book::Book;
use config::Config;
use errors::*;
use std::path::PathBuf;
pub struct PreprocessorContext {
pub root: PathBuf,
pub config: Config,
}
impl PreprocessorContext {
pub(crate) fn new(root: PathBuf, config: Config) -> Self {
PreprocessorContext { root, config }
}
}
pub trait Preprocessor {
fn name(&self) -> &str;
fn run(&self, ctx: &PreprocessorContext, book: &mut Book) -> Result<()>;
}