Sha256: 5c0f529a382796e7764fbebf75f72434f213b66bf446ff939ab843cf491b62cd
Contents?: true
Size: 858 Bytes
Versions: 3
Compression:
Stored size: 858 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) rendered_content = liquifier.render(content, 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dugway-0.5.2 | lib/dugway/template.rb |
dugway-0.5.1 | lib/dugway/template.rb |
dugway-0.5.0 | lib/dugway/template.rb |