tikz-gallery-generator

Custum build of stapix for tikz.pablopie.xyz

Commit
4a4d169c767bed7b13e1d8af19f76cf06a95dfd5
Parent
39064c5a2acd58e0d676255d9292b44e541f466e
Author
Pablo <pablo-pie@riseup.net>
Date

[fix] thumb paths

Fixed a logic bug on the generation of the thumbnail paths

Diffstats

1 files changed, 12 insertions, 4 deletions

Status Name Changes Insertions Deletions
Modified src/main.rs 2 files changed 12 4
diff --git a/src/main.rs b/src/main.rs
@@ -132,33 +132,41 @@ fn render_gallery(
                   || needs_update(pic, &page_path) {
       jobs.push(Job { pic_id, image_path, page_path, });
 
+      let mut thumb_path = format!(
+        "{TARGET_PATH}/{THUMBS_PATH}/{}",
+        pic.file_name
+      );
+
       match pic.file_format {
         FileFormat::TeX => {
+          thumb_path.push_str(".svg");
           tex_jobs.push(RenderingJob {
             path:      &pic.path,
             file_name: &pic.file_name,
-            thumb_path: format!("{TARGET_PATH}/{}.svg", pic.file_name).into(),
+            thumb_path: thumb_path.into(),
           });
         }
         FileFormat::Svg => {
           svg_jobs.push(RenderingJob {
             path:      &pic.path,
             file_name: &pic.file_name,
-            thumb_path: format!("{TARGET_PATH}/{}", pic.file_name).into(),
+            thumb_path: thumb_path.into(),
           });
         }
         FileFormat::Png => {
+          thumb_path.push_str(".webp");
           png_jobs.push(RenderingJob {
             path:      &pic.path,
             file_name: &pic.file_name,
-            thumb_path: format!("{TARGET_PATH}/{}.webp", pic.file_name).into(),
+            thumb_path: thumb_path.into(),
           });
         }
         FileFormat::Jpeg => {
+          thumb_path.push_str(".webp");
           jpeg_jobs.push(RenderingJob {
             path:      &pic.path,
             file_name: &pic.file_name,
-            thumb_path: format!("{TARGET_PATH}/{}.webp", pic.file_name).into(),
+            thumb_path: thumb_path.into(),
           });
         }
       }