tikz-gallery-generator

Custum build of stapix for tikz.pablopie.xyz

Commit
ed67e6128e2b404034fa973cd94966d8393bf75a
Parent
27a4700947b242fdc089f1f759c7f2250ef4c788
Author
Pablo <pablo-escobar@riseup.net>
Date

Changed the display of attributions in pictures

Moved the attributions to the footer of the webpage

Diffstat

3 files changed, 26 insertions, 29 deletions

Status File Name N° Changes Insertions Deletions
Modified Cargo.lock 2 1 1
Modified Cargo.toml 2 1 1
Modified src/main.rs 51 24 27
diff --git a/Cargo.lock b/Cargo.lock
@@ -584,7 +584,7 @@ dependencies = [
 
 [[package]]
 name = "stapix"
-version = "0.2.1"
+version = "0.2.2"
 dependencies = [
  "crossterm",
  "image",
diff --git a/Cargo.toml b/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "stapix"
-version = "0.2.1"
+version = "0.2.2"
 edition = "2021"
 license = "GPLv3"
 
diff --git a/src/main.rs b/src/main.rs
@@ -293,7 +293,13 @@ fn render_index(pics: &Vec<Picture>) -> io::Result<()> {
     writeln!(f, "</ul>")?;
     writeln!(f, "</main>")?;
 
-    write_footer(&mut f)?;
+    writeln!(f, "<footer>")?;
+    writeln!(
+        f,
+        "made with 💛 by <a role=\"author\" href=\"https://pablopie.xyz\">@pablo</a>"
+    )?;
+    writeln!(f, "</footer>")?;
+
     writeln!(f, "</body>")?;
     writeln!(f, "</html>")
 }
@@ -340,28 +346,12 @@ fn render_pic_page(pic: &Picture) -> io::Result<()> {
                  name = Escaped(&pic.file_name))?;
     }
     writeln!(f, "<div id=\"picture-container\">")?;
-    writeln!(f, "<div id=\"picture-frame\">")?;
     writeln!(
         f,
         "<img alt=\"{alt}\" src=\"/{PHOTOS_PATH}/{file_name}\">",
         alt = Escaped(&pic.alt),
         file_name = Escaped(&pic.file_name)
     )?;
-    writeln!(f, "<div>")?;
-    if let Some(url) = &pic.author_url {
-        writeln!(f, "by <a role=\"author\" href=\"{url}\">{author}</a>",
-                 author = Escaped(&pic.author))?;
-    } else {
-        writeln!(f, "by {author}", author = Escaped(&pic.author))?;
-    }
-    if let Some(license) = &pic.license {
-        writeln!(f, "(licensed under <a role=\"license\" href=\"{url}\">{license}</a>)",
-                 url = license.url())?;
-    } else {
-        writeln!(f, "(public domain)")?;
-    }
-    writeln!(f, "</div>")?;
-    writeln!(f, "</div>")?;
     writeln!(f, "</div>")?;
     if let Some(caption) = &pic.caption {
         writeln!(f, "<figcaption>")?;
@@ -371,7 +361,23 @@ fn render_pic_page(pic: &Picture) -> io::Result<()> {
     writeln!(f, "</figure>")?;
     writeln!(f, "</main>")?;
 
-    write_footer(&mut f)?;
+    writeln!(f, "<footer>")?;
+    write!(f, "original work by ")?;
+    if let Some(url) = &pic.author_url {
+        writeln!(f, "<a role=\"author\" href=\"{url}\">{author}</a>",
+                 author = Escaped(&pic.author))?;
+    } else {
+        writeln!(f, "{}", Escaped(&pic.author))?;
+    }
+    writeln!(f, "<br>")?;
+    if let Some(license) = &pic.license {
+        writeln!(f, "licensed under <a role=\"license\" href=\"{url}\">{license}</a>",
+                 url = license.url())?;
+    } else {
+        writeln!(f, "this is public domain")?;
+    }
+    writeln!(f, "</footer>")?;
+
     writeln!(f, "</body>")?;
     writeln!(f, "</html>")
 }
@@ -385,15 +391,6 @@ fn write_nav(f: &mut File) -> io::Result<()> {
     writeln!(f, "</header>")
 }
 
-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 write_head(f: &mut File) -> io::Result<()> {
     writeln!(