diff --git a/src/main.rs b/src/main.rs
@@ -68,11 +68,11 @@ fn render_index(pic_infos: &Vec<PictureInfo>) -> io::Result<()> {
let mut f = File::create("index.html")?;
writeln!(f, "<!DOCTYPE html>")?;
- print_license(&mut f)?;
+ write_license(&mut f)?;
writeln!(f, "<html lang=\"en\">")?;
writeln!(f, "<head>")?;
writeln!(f, "<title>Pablo's Photo Gallery</title>")?;
- print_head(&mut f)?;
+ write_head(&mut f)?;
for pic in pic_infos {
// TODO: Preload a compressed thumbnail instead
@@ -84,7 +84,7 @@ fn render_index(pic_infos: &Vec<PictureInfo>) -> io::Result<()> {
writeln!(f, "</head>")?;
writeln!(f, "<body>")?;
- print_nav(&mut f)?;
+ write_nav(&mut f)?;
writeln!(f, "<main>")?;
writeln!(f, "<ul id=\"gallery\">")?;
@@ -102,7 +102,7 @@ fn render_index(pic_infos: &Vec<PictureInfo>) -> io::Result<()> {
writeln!(f, "</ul>")?;
writeln!(f, "</main>")?;
- print_footer(&mut f)?;
+ write_footer(&mut f)?;
writeln!(f, "</body>")?;
writeln!(f, "</html>")
}
@@ -121,19 +121,19 @@ fn render_pic_page(pic: &PictureInfo) -> io::Result<()> {
};
writeln!(f, "<!DOCTYPE html>")?;
- print_license(&mut f)?;
+ write_license(&mut f)?;
writeln!(f, "<html lang=\"en\">")?;
writeln!(f, "<head>")?;
writeln!(f, "<title>Pablo's Photo Gallery ‐ {name}</title>",
name = Escaped(&pic.file_name))?;
- print_head(&mut f)?;
+ write_head(&mut f)?;
writeln!(f,
"<link as=\"image\" rel=\"preload\" href=\"/assets/photos/{n}\">",
n = Escaped(&pic.file_name))?;
writeln!(f, "</head>")?;
writeln!(f, "<body>")?;
- print_nav(&mut f)?;
+ write_nav(&mut f)?;
writeln!(f, "<main>")?;
writeln!(f, "<figure>")?;
writeln!(f, "<div id=\"picture-container\">")?;
@@ -142,15 +142,14 @@ fn render_pic_page(pic: &PictureInfo) -> io::Result<()> {
file_name = Escaped(&pic.file_name))?;
writeln!(f, "</div>")?;
writeln!(f, "</figure>")?;
-
writeln!(f, "</main>")?;
- print_footer(&mut f)?;
+ write_footer(&mut f)?;
writeln!(f, "</body>")?;
writeln!(f, "</html>")
}
-fn print_nav(f: &mut File) -> io::Result<()> {
+fn write_nav(f: &mut File) -> io::Result<()> {
writeln!(f, "<header>")?;
writeln!(f, "<nav>")?;
writeln!(f, "<img aria-hidden=\"true\" width=\"24\" height=\"24\" src=\"/assets/icon.svg\">")?;
@@ -159,14 +158,14 @@ fn print_nav(f: &mut File) -> io::Result<()> {
writeln!(f, "</header>")
}
-fn print_footer(f: &mut File) -> io::Result<()> {
+fn write_footer(f: &mut File) -> io::Result<()> {
writeln!(f, "<footer>")?;
writeln!(f, "made with 💛 by <a role=\"author\" href=\"https://pablopie.xyz\">@pablo</a>")?;
writeln!(f, "</footer>")
}
/// Prints the common head elements to a given file
-fn print_head(f: &mut File) -> io::Result<()> {
+fn write_head(f: &mut File) -> io::Result<()> {
writeln!(f, "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">")?;
writeln!(f, "<meta name=\"author\" content=\"Pablo\">")?;
writeln!(f, "<meta name=\"copyright\" content=\"GPLv2\">")?;
@@ -176,7 +175,7 @@ fn print_head(f: &mut File) -> io::Result<()> {
}
/// Prints a HTML comment with GPL licensing info
-fn print_license(f: &mut File) -> io::Result<()> {
+fn write_license(f: &mut File) -> io::Result<()> {
writeln!(f, "<!-- This program is free software: you can redistribute it and/or modify")?;
writeln!(f, " it under the terms of the GNU General Public License as published by")?;
writeln!(f, " the Free Software Foundation, either version 3 of the License, or")?;