|
|
|
@ -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::<PathBuf>(), content);
|
|
|
|
|
write(&[&opt.output, &PathBuf::from(target)].iter().collect::<PathBuf>(), content)
|
|
|
|
|
.unwrap();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//println!("{:#?}", global);
|
|
|
|
|