Preprocess links by default

This commit is contained in:
Jaime Valdemoros 2018-01-07 19:11:51 +00:00
parent 12815fe399
commit 4cc708e00f
1 changed files with 10 additions and 2 deletions

View File

@ -340,15 +340,23 @@ fn determine_preprocessors(md_book: &MDBook) -> Vec<Box<Preprocessor>> {
if let Some(preprocess_array) = md_book.config.get("pre_process").and_then(|o| o.as_array()) { if let Some(preprocess_array) = md_book.config.get("pre_process").and_then(|o| o.as_array()) {
for key in preprocess_array.iter() { for key in preprocess_array.iter() {
if key.as_str().map_or(false, |key| key == "links") { if key.as_str().map_or(false, |key| key == "links") {
let preprocessor = preprocess::links::ReplaceAllPreprocessor { let replace_all_preprocessor = preprocess::links::ReplaceAllPreprocessor {
src_dir: md_book.source_dir(), src_dir: md_book.source_dir(),
}; };
preprocessors.push(Box::new(preprocessor)) preprocessors.push(Box::new(replace_all_preprocessor))
} }
} }
} }
if preprocessors.is_empty() {
let replace_all_preprocessor = preprocess::links::ReplaceAllPreprocessor {
src_dir: md_book.source_dir(),
};
preprocessors.push(Box::new(replace_all_preprocessor))
}
preprocessors preprocessors
} }