tikz.escobar.life

The setup for tikz.escobar.life

main.haml (1548B)

 1 - require 'yaml'
 2 
 3 %html
 4   %head
 5     = File.read "_includes/head.html"
 6 
 7   %body
 8     %main
 9       = File.read "index.html"
10 
11       #gallery(role="feed")
12         - images = YAML.load_file("images.yml")
13         - for image in images.sort_by { |i| i["path"] }
14           - path =       image["path"]
15           - author =     image["author"]
16           - author_url = image["author-url"]
17           - alt =        image["description"]
18 
19           - case path
20           - when /\.eps$/
21             - file_path = "/eps/#{path}"
22             - preview_path = "/images/#{path.gsub(".eps", ".svg")}"
23           - when /\.tikz$/
24             - file_path = "/tikz/#{path}"
25             - preview_path = "/images/#{path.gsub(".tikz", ".svg")}"
26           - when /\.jpg$/
27             - file_path = "/jpg/#{path}"
28             - preview_path = "/images/#{path.gsub(".jpg", ".webp")}"
29           - when /\.jpeg$/
30             - file_path = "/jpg/#{path}"
31             - preview_path = "/images/#{path.gsub(".jpeg", ".webp")}"
32           - when /\.png$/
33             - file_path = "/png/#{path}"
34             - preview_path = "/images/#{path.gsub(".png", ".webp")}"
35 
36           %article.tikz
37             .img-container{:"aria-label" => path}
38               %img.preview{:src => preview_path, :alt => alt}
39               .author
40                 by
41                 - if author_url.nil?
42                   =author
43                 - else
44                   %a{:rel => "author", :href => author_url}=author
45             %a{:href => file_path}&=path
46     
47     = File.read "_includes/footer.html"
48