Fix partials with locals

This commit is contained in:
Ben Hollis 2011-11-27 21:56:21 -08:00
parent d12b3a95d2
commit 7a4d8c7533
4 changed files with 11 additions and 2 deletions

View file

@ -27,4 +27,9 @@ Feature: Provide Sane Defaults for Partial Behavior
Scenario: Finds partial relative to template
Given the Server is running at "partials-app"
When I go to "/sub/index.html"
Then I should see "Local Partial"
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