References are meant to be optional...
This commit is contained in:
parent
823c8bc1ad
commit
1b395a8f60
2 changed files with 7 additions and 4 deletions
|
@ -16,7 +16,7 @@ pub struct Config {
|
|||
pub output: HashMap<String, PathBuf>,
|
||||
pub title: String,
|
||||
pub verbosity: u64,
|
||||
pub references: References
|
||||
pub references: Option<References>
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default, Clone)]
|
||||
|
|
|
@ -58,10 +58,13 @@ pub fn get_output_files(conf: Value) -> HashMap<String, PathBuf> {
|
|||
return output_map;
|
||||
}
|
||||
|
||||
pub fn get_references(config: Value) -> References {
|
||||
pub fn get_references(config: Value) -> Option<References> {
|
||||
if config.get("references").is_none() {
|
||||
return None;
|
||||
}
|
||||
let references = config.get("references").unwrap();
|
||||
return References {
|
||||
return Some(References {
|
||||
bibliography: resolve_path(references.get("bibliography").unwrap().as_str().unwrap().into()),
|
||||
csl: unpack_csl(references.get("csl").unwrap().as_str().unwrap().into())
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Reference in a new issue