From 3066ad20706f6f5cc58cc8e649a77846e4c7f506 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sun, 10 Sep 2017 17:59:11 +0100 Subject: [PATCH] Move CSL into config --- src/build/mod.rs | 1 - src/build/pandoc.rs | 8 +------- src/{build => config}/csl.rs | 0 src/config/mod.rs | 2 +- src/config/validate.rs | 2 +- 5 files changed, 3 insertions(+), 10 deletions(-) rename src/{build => config}/csl.rs (100%) diff --git a/src/build/mod.rs b/src/build/mod.rs index cf47a5c..4e92d96 100644 --- a/src/build/mod.rs +++ b/src/build/mod.rs @@ -1,6 +1,5 @@ pub mod pandoc; pub mod process; -pub mod csl; use config::Config; diff --git a/src/build/pandoc.rs b/src/build/pandoc.rs index 64df704..2e681ef 100644 --- a/src/build/pandoc.rs +++ b/src/build/pandoc.rs @@ -1,8 +1,6 @@ use pandoc::{self, Pandoc, PandocOutput, PandocError}; use std::error::Error; use utils::get_exe_dir; -use build::csl::unpack_csl; -use std::fs::remove_file; use std::path::PathBuf; @@ -20,11 +18,7 @@ fn execute_pandoc(input: String, csl_dir: Option) -> Result Result { - let csl_dir = unpack_csl("apa".into()); - let output = execute_pandoc(input, Some(csl_dir.clone())); - if csl_dir.exists() { - remove_file(csl_dir); - } + let output = execute_pandoc(input, None); if output.is_err() { return Err(output.err().unwrap().description().into()); } diff --git a/src/build/csl.rs b/src/config/csl.rs similarity index 100% rename from src/build/csl.rs rename to src/config/csl.rs diff --git a/src/config/mod.rs b/src/config/mod.rs index 1ca2c5c..cf86287 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -8,7 +8,7 @@ pub mod read; pub mod validate; pub mod consts; pub mod validate_types; - +pub mod csl; #[derive(Debug, Serialize, Deserialize, Default, Clone)] pub struct Config { diff --git a/src/config/validate.rs b/src/config/validate.rs index dc8c35b..2d6d487 100644 --- a/src/config/validate.rs +++ b/src/config/validate.rs @@ -2,8 +2,8 @@ use serde_yaml::Value; use std::vec::Vec; use config::read; use config::validate_types::check_config_types; +use config::csl::is_valid_csl; use utils::resolve_path; -use build::csl::is_valid_csl; pub type ValidationResult = Result<(), String>;