Pull out default preprocessors into function

This commit is contained in:
Jaime Valdemoros 2018-01-16 22:25:51 +00:00
parent 4177288b11
commit f2d7b705af
1 changed files with 5 additions and 1 deletions

View File

@ -333,6 +333,10 @@ fn determine_renderers(config: &Config) -> Vec<Box<Renderer>> {
renderers
}
fn default_preprocessors() -> Vec<Box<Preprocessor>> {
vec![Box::new(LinkPreprocessor::new())]
}
/// Look at the `MDBook` and try to figure out what preprocessors to run.
fn determine_preprocessors(config: &Config) -> Result<Vec<Box<Preprocessor>>> {
@ -340,7 +344,7 @@ fn determine_preprocessors(config: &Config) -> Result<Vec<Box<Preprocessor>>> {
Some(ref p) => p,
// If no preprocessor field is set, default to the LinkPreprocessor. This allows you
// to disable the LinkPreprocessor by setting "preprocess" to an empty list.
None => return Ok(vec![Box::new(LinkPreprocessor::new())])
None => return Ok(default_preprocessors())
};
let mut preprocessors: Vec<Box<Preprocessor>> = Vec::new();