fix template read cache

This commit is contained in:
Thomas Reynolds 2011-11-18 21:46:26 -08:00
parent 9eccf59aec
commit 47eb29bcfe
6 changed files with 24 additions and 6 deletions

View file

@ -0,0 +1,10 @@
Feature: Custom Layout Engine
Scenario: Checking built folder for content
Given a built app at "custom-layout-app"
Then "index.html" should exist at "custom-layout-app" and include "Comment in layout"
Scenario: Checking server for content
Given the Server is running at "test-app"
When I go to "/index.html"
Then I should see "Comment in layout"

View file

@ -0,0 +1 @@
set :erb, :layout_engine => :haml

View file

@ -0,0 +1 @@
<h1>Welcome</h1>

View file

@ -0,0 +1,6 @@
%html
%head
%title My Sample Site
/ Comment in layout
%body
= yield

View file

@ -316,11 +316,11 @@ public
end
def read_raw_template(path)
if !raw_templates_cache.has_key?(path)
raw_templates_cache[path] = File.read(path)
if raw_templates_cache.has_key?(path)
raw_templates_cache[path]
else
File.read(path)
end
raw_templates_cache[path]
end
def map(map, &block)

View file

@ -69,14 +69,14 @@ module Middleman::CoreExtensions::FrontMatter
file = File.expand_path(file, @app.root)
content = File.read(file)
file = file.sub(@app.source_dir, "")
# @app.logger.debug :frontmatter_update, Time.now, file if @app.logging?
result = parse_front_matter(content)
if result
file = file.sub(@app.source_dir, "")
@local_data[file] = result
path = @app.extensionless_path(file)
path = File.join(@app.source_dir, file)
@app.raw_templates_cache[path] = result[1]
end
end