class RoadForest::TypeHandlers::RDFaWriter::TemplateHandler

Attributes

haml_options[RW]
resource_name[RW]
style_name[W]
template_cache[W]
valise[RW]

Public Instance Methods

find_template(kinds) click to toggle source
# File lib/roadforest/type-handlers/rdfa-writer/render-engine.rb, line 37
def find_template(kinds)
  kind = kinds.shift
  templates.contents(kind)
rescue Valise::Errors::NotFound
  if kinds.empty?
    raise
  else
    retry
  end
end
style_name() click to toggle source
# File lib/roadforest/type-handlers/rdfa-writer/render-engine.rb, line 20
def style_name
  @style_name ||= "base"
end
template_cache() click to toggle source
# File lib/roadforest/type-handlers/rdfa-writer/render-engine.rb, line 16
def template_cache
  @template_cache ||= ::Tilt::Cache.new
end
templates() click to toggle source
# File lib/roadforest/type-handlers/rdfa-writer/render-engine.rb, line 24
def templates
  @templates ||= [resource_name, style_name, nil].uniq.map do |name|
    valise.sub_set(["templates", name].compact.join("/"))
  end.inject do |left, right|
    left + right
  end.handle_templates do |config|
    #At some point, should look into using HTML entities to preserve
    #whitespace in XMLLiterals
    options = {:format => :xhtml}.merge(haml_options || {:ugly => true})
    config.add_type("haml", { :template_cache => template_cache, :template_options => options })
  end
end