summaryrefslogtreecommitdiff
path: root/bin/index
diff options
context:
space:
mode:
Diffstat (limited to 'bin/index')
-rwxr-xr-xbin/index19
1 files changed, 16 insertions, 3 deletions
diff --git a/bin/index b/bin/index
index 4f41c5d..2443380 100755
--- a/bin/index
+++ b/bin/index
@@ -1,16 +1,29 @@
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
load 'util.rb'
+require 'yaml'
+# ARGV[0]
template = "bin/index.#{ARGV.shift}.erb"
+erb = ERB.new(File.read(template));
+erb.filename = template
+
+# ARGV[1]
@path = ARGV.shift
+indexyaml = @path.sub('out', 'src')+'/index.yaml'
+if File.exists?(indexyaml)
+ metadata = YAML::load(File.read(indexyaml))
+else
+ metadata = {}
+end
+
+# ARGV[2..]
@pages = []
for filename in ARGV do
@pages.push(Page.new(filename))
end
-
-erb = ERB.new(File.read(template));
-erb.filename = template
+# main
+@title = metadata['title'] || @path.sub('out', '')
erb.run()