diff --git a/src/main.rs b/src/main.rs index 981dea6..095089f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -102,8 +102,10 @@ fn main() { let mut main_tpl = String::new(); let mut thumb_tpl = String::new(); let mut detail_tpl = String::new(); + let mut head_tpl = String::new(); File::open(tpl_path.join("index.html")).unwrap().read_to_string(&mut main_tpl).unwrap(); File::open(tpl_path.join("_thumb.html")).unwrap().read_to_string(&mut thumb_tpl).unwrap(); + File::open(tpl_path.join("_head.html")).unwrap().read_to_string(&mut head_tpl).unwrap(); File::open(tpl_path.join("detail.html")).unwrap().read_to_string(&mut detail_tpl).unwrap(); let mut thumbs = String::new(); @@ -173,22 +175,24 @@ fn main() { // generate the detail page { let detail = detail_tpl + .replace("{head}", &head_tpl.replace("{title}", &format!("Bread from {}", date)).trim()) .replace("{title}", &date) - .replace("{note}", note); + .replace("{note}", note.trim()); let mut pics = String::new(); for img in &bread.images { - pics.push_str(&format!("", src=&utf8_percent_encode(img.to_str().unwrap(), DEFAULT_ENCODE_SET).to_string())) + pics.push_str(&format!(" \n", src=&utf8_percent_encode(img.to_str().unwrap(), DEFAULT_ENCODE_SET).to_string())) } - let detail = detail.replace("{images}", &pics); + let detail = detail.replace("{images}", &pics.trim()); let mut f = OpenOptions::new().write(true).truncate(true).create(true).open(web_path.join(detail_file)).unwrap(); f.write(detail.as_bytes()).unwrap(); } } - let main = main_tpl.replace("{breads}", &thumbs); + let main = main_tpl.replace("{breads}", &thumbs.trim()) + .replace("{head}", &head_tpl.replace("{title}", "Piggo's breads").trim()); { let mut f = OpenOptions::new().write(true).truncate(true).create(true).open(web_path.join("index.html")).unwrap(); diff --git a/web/data/2018-09-30/node.txt b/web/data/2018-09-30/note.txt similarity index 100% rename from web/data/2018-09-30/node.txt rename to web/data/2018-09-30/note.txt diff --git a/web/feed.xml b/web/feed.xml index c6fdef5..453ce9c 100644 --- a/web/feed.xml +++ b/web/feed.xml @@ -29,7 +29,8 @@
Open the link for more...
]]> + nice crust, but it had huge holes in it. idk why +Open the link for more...
]]>Like and subscribe
-Like and subscribe
- -