X-Git-Url: http://git.draconx.ca/gitweb/homepage.git/blobdiff_plain/825315fbb0673eedb0963d76878f3ea91f18e255..f57dfdb93250c13216bce633b1caf8af494552d6:/Rules diff --git a/Rules b/Rules index e81b5e2..d0a81fb 100644 --- a/Rules +++ b/Rules @@ -1,6 +1,6 @@ #!/usr/bin/env ruby # -# Copyright © 2018 Nick Bowler +# Copyright © 2018-2019 Nick Bowler # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -31,8 +31,37 @@ preprocess do end end +postprocess do + # Gzip all text items for nginx http_static + if !ENV['GZIP_SITE'].to_s.empty? + reps = @items.flat_map(&:reps).each do |rep| + file = rep.raw_path + next if !file or rep.binary? + + if system("gzip", "-ck9", file, [:out]=>[file + ".gz.tmp", "wb"]) + system("touch", "-r", file, file + ".gz.tmp") + File.rename(file + ".gz.tmp", file + ".gz") + else + File.unlink(file + ".gz.tmp") + end + end + end +end + +compile '/license/gpl*.md' do + filter :kramdown, auto_ids: false, header_offset: -1 + layout '/default.xml' + layout '/gpl.xsl' + layout '/default.xsl' + filter :relativize_paths, type: :xml + filter :remove_wj + write to_xhtml +end + compile '/**/*.md' do - filter :kramdown, header_offset: 1 + filter :erb + filter :kramdown, auto_ids: false, header_offset: 1 + snapshot :rawbody layout '/default.xml' layout '/default.xsl' filter :relativize_paths, type: :xml