#!/usr/bin/env ruby preprocess do # Fetch a list of theme names from all items and construct items from them themas = @items.map { |i| i[:themas] }.flatten.uniq.compact themas.each do |thema| content = '' attributes = { naam: thema, verenigingen: @items.filter{|i| i[:themas] and i[:themas].include?(thema)}.flatten.uniq.compact } identifier = "/themas/#{thema}" @items.create(content, attributes, identifier) end end compile '/{verenigingen,projecten}/*.md' do filter :kramdown layout '/vereniging.*' layout '/default.*' write ext: 'html' end compile '/evenementen/*.md' do filter :kramdown layout '/evenement.*' layout '/default.*' write ext: 'html' end compile '/konventen/*.md' do filter :kramdown layout '/konvent.*' layout '/default.*' write ext: 'html' end compile '/themas/*' do layout '/thema.*' layout '/default.*' write ext: 'html' end compile '/homepage.md' do filter :kramdown layout '/homepage.*' layout '/default.*' write '/index.html' end compile '/faq/*' do filter :kramdown end compile '/faq.erb' do filter :erb layout '/default.*' write '/faq/index.html' end compile '/verenigingen.md' do filter :kramdown layout '/verenigingen.*' layout '/default.*' write ext: 'html' end compile '/*.md' do filter :kramdown layout '/default.*' write ext: 'html' end compile '/stylesheets/*.{sass,scss}' do syntax = @item.identifier.ext.to_sym filter :sass, syntax: syntax, style: :compact write ext: 'css' end compile '/*.erb' do filter :erb write item.identifier.without_ext + '/index.html' end layout '/**/*', :erb # Catch-all compile '/**/*' do write item.identifier.to_s end