Smaller changes.

This commit is contained in:
Jakub Šťastný aka Botanicus 2011-02-23 04:51:06 +00:00
parent 95a2bcf5f6
commit eb1715ae54
5 changed files with 30 additions and 15 deletions

View file

@ -11,6 +11,10 @@ require "yaml"
require "fileutils"
module Ace
module Helpers
# include your helpers here
end
class RawItem
attr_accessor :path, :metadata, :content
def initialize(path)
@ -19,11 +23,11 @@ module Ace
def parse
pieces = @data.split(/^-{3,5}\s*$/)
if pieces.size < 3
raise RuntimeError.new(
"The file '#{content_filename}' appears to start with a metadata section (three or five dashes at the top) but it does not seem to be in the correct format."
)
end
# if pieces.size < 3
# raise RuntimeError.new(
# "The file '#{path}' appears to start with a metadata section (three or five dashes at the top) but it does not seem to be in the correct format."
# )
# end
# Parse
self.metadata = YAML.load(pieces[1]).inject(Hash.new) { |metadata, pair| metadata.merge(pair[0].to_sym => pair[1]) } || Hash.new
@ -132,9 +136,4 @@ module Ace
class Asset < Item
end
module Helpers
def link_to(anchor, path_or_item, options = nil)
end
end
end

View file

@ -10,12 +10,16 @@ end
module Ace
class LayoutFilter < Filter
class Scope
include Ace::Helpers
end
def initialize(options)
@path = options[:layout]
end
def call(item, content)
template = TemplateInheritance::Template.new(@path)
template = TemplateInheritance::Template.new(@path, Scope.new)
return template.render(item: item)
end
end

View file

@ -1,5 +1,5 @@
# encoding: utf-8
module Ace
VERSION = "0.1"
VERSION = "0.2"
end