From 1ab44cebeb4a5b978d497fe44e64322093bfe715 Mon Sep 17 00:00:00 2001 From: Julian T Date: Thu, 4 Jun 2020 14:15:07 +0200 Subject: Images link to originals --- build.rb | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/build.rb b/build.rb index 53b6a99..608c6aa 100755 --- a/build.rb +++ b/build.rb @@ -35,6 +35,16 @@ def forImgs(imgs, &block) end end +def placeImage(file, src, href = nil) + if href + file.puts "" + end + file.puts "" + if href + file.puts "" + end +end + options = {} OptionParser.new do |opts| opts.banner = "Usage: build.rb dest" @@ -51,6 +61,9 @@ OptionParser.new do |opts| opts.on("-c", "--clean", "Cleanup unused images") do |v| options[:clean] = true end + opts.on("-b", "--linkbase URL", "Add links to images, with URL as base") do |url| + options[:base] = url + end end.parse! options[:path] = "build" unless options[:path] @@ -89,7 +102,13 @@ File.open(File.join(options[:path], "index.html"), "w") do |file| defs["groups"].each do |key, value| file.puts "

#{key}

" forImgs(value["imgs"]) do |img| - file.puts "" + href = options[:base] + # If href is given add a filename at the end + if href + href = File.join(href, img) + end + + placeImage(file, files[img], href) end if value["what"] @@ -98,7 +117,6 @@ File.open(File.join(options[:path], "index.html"), "w") do |file| end - if options[:commit] file.puts "

Build from commit #{options[:commit]}

" end -- cgit v1.2.3