Sha256: 211e1d09870d182f2eab485f36e09a9bb99531985b87349833b4f273f19bd537
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 KB
Contents
$:.unshift File.dirname(__FILE__) module BuildMaster class FileProcessor def initialize(template, content_path, evaluator) @template = template @content_path = content_path @evaluator = evaluator end def process_textile() textile_content = IO.read(@content_path) match_result = TEXTILE_REGX.match(textile_content) title = '' if match_result != nil title = match_result[2] textile_content = match_result.post_match end html_body = RedCloth.new(textile_content).to_html html_content = <<HTML <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>#{title}</title> </head> <body> #{html_body} </body> </html> HTML return process_html_content(html_content) end def process_html() return process_html_content(File.open(@content_path)) end def process_html_content(source) document_with_skin = @template.process(source) {|message| @evaluator.evaluate(message, @content_path)} return document_with_skin end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
BuildMaster-0.7.0 | lib/buildmaster/file_processor.rb |