]> git.draconx.ca Git - homepage.git/blobdiff - Rules
Generate slotifier project page from bundled README.md.
[homepage.git] / Rules
diff --git a/Rules b/Rules
index f3f1f0a197c6f67c3dec7d13a593beef126cf1da..6a8b45a61a19ab725e8dab26aacd784e54b2fd8e 100644 (file)
--- a/Rules
+++ b/Rules
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
 preprocess do
+    system("git", "submodule", "update", "--init")
+
     # Remove dead annex keys from processing
     @items.delete_if do |item|
-      l = File.readlink(item.raw_filename)
-      true if !File.exists?(item.raw_filename) and l =~ %r{/annex/objects/}
+        l = File.readlink(item.raw_filename)
+        true if !File.exists?(item.raw_filename) and l =~ %r{/annex/objects/}
     rescue Errno::EINVAL
     end
 
@@ -36,6 +38,17 @@ preprocess do
             item[:gitrev] = commit if item_source(item)
         end
     end
+
+    @items.find_all('/weblog/*.md').each do |item|
+        item[:kind] ||= 'article'
+    end
+
+    @items.each do |item|
+        item[:created_at] ||=
+            item[:published] || File.stat(item.raw_filename).mtime
+        item[:updated_at] ||=
+            item[:updated] || File.stat(item.raw_filename).mtime
+    end
 end
 
 postprocess do
@@ -138,8 +151,9 @@ compile '/license/cc*.xhtml' do
 end
 
 compile '/images/*.jpg', rep: :large do
-    filter :imgresize, width: 1200, height: 1200
-    write item.identifier.without_ext + '-t1200.' + item.identifier.ext
+    filename = item.identifier.without_ext + '-t1200.' + item.identifier.ext
+    filter :imgresize, width: 1200, height: 1200, cache: filename
+    write filename
 end
 
 compile '/images/*.jpg', rep: :info do
@@ -165,8 +179,8 @@ compile '/**/*.scss' do
 end
 
 compile '/**/*' do
-  filter :copybin if @item.binary?
-  write @item.identifier.to_s
+    filter :copybin if @item.binary?
+    write @item.identifier.to_s
 end
 
 layout '/**/*.xsl', :xsl