Merge pull request #170 from bhollis/partials

Fix partials with locals
This commit is contained in:
Thomas Reynolds 2011-11-27 22:07:49 -08:00
commit 223cf09c8f
4 changed files with 11 additions and 2 deletions

View file

@ -28,3 +28,8 @@ Feature: Provide Sane Defaults for Partial Behavior
Given the Server is running at "partials-app"
When I go to "/sub/index.html"
Then I should see "Local Partial"
Scenario: Partials can be passed locals
Given the Server is running at "partials-app"
When I go to "/locals.html"
Then I should see "Local var is bar"

View file

@ -0,0 +1 @@
Local var is <%= foo %>

View file

@ -0,0 +1 @@
<%= partial 'locals', :locals => { :foo => 'bar' } %>

View file

@ -57,9 +57,11 @@ module Middleman::CoreExtensions::Rendering
end
# Sinatra/Padrino render method signature.
def render(engine, data, options={}, locals={}, &block)
def render(engine, data, options={}, &block)
data = data.to_s
locals = options[:locals]
found_partial = false
engine = nil