# Generates the documentation in HTML format.
#--
# Copyright 2006 Suraj N. Kurapati
# See the file named LICENSE for details.
require 'rake/clean'
$: << File.join(File.dirname(__FILE__), '..', 'lib')
require 'ruby-vpi'
include RubyVpi::Config
HISTORY_URL = WEBSITE_URL + "/history.html"
RSS_URL = WEBSITE_URL + '/rss.xml'
RSS_INFO = "RSS feed for this project."
require 'ruby-vpi/erb'
$: << File.join(File.dirname(__FILE__), 'lib')
require 'doc_proxy'
FileList['*.doc'].each do |src|
prefix = File.basename(src, File.extname(src))
helper = prefix + '.rb'
dst = prefix + '.html'
deps = FileList[prefix + '*'].exclude(src, dst)
desc "Process file #{src.inspect}."
file dst => [src, 'common.tpl', *deps] do |t|
String.reset_anchors
content = DocProxy.new.instance_eval do
# default output configuration
insert_toc = true
page_title = nil
# load the documentation's helper
if File.exist? helper
instance_eval File.read(helper)
end
# evaluate the documentation file
template = ERB.new(File.read(src))
content = template.result(binding)
toc, content = post_process(content)
# fit result into common HTML format
template = ERB.new(File.read(t.prerequisites[1]))
template.result(binding)
end
File.open(dst, 'w') do |f|
f << content
puts f.path
end
end
task :default => dst
CLOBBER.include dst
end
desc "Generate RSS feed."
file 'rss.xml' => FileList['rss.erb', 'history*'] do |t|
template = ERB.new(File.read(t.prerequisites[0]))
content = template.result
File.open(t.name, 'w') do |f|
f << content
puts f.path
end
end
task :default => 'rss.xml'
CLOBBER.include 'rss.xml'