diff --git a/main.haml b/main.haml
@@ -1,4 +1,4 @@
-- require 'mini_exiftool'
+- require 'yaml'
%html
%head
= File.read "_includes/head.html"
@@ -8,42 +8,29 @@
= File.read "index.html"
#gallery(role="feed")
- - for file in Dir["images/*.tikz", "images/*.eps", "images/*.jpeg", "images/*.jpg", "images/*.png"].sort
- - filename = file.gsub "images/", ""
- - case file
+ - images = YAML.load_file("images.yml")
+ - for image in images.sort_by { |i| i["path"] }
+ - path = image["path"]
+ - alt = image["description"]
+
+ - case path
- when /\.eps$/
- - filepath = file.gsub "images/", "/eps/"
- - img_scr = "/" + file.gsub(".eps", ".svg")
+ - file_path = "/eps/#{path}"
+ - preview_path = "/images/#{path.gsub(".eps", ".svg")}"
- when /\.tikz$/
- - filepath = file.gsub "images/", "/tikz/"
- - img_scr = "/" + file.gsub(".tikz", ".svg")
+ - file_path = "/tikz/#{path}"
+ - preview_path = "/images/#{path.gsub(".tikz", ".svg")}"
- when /\.jpg$/, /\.jpeg$/
- - filepath = file.gsub "images/", "/jpg/"
- - img_scr = "/" + file.gsub(".jpeg", ".jpg")
+ - file_path = "/jpg/#{path}"
+ - preview_path = "/images/#{path.gsub(".jpeg", ".jpg")}"
- when /\.png$/
- - filepath = file.gsub "images/", "/png/"
- - img_scr = "/" + file.gsub(".png", ".jpg")
-
- - case file
- - when /\.png$/, /\.jpg$/, /\.jpeg$/, /\.eps$/
- - exif = MiniExiftool.new file
- - alt = (exif["description"] or filename).strip
- - when /\.tikz$/
- - lines = IO.readlines(file).take_while {|line| line =~ /^\%/}
- - lines.pop
-
- - if lines.empty?
- - alt = filename
- - else
- - alt = lines.map {|line| line.strip.gsub /^\% ?/, ""}.join " "
-
- - else
- - alt = filename
+ - file_path = "/png/#{path}"
+ - preview_path = "/images/#{path.gsub(".png", ".jpg")}"
.tikz(role="article")
- .img-container{:"aria-label" => filename}
- %img{:src => img_scr, :alt => alt}
- %a{:href => filepath}&=filename
+ .img-container{:"aria-label" => path}
+ %img{:src => preview_path, :alt => alt}
+ %a{:href => file_path}&=path
= File.read "_includes/footer.html"