class Jekyll::FridgePage
Public Class Methods
new(site, base, dir, content, config)
click to toggle source
# File lib/jekyll-fridge/fridge_page.rb, line 3 def initialize(site, base, dir, content, config) @site = site @base = base @dir = dir @name = "index.html" self.process(@name) if content.attrs.has_key?(:template) self.read_yaml_from_string(content.template) else self.read_yaml(File.join(base, '_layouts'), config['layout']) end self.data[config['type']] = Jekyll::Fridge::Model.new(content) self.data['title'] = content.title end
Public Instance Methods
read_yaml_from_string(str)
click to toggle source
# File lib/jekyll-fridge/fridge_page.rb, line 20 def read_yaml_from_string(str) begin self.content = str if content =~ /\A(---\s*\n.*?\n?)^((---|\.\.\.)\s*$\n?)/m self.content = $POSTMATCH self.data = SafeYAML.load($1) end rescue SyntaxError => e Jekyll.logger.warn "YAML Exception reading custom layout: #{e.message}" end self.data ||= {} end