summaryrefslogtreecommitdiff
path: root/bin/index
diff options
context:
space:
mode:
Diffstat (limited to 'bin/index')
-rwxr-xr-xbin/index61
1 files changed, 0 insertions, 61 deletions
diff --git a/bin/index b/bin/index
deleted file mode 100755
index c3ac2ff..0000000
--- a/bin/index
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/usr/bin/env ruby
-# -*- coding: utf-8 -*-
-require 'util'
-require 'yaml'
-
-# ARGV[0]
-type = ARGV.shift
-template = "bin/index.#{type}.erb"
-erb = ERB.new(File.read(template));
-erb.filename = template
-
-# ARGV[1]
-@path = ARGV.shift
-webpath = (@path+'/').sub(/^(src|out)\//, '/')
-if type == 'atom'
- webpath += 'index.atom'
-end
-@url = URI::parse('https://www.andrewdm.me/') + webpath
-
-indexyaml = @path.sub('out', 'src')+'/index.yaml'
-if File.exists?(indexyaml)
- metadata = YAML::load(File.read(indexyaml))
-else
- metadata = {}
-end
-
-@pages = []
-for data in metadata['external']
- @pages.push(ExternPage.new(data))
-end
-
-# ARGV[2..]
-for filename in ARGV do
- @pages.push(Page.new(filename))
-end
-
-# main
-@title = metadata['title'] || @path.sub('out', '')
-
-def guess_section(page)
- for path in @sections.keys do
- if @url.route_to(page.url).to_s.start_with?(path+'/')
- return path
- end
- end
- return ''
-end
-
-@sections = { '' => {'head' => '', 'body' => []} }
-(metadata['sections'] || []).each do |path, name|
- @sections[path] = {
- 'head' => name,
- 'body' => []
- }
-end
-for page in @pages do
- section = page.section || guess_section(page)
- @sections[section]['body'].push(page)
-end
-
-erb.run()