fix layouts with implied extensions
This commit is contained in:
parent
3399ee207e
commit
37752dc291
|
@ -1,3 +1,8 @@
|
||||||
|
3.1.x
|
||||||
|
===
|
||||||
|
|
||||||
|
* Fix for implied extensions getting a layout. (Mentioned in #901)
|
||||||
|
|
||||||
3.1.2
|
3.1.2
|
||||||
===
|
===
|
||||||
|
|
||||||
|
|
|
@ -12,12 +12,16 @@ Feature: More default extensions
|
||||||
Then I should see "HELLO"
|
Then I should see "HELLO"
|
||||||
When I go to "/javascripts/app.js"
|
When I go to "/javascripts/app.js"
|
||||||
Then I should see "derp"
|
Then I should see "derp"
|
||||||
|
Then I should not see "I am in the layout"
|
||||||
When I go to "/stylesheets/style.css"
|
When I go to "/stylesheets/style.css"
|
||||||
Then I should see "section"
|
Then I should see "section"
|
||||||
|
Then I should not see "I am in the layout"
|
||||||
When I go to "/stylesheets/style2.css"
|
When I go to "/stylesheets/style2.css"
|
||||||
Then I should see "section"
|
Then I should see "section"
|
||||||
|
Then I should not see "I am in the layout"
|
||||||
When I go to "/stylesheets/style3.css"
|
When I go to "/stylesheets/style3.css"
|
||||||
Then I should see "color"
|
Then I should see "color"
|
||||||
|
Then I should not see "I am in the layout"
|
||||||
|
|
||||||
Scenario: Default extensions build
|
Scenario: Default extensions build
|
||||||
Given a fixture app "more-implied-extensions-app"
|
Given a fixture app "more-implied-extensions-app"
|
||||||
|
@ -37,6 +41,10 @@ Feature: More default extensions
|
||||||
And the file "test3.html" should contain "Howdy"
|
And the file "test3.html" should contain "Howdy"
|
||||||
And the file "test4.html" should contain "HELLO"
|
And the file "test4.html" should contain "HELLO"
|
||||||
And the file "javascripts/app.js" should contain "derp"
|
And the file "javascripts/app.js" should contain "derp"
|
||||||
|
And the file "javascripts/app.js" should not contain "I am in the layout"
|
||||||
And the file "stylesheets/style.css" should contain "section"
|
And the file "stylesheets/style.css" should contain "section"
|
||||||
|
And the file "stylesheets/style.css" should not contain "I am in the layout"
|
||||||
And the file "stylesheets/style2.css" should contain "section"
|
And the file "stylesheets/style2.css" should contain "section"
|
||||||
And the file "stylesheets/style3.css" should contain "color"
|
And the file "stylesheets/style2.css" should not contain "I am in the layout"
|
||||||
|
And the file "stylesheets/style3.css" should contain "color"
|
||||||
|
And the file "stylesheets/style3.css" should not contain "I am in the layout"
|
|
@ -0,0 +1,3 @@
|
||||||
|
I am in the layout
|
||||||
|
|
||||||
|
<%= yield %>
|
|
@ -154,11 +154,8 @@ module Middleman
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Certain output file types don't use layouts
|
|
||||||
needs_layout = !%w(.js .json .css .txt).include?(File.extname(path))
|
|
||||||
|
|
||||||
# If we need a layout and have a layout, use it
|
# If we need a layout and have a layout, use it
|
||||||
if needs_layout && layout_path = fetch_layout(engine, opts)
|
if layout_path = fetch_layout(engine, opts)
|
||||||
content = render_individual_file(layout_path, locs, opts, context) { content }
|
content = render_individual_file(layout_path, locs, opts, context) { content }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -141,6 +141,12 @@ module Middleman
|
||||||
blocks << block if block_given?
|
blocks << block if block_given?
|
||||||
|
|
||||||
app.current_path ||= self.destination_path
|
app.current_path ||= self.destination_path
|
||||||
|
|
||||||
|
# Certain output file types don't use layouts
|
||||||
|
if !opts.has_key?(:layout)
|
||||||
|
opts[:layout] = false if %w(.js .json .css .txt).include?(self.ext)
|
||||||
|
end
|
||||||
|
|
||||||
app.render_template(source_file, locs, opts, blocks)
|
app.render_template(source_file, locs, opts, blocks)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue