Move CSL into config
This commit is contained in:
parent
a3ace18cd3
commit
3066ad2070
5 changed files with 3 additions and 10 deletions
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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());
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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>;
|
||||||
|
|
Reference in a new issue