diff --git a/Cargo.lock b/Cargo.lock index eb1307d..74247ff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -75,7 +75,7 @@ checksum = "dd8f7255a17a627354f321ef0055d63b898c6fb27eff628af4d1b66b7331edf6" [[package]] name = "prezgen" -version = "0.1.0" +version = "0.2.0" dependencies = [ "structopt", "toml", diff --git a/src/main.rs b/src/main.rs index cfc469b..abcbdb7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,8 +1,8 @@ use structopt::StructOpt; use toml::Value; -use std::collections::hash_map::DefaultHasher; -use std::fs::{copy, create_dir, read_to_string, write}; +//use std::collections::hash_map::DefaultHasher; +use std::fs::{create_dir, read_to_string, write}; use std::path::PathBuf; #[derive(StructOpt, Debug)] @@ -77,14 +77,18 @@ fn main() { // iterate over pages for (index, value) in page.as_array().unwrap().iter().enumerate() { - let table = collect_table(&value); + // add global variables to table + // FIXME + let mut table = collect_table(&value); + table.extend(global.clone()); let content = replace(input.clone(), table.as_slice()); // create the files let target = format!("front-{}.html", index); println!("writing {}", target); - write(&[&opt.output, &PathBuf::from(target)].iter().collect::(), content); + write(&[&opt.output, &PathBuf::from(target)].iter().collect::(), content) + .unwrap(); } //println!("{:#?}", global);