tikz-gallery-generator

Custum build of stapix for tikz.pablopie.xyz

Commit
66dd5f9f727a8a66cebb1b207df0272c7445fddb
Parent
1ed0b71f7c10f84835d799bc7af768266d901860
Author
Pablo <pablo-escobar@riseup.net>
Date

Changed the rendering of links in the figure pages

Changed how links to the file and the original source are displayed in the firegure's page

Also fixed a typo

Diffstat

2 files changed, 18 insertions, 12 deletions

Status File Name N° Changes Insertions Deletions
Modified src/gallery_entry.rs 2 1 1
Modified src/main.rs 28 17 11
diff --git a/src/gallery_entry.rs b/src/gallery_entry.rs
@@ -135,7 +135,7 @@ impl LicenseType {
         assert!(s.len() >= 3,
                 "if s is in LICENSES it should contain at least 3 chars");
 
-        let (license, version) = s.rsplit_once("-").ok_or(())?;
+        let (license, version) = s.rsplit_once('-').ok_or(())?;
 
         let version = match version {
             "1"   => CcVersion::One,
diff --git a/src/main.rs b/src/main.rs
@@ -356,19 +356,30 @@ fn render_pic_page(pic: &GalleryEntry) -> io::Result<()> {
                  name = Escaped(&pic.file_name))?;
     }
     writeln!(f, "<div id=\"picture\">")?;
+    writeln!(f, "<div>")?;
+
     writeln!(f, "<div class=\"picture-container\">")?;
     writeln!(
         f,
-        "<a aria-label=\"{name}\" href=\"/{IMAGES_PATH}/{name}\">",
-        name = Escaped(&pic.file_name)
-    )?;
-    writeln!(
-        f,
         "<img alt=\"{alt}\" src=\"{path}\">",
         alt = Escaped(&pic.alt),
         path = ThumbPath(pic),
     )?;
-    writeln!(f, "</a>")?;
+    writeln!(f, "</div>")?;
+
+    writeln!(f, "<nav id=\"picture-nav\">")?;
+    writeln!(f, "<ul>")?;
+    writeln!(
+        f,
+        "<li><a href=\"/{IMAGES_PATH}/{name}\">download</a></li>",
+        name = Escaped(&pic.file_name),
+    )?;
+    if let Some(src) = &pic.source {
+        writeln!(f, "<li><a href=\"{src}\">original source</a></li>")?;
+    }
+    writeln!(f, "</ul>")?;
+    writeln!(f, "</nav>")?;
+
     writeln!(f, "</div>")?;
     writeln!(f, "</div>")?;
     if let Some(caption) = &pic.caption {
@@ -376,11 +387,6 @@ fn render_pic_page(pic: &GalleryEntry) -> io::Result<()> {
         writeln!(f, "{}", Escaped(caption))?;
         writeln!(f, "</figcaption>")?;
     }
-    if let Some(src) = &pic.source {
-        writeln!(f, "<figcaption class=\"image-source\">")?;
-        writeln!(f, "original source: <a href=\"{src}\">{src}</a>")?;
-        writeln!(f, "</figcaption>")?;
-    }
     writeln!(f, "</figure>")?;
     writeln!(f, "</main>")?;