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:
parent
0898ff6d42
commit
2ed409b5e1
6 changed files with 26 additions and 3 deletions
9
features/chained_templates.feature
Normal file
9
features/chained_templates.feature
Normal 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>"
|
0
fixtures/chained-app/config.rb
Normal file
0
fixtures/chained-app/config.rb
Normal file
2
fixtures/chained-app/data/article.yml
Normal file
2
fixtures/chained-app/data/article.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
title: "Title"
|
||||
subtitle: "Subtitle"
|
8
fixtures/chained-app/source/index.html.markdown.erb
Executable file
8
fixtures/chained-app/source/index.html.markdown.erb
Executable file
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
layout: false
|
||||
sup: "Sup"
|
||||
---
|
||||
|
||||
# <%= data.article.title %>
|
||||
## <%= data.article.subtitle %>
|
||||
### <%= data.page.sup %>
|
|
@ -41,7 +41,11 @@ module Middleman::CoreExtensions::Rendering
|
|||
@current_engine, engine_was = engine, @current_engine
|
||||
@_out_buf, _buf_was = "", @_out_buf
|
||||
|
||||
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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue