lib/orthor/site.rb in orthorings-0.3.1 vs lib/orthor/site.rb in orthorings-0.4.0
- old
+ new
@@ -2,26 +2,34 @@
class Site
class << self
include Orthor::Collections
include Orthor::HttpCaching
include Orthor::MetaData
-
+
dsl_accessor :layout
+ attr_accessor :current_template
- def define(&block)
+ def define(&blk)
@feeds, @categories, @pages, @static_pages, @queries = [], [], [], [], []
- layout(:orthor_layout)
+ layout(:orthor_layout)
cache_for 0
keywords ""
description ""
- class_eval &block
+ class_eval &blk
end
-
+
+ def with_template(name, &blk)
+ raise ArgumentError, "block required" unless block_given?
+ @current_template = name
+ class_eval &blk
+ @current_template = nil
+ end
+
def find_resource_by_path(path)
Orthor::Site.resources.detect { |r| r.path == path }
end
-
+
def find_resource_by_page_path(path, id)
Orthor::Site.resources.detect { |r| r.is_a?(Orthor::Category) && r.page_path.gsub(":id", id) == path }
end
end
end