kittv
/
prezgen
Archived
1
0
Fork 0

fixed retardation - global variables now not ignored

master
Dawid J. Kubis 3 years ago
parent aeefa2c977
commit 643d734679

2
Cargo.lock generated

@ -75,7 +75,7 @@ checksum = "dd8f7255a17a627354f321ef0055d63b898c6fb27eff628af4d1b66b7331edf6"
[[package]] [[package]]
name = "prezgen" name = "prezgen"
version = "0.1.0" version = "0.2.0"
dependencies = [ dependencies = [
"structopt", "structopt",
"toml", "toml",

@ -1,8 +1,8 @@
use structopt::StructOpt; use structopt::StructOpt;
use toml::Value; use toml::Value;
use std::collections::hash_map::DefaultHasher; //use std::collections::hash_map::DefaultHasher;
use std::fs::{copy, create_dir, read_to_string, write}; use std::fs::{create_dir, read_to_string, write};
use std::path::PathBuf; use std::path::PathBuf;
#[derive(StructOpt, Debug)] #[derive(StructOpt, Debug)]
@ -77,14 +77,18 @@ fn main() {
// iterate over pages // iterate over pages
for (index, value) in page.as_array().unwrap().iter().enumerate() { 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()); let content = replace(input.clone(), table.as_slice());
// create the files // create the files
let target = format!("front-{}.html", index); let target = format!("front-{}.html", index);
println!("writing {}", target); 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); //println!("{:#?}", global);