Move CSL into config

This commit is contained in:
Jake Howard 2017-09-10 17:59:11 +01:00
parent a3ace18cd3
commit 3066ad2070
Signed by: jake
GPG key ID: 57AFB45680EDD477
5 changed files with 3 additions and 10 deletions

View file

@ -1,6 +1,5 @@
pub mod pandoc; pub mod pandoc;
pub mod process; pub mod process;
pub mod csl;
use config::Config; use config::Config;

View file

@ -1,8 +1,6 @@
use pandoc::{self, Pandoc, PandocOutput, PandocError}; use pandoc::{self, Pandoc, PandocOutput, PandocError};
use std::error::Error; use std::error::Error;
use utils::get_exe_dir; use utils::get_exe_dir;
use build::csl::unpack_csl;
use std::fs::remove_file;
use std::path::PathBuf; use std::path::PathBuf;
@ -20,11 +18,7 @@ fn execute_pandoc(input: String, csl_dir: Option<PathBuf>) -> Result<PandocOutpu
pub fn render(input: String) -> Result<String, String> { pub fn render(input: String) -> Result<String, String> {
let csl_dir = unpack_csl("apa".into()); let output = execute_pandoc(input, None);
let output = execute_pandoc(input, Some(csl_dir.clone()));
if csl_dir.exists() {
remove_file(csl_dir);
}
if output.is_err() { if output.is_err() {
return Err(output.err().unwrap().description().into()); return Err(output.err().unwrap().description().into());
} }

View file

@ -8,7 +8,7 @@ pub mod read;
pub mod validate; pub mod validate;
pub mod consts; pub mod consts;
pub mod validate_types; pub mod validate_types;
pub mod csl;
#[derive(Debug, Serialize, Deserialize, Default, Clone)] #[derive(Debug, Serialize, Deserialize, Default, Clone)]
pub struct Config { pub struct Config {

View file

@ -2,8 +2,8 @@ use serde_yaml::Value;
use std::vec::Vec; use std::vec::Vec;
use config::read; use config::read;
use config::validate_types::check_config_types; use config::validate_types::check_config_types;
use config::csl::is_valid_csl;
use utils::resolve_path; use utils::resolve_path;
use build::csl::is_valid_csl;
pub type ValidationResult = Result<(), String>; pub type ValidationResult = Result<(), String>;