diff --git a/features/partials.feature b/features/partials.feature index 3473a784..af9a2a27 100644 --- a/features/partials.feature +++ b/features/partials.feature @@ -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" \ No newline at end of file + 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" \ No newline at end of file diff --git a/fixtures/partials-app/source/_locals.erb b/fixtures/partials-app/source/_locals.erb new file mode 100644 index 00000000..e28c4e8d --- /dev/null +++ b/fixtures/partials-app/source/_locals.erb @@ -0,0 +1 @@ +Local var is <%= foo %> \ No newline at end of file diff --git a/fixtures/partials-app/source/locals.html.erb b/fixtures/partials-app/source/locals.html.erb new file mode 100644 index 00000000..23f7e2a4 --- /dev/null +++ b/fixtures/partials-app/source/locals.html.erb @@ -0,0 +1 @@ +<%= partial 'locals', :locals => { :foo => 'bar' } %> diff --git a/lib/middleman/core_extensions/rendering.rb b/lib/middleman/core_extensions/rendering.rb index 3970442e..ec07ddf8 100644 --- a/lib/middleman/core_extensions/rendering.rb +++ b/lib/middleman/core_extensions/rendering.rb @@ -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