Merge pull request #1791 from jimothyGator/fix/1790-blocks-with-partials

fix partials used with blocks
This commit is contained in:
Thomas Reynolds 2016-02-04 08:53:09 -08:00
commit d7967a86bb
4 changed files with 15 additions and 1 deletions

View file

@ -50,3 +50,10 @@ Feature: Provide Sane Defaults for Partial Behavior
Then I should see "File Not Found" Then I should see "File Not Found"
When I go to "/_code_snippet.html" When I go to "/_code_snippet.html"
Then I should see "File Not Found" Then I should see "File Not Found"
Scenario: Works with blocks
Given the Server is running at "partials-app"
When I go to "/block.html"
Then I should see "Start"
And I should see "Contents"
And I should see "End"

View file

@ -0,0 +1,3 @@
Start
<%= yield %>
End

View file

@ -0,0 +1,3 @@
<% partial "block" do %>
Contents
<% end %>

View file

@ -96,8 +96,9 @@ module Middleman
# #
# @param [String, Symbol] name The partial to render. # @param [String, Symbol] name The partial to render.
# @param [Hash] options # @param [Hash] options
# @param [Proc] block A block will be evaluated to return internal contents.
# @return [String] # @return [String]
Contract Any, Or[Symbol, String], Hash => String Contract Any, Or[Symbol, String], Hash => String, Maybe[Proc] => String
def render(_, name, options={}, &block) def render(_, name, options={}, &block)
name = name.to_s name = name.to_s