archive
/
md-pdf-rs
Archived
1
Fork 0

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 process;
pub mod csl;
use config::Config;

View File

@ -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<PathBuf>) -> Result<PandocOutpu
pub fn render(input: String) -> Result<String, String> {
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());
}

View File

@ -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 {

View File

@ -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>;