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

@ -1,3 +1,5 @@
= Version 0.0.1
= Version 0.2
= Version 0.1
* Items
* Generators

View file

@ -1,3 +1,13 @@
h1. About
Ace is a static page generator like "Nanoc":http://nanoc.stoneship.org, "Jekyll":https://github.com/mojombo/jekyll or "Webby":http://webby.rubyforge.org/tutorial. How is it different? Well, it's better :) ! I really like Nanoc and I used it for quite a while, but it's not flexible enough. If you need to generate a lot of pages on the fly, it's a hassle. It provides helpers, but helpers are let's face it programming style we used to use years back when we yet believed that PHP is actually a really nice language.
Ace chose an OOP approach
Another common proble of these generators is, that they are way too opinionated. Thanks Webby, but I don't give a damn about your Sitemap, thank you very much!
Also, last but not least, Ace has a real template inheritance. Layouts are for kids, real men use template inheritance! What's the advantage? It's incredibly flexible. You can have
h1. Why you should be interested in ace?
In Ace, every page is an instance
@ -7,11 +17,11 @@ There are also *generators* available for easier generating items on the fly.
Ace has *template inheritance*. I love template inheritance, it's more flexible pattern than layouts.
Tasks for deployment included.
Tasks for deployment are included.
h1. The boot process
# load @boot.rb@ where the
# Load @boot.rb@ where the
# load the rules (controllers / globs mapping)
# load & instantiate the items: only the renderables (concrete post)
# run the filters, layoutin' ... actually this can be defined in the controller

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