only render PDF if needed
This commit is contained in:
parent
a0f945947a
commit
b8fadf82a9
2 changed files with 8 additions and 3 deletions
|
@ -30,6 +30,9 @@ fn check_input_files(config: Value) -> ValidationResult {
|
||||||
fn check_output_files(config: Value) -> ValidationResult {
|
fn check_output_files(config: Value) -> ValidationResult {
|
||||||
let files = read::get_output_files(config);
|
let files = read::get_output_files(config);
|
||||||
let output_types = vec!["pdf".into()];
|
let output_types = vec!["pdf".into()];
|
||||||
|
if files.is_empty() {
|
||||||
|
return Err("You need to provide at least 1 output format".into());
|
||||||
|
}
|
||||||
for file_def in files.iter() {
|
for file_def in files.iter() {
|
||||||
let dir = file_def.1.parent().unwrap();
|
let dir = file_def.1.parent().unwrap();
|
||||||
if !dir.exists() || !dir.is_dir() {
|
if !dir.exists() || !dir.is_dir() {
|
||||||
|
|
|
@ -2,7 +2,9 @@ use config::Config;
|
||||||
|
|
||||||
pub mod pdf;
|
pub mod pdf;
|
||||||
|
|
||||||
pub fn output(config: Config, output: String) -> Result<String, String> {
|
pub fn output(config: Config, output: String) -> Result<(), String> {
|
||||||
pdf::output(config, output);
|
if config.output.contains_key("pdf") {
|
||||||
return Ok("".into());
|
try!(pdf::output(config, output));
|
||||||
|
}
|
||||||
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue