summaryrefslogtreecommitdiff
path: root/bin/sitegen
blob: 8356694ca52f0200836e22189413db04e3301586 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env ruby
$:.unshift('lib')

require 'set'

require 'page_index'
require 'page_local'
require 'page_tag'
require 'sitegen'

# Initialize the site generator
Sitegen::init

# Load all pages
def crawl(page)
	page.index_pages.select{|p|p.is_a?(IndexPage)}.each{|p|crawl(p)}
end
crawl(IndexPage::new('src'))

# Tag pages
tags = Set[]
Sitegen::pages.each do |page|
	tags.merge(page.atom_categories.map{|c|c.abbr})
end
tags = tags.each do |tag|
	TagPage::new(tag)
end
TagIndexPage::new()

# Tell the sitegen which files we want
Sitegen.pages.select{|p|p.is_a?(LocalPage)}.each do |page|
	Sitegen::want(page.local_outfile)
end
Sitegen::want('out/index.atom')

# Make!
Sitegen::make(:all)