class Qwik::TemplateGenerator
Public Class Methods
generate_all(path)
click to toggle source
# File vendor/qwik/lib/qwik/template-generator.rb, line 24 def self.generate_all(path) Pathname.glob(path+'*.html') {|file| basename = file.basename('.html').to_s make(path, basename) } end
generate_template(html)
click to toggle source
# File vendor/qwik/lib/qwik/template-generator.rb, line 62 def self.generate_template(html) html = html.map {|line| line.strip }.join return HTree(html).to_wabisabi end
main(args)
click to toggle source
# File vendor/qwik/lib/qwik/template-generator.rb, line 14 def self.main(args) =begin config = Config.new Config.load_args_and_config(config, $0, args) path = config.template_dir.path generate_all(path) =end generate_all(".") end
make(path, basename)
click to toggle source
# File vendor/qwik/lib/qwik/template-generator.rb, line 31 def self.make(path, basename) outfile = path+"#{basename}.rb" file = path+"#{basename}.html" in_mtime = file.mtime out_mtime = outfile.exist? ? outfile.mtime : Time.at(0) return unless out_mtime < in_mtime puts "generate #{basename}" unless $test html = file.read w = generate_template(html) src = '' PP.pp(w, src) # inspect with pretty print. str = "# This file is automatically generated. # DO NOT EDIT THIS FILE. module Qwik class Template def self.generate_#{basename} return #{src} end end end " outfile.put(str) end