Sha256: ba5697cdb18b884f16947cbac3e63748f9db11285e7c767828cc635896b81e65
Contents?: true
Size: 955 Bytes
Versions: 51
Compression:
Stored size: 955 Bytes
Contents
module Dugway class Template attr_reader :name def initialize(name) @name = name end def content Dugway.theme.file_content(name) end def content_type Rack::Mime.mime_type(extension) end def extension File.extname(name) end def html? extension == '.html' end def standalone_html? html? && !!(content =~ /\{\{\s*head_content\s*\}\}/) end def render(request, variables={}) if html? liquifier = Liquifier.new(request) content_to_render = variables[:page] && variables[:page]['content'] || content rendered_content = liquifier.render(content_to_render, variables) if standalone_html? rendered_content else liquifier.render(Dugway.theme.layout, variables.update(:page_content => rendered_content)) end else content end end end end
Version data entries
51 entries across 51 versions & 1 rubygems