lib/laydown.rb in laydown-0.6.1 vs lib/laydown.rb in laydown-0.6.2
- old
+ new
@@ -3,15 +3,13 @@
require 'temple/utils'
module Laydown
- RAW_TEMPLATE = File.read(File.join(
- File.dirname(__FILE__), 'template.rb'
- ))
+ require 'laydown/template'
- DEFAULT_TEMPLATE = {
+ DEFAULTS = {
:charset => 'utf-8',
:title => nil,
:description => nil,
:favicon => nil,
:keywords => [],
@@ -26,16 +24,16 @@
ARRAY_PROPS = [:keywords, :css, :js, :inline_js, :head, :body_class]
def self.compile(template={})
- template = DEFAULT_TEMPLATE.merge(template)
+ template = DEFAULTS.merge(template)
ARRAY_PROPS.each do |k|
template[k] = Array(template[k]).flatten.compact
end
- RAW_TEMPLATE.gsub(/data\[:([a-zA-Z0-9_]+)\]/) do |m|
+ TEMPLATE.gsub(/data\[:([a-zA-Z0-9_]+)\]/) do |m|
literalize template[:"#{$1}"]
end
end
def self.literalize(obj)