class Staticpress::ViewHelpers
Attributes
meta[R]
page[R]
theme[R]
Public Class Methods
new(page)
click to toggle source
# File lib/staticpress/view_helpers.rb, line 7 def initialize(page) @page = page @meta, @theme = page.meta, page.theme Staticpress::Plugin.activate_enabled class << self Staticpress::Plugins.constants.each do |plugin| include Staticpress::Plugins.const_get(plugin) end end end
Public Instance Methods
partial(name, locals = {})
click to toggle source
# File lib/staticpress/view_helpers.rb, line 18 def partial(name, locals = {}) template_name = theme.include_for name if template_name.file? template = Tilt[template_name].new { template_name.read } template.render self.class.new(page), locals end end
site_meta()
click to toggle source
TODO site_meta
should be an aggregate all metadata
# File lib/staticpress/view_helpers.rb, line 27 def site_meta end
tag(name, attributes = {}, &block)
click to toggle source
# File lib/staticpress/view_helpers.rb, line 30 def tag(name, attributes = {}, &block) attribute_string = attributes.map do |key, value| " #{key}=\"#{value}\"" end.join('') content = block_given? ? block.call : '' "<#{name}#{attribute_string}>#{content}</#{name}>" end