def generate_html(source_file, source_dir = '')
full_file_path = File.join(@src_dir, 'pages', source_dir, "#{source_file}.haml")
begin
@scope.instance_variables.each do |var|
@scope.instance_variable_set(var, nil) unless var == ('@staticmatic' || :@staticmatic)
end
html = generate_html_from_template_source(File.read(full_file_path))
@layout = determine_layout(source_dir)
rescue StaticMatic::TemplateError => e
raise e
rescue Exception => e
raise StaticMatic::TemplateError.new(full_file_path, e)
end
html
end