class Sew::Context
Attributes
site[R]
Public Class Methods
new(site)
click to toggle source
# File lib/sew.rb, line 65 def initialize(site) if File.exist?(file = File.join(Dir.pwd, 'helper.rb')) require file extend Sew::Helper end @site = site end
Public Instance Methods
after_build()
click to toggle source
# File lib/sew.rb, line 94 def after_build end
mote(content)
click to toggle source
# File lib/sew.rb, line 81 def mote(content) Mote.parse(content, self, site.each_pair.map(&:first))[site] end
partial(template)
click to toggle source
# File lib/sew.rb, line 85 def partial(template) localized = sprintf("%s.%s.mote", template, site.page.locale) if File.exist?(localized) mote(File.read(localized)) else mote(File.read(sprintf("%s.mote", template))) end end
render(page)
click to toggle source
# File lib/sew.rb, line 74 def render(page) @site.page = page @site.content = mote(page.body) partial("_layout") end