3 # Copyright © 2018-2020 Nick Bowler
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <https://www.gnu.org/licenses/>.
19 # Remove dead annex keys from processing
20 @items.delete_if do |item|
21 l = File.readlink(item.raw_filename)
22 true if !File.exists?(item.raw_filename) and l =~ %r{/annex/objects/}
27 Open3.popen2("git", "rev-parse", "HEAD") do |stdin, stdout, result|
31 commit = val.chomp if result.value.success?
36 item[:gitrev] = commit if item_source(item)
42 # Gzip all text items for nginx http_static
43 if !ENV['GZIP_SITE'].to_s.empty?
44 reps = @items.flat_map(&:reps).each do |rep|
46 next if !file or rep.binary?
48 if system("gzip", "-ck9", file, [:out]=>[file + ".gz.tmp", "wb"])
49 system("touch", "-r", file, file + ".gz.tmp")
50 File.rename(file + ".gz.tmp", file + ".gz")
52 File.unlink(file + ".gz.tmp")
58 compile '/license/gpl*.md' do
59 filter :kramdown, auto_ids: false, header_offset: -1
63 filter :relativize_paths, type: :xml
71 filter :kramdown, auto_ids: false, header_offset: 1
75 filter :relativize_paths, type: :xml
81 compile '/license/cc*.sgml' do
83 layout '/creativecommons.xsl'
85 layout '/default.xsl', "section-links": "yes"
86 filter :relativize_paths, type: :xml
92 compile '/license/cc*.xhtml' do
93 layout '/creativecommons.xsl'
95 layout '/default.xsl', "section-links": "yes"
96 filter :relativize_paths, type: :xml
102 compile '/**/*.scss' do
103 filter :sass, syntax: :scss
104 filter :css_source, uribase: \
105 "https://git.draconx.ca/gitweb/homepage.git/blob/" +
107 filter :css_clean_selectors, \
108 preserve_comments: true, \
110 write @item.identifier.without_ext + '.css'
114 filter :copybin if @item.binary?
115 write @item.identifier.to_s
118 layout '/**/*.xsl', :xsl