diff --git a/src/build/pandoc.rs b/src/build/pandoc.rs index 9275402..2b7a5f0 100644 --- a/src/build/pandoc.rs +++ b/src/build/pandoc.rs @@ -5,16 +5,25 @@ use std::env::{current_dir, current_exe}; use std::path::PathBuf; use std::error::Error; +fn add_path_hints(pandoc: &mut Pandoc, path: &mut PathBuf) { + let mut out = true; + while out { + pandoc.add_pandoc_path_hint(&path.join("lib")); + out = path.pop(); + } +} + + fn execute_pandoc(config: Config, input: String) -> Result { let mut pandoc = Pandoc::new(); - pandoc.add_pandoc_path_hint(¤t_dir().unwrap().join("lib")); - pandoc.add_pandoc_path_hint(¤t_exe().unwrap().parent().unwrap().join("lib")); pandoc.set_output_format(OutputFormat::Html5, vec![]); pandoc.set_input_format(InputFormat::Markdown, vec![]); pandoc.set_input(InputKind::Pipe(input)); pandoc.set_output(OutputKind::Pipe); pandoc.add_option(PandocOption::Smart); pandoc.add_option(PandocOption::Standalone); + add_path_hints(&mut pandoc, &mut current_exe().unwrap()); + add_path_hints(&mut pandoc, &mut current_dir().unwrap()); return pandoc.execute(); }