1
0
Fork 0
mirror of https://github.com/middleman/middleman.git synced 2022-11-09 12:20:27 -05:00

make sure chained templates work with data

This commit is contained in:
Thomas Reynolds 2011-11-29 11:49:42 -08:00
parent 0898ff6d42
commit 2ed409b5e1
6 changed files with 26 additions and 3 deletions

View file

@ -0,0 +1,9 @@
Feature: Templates should be chainable
In order to insert variables and data in "static" engines
Scenario: Data in Erb in Markdown
Given the Server is running at "chained-app"
When I go to "/index.html"
Then I should see "Title</h1>"
And I should see "Subtitle</h2>"
And I should see "Sup</h3>"

View file

View file

@ -0,0 +1,2 @@
title: "Title"
subtitle: "Subtitle"

View file

@ -0,0 +1,8 @@
---
layout: false
sup: "Sup"
---
# <%= data.article.title %>
## <%= data.article.subtitle %>
### <%= data.page.sup %>

View file

@ -41,7 +41,11 @@ module Middleman::CoreExtensions::Rendering
@current_engine, engine_was = engine, @current_engine
@_out_buf, _buf_was = "", @_out_buf
content = render_individual_file(path, locs, opts)
while ::Tilt[path]
content = render_individual_file(path, locs, opts)
path = File.basename(path, File.extname(path))
cache.set([:raw_template, path], content)
end
needs_layout = !%w(.js .css .txt).include?(extension)

View file

@ -34,7 +34,7 @@ Gem::Specification.new do |s|
s.add_dependency("coffee-script", ["~> 2.2.0"])
s.add_dependency("execjs", ["~> 1.2.7"])
s.add_dependency("sprockets", ["~> 2.1.2"])
s.add_dependency("sprockets-sass", ["~> 0.3.0"])
s.add_dependency("sprockets-sass", ["~> 0.5.0"])
s.add_dependency("guard", ["~> 0.8.8"])
# OSX