Sha256: 2502cadbe38d79aef83b1dd85b0a53d712b2be05a93c1e9f7a2258041f515ccc
Contents?: true
Size: 889 Bytes
Versions: 1
Compression:
Stored size: 889 Bytes
Contents
require 'brite/model' module Brite # Layout class class Layout < Model # def initialize(site, file) @site = site @file = file @name = file.chomp('.layout') @path = File.expand_path(file) end # attr :site # attr :file # attr :name # attr :path # TODO: merge layout header ? # Render layout. def render(model, &content) template = Neapolitan.file(path, :stencil=>site.config.stencil) # update the model's metadata #model.update(template.metadata) result = template.render(model, &content).to_s layout_name = template.metadata['layout'] if layout_name layout = site.lookup_layout(layout_name) raise "No such layout -- #{layout}" unless layout result = layout.render(model){ result } end result.to_s end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
brite-0.7.0 | lib/brite/layout.rb |