Revision 1284,
565 bytes
checked in by daisuke, 14 years ago
(diff) |
Initial import
|
Rev | Line | |
---|
[1284] | 1 | #!/usr/bin/ruby |
---|
| 2 | require 'erb' |
---|
| 3 | |
---|
| 4 | contentsdir = 'contents.d/' |
---|
| 5 | tmpdir = 'template/' |
---|
| 6 | |
---|
| 7 | class Layout |
---|
| 8 | extend ERB::DefMethod |
---|
| 9 | def_erb_method('layout', 'template/layout.html.erb') |
---|
| 10 | def_erb_method('layout_top', 'template/layout-top.html.erb') |
---|
| 11 | end |
---|
| 12 | |
---|
| 13 | Dir.foreach(contentsdir).grep(/.html$/) do |filename| |
---|
| 14 | template = ERB.new(IO.read(contentsdir+filename),nil,'<>') |
---|
| 15 | newfile = open(filename, "w") |
---|
| 16 | if filename == "index.html" |
---|
| 17 | newfile.puts Layout.new.layout_top { template.result } |
---|
| 18 | else |
---|
| 19 | newfile.puts Layout.new.layout { template.result } |
---|
| 20 | end |
---|
| 21 | newfile.close |
---|
| 22 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.