diff --git a/CHANGELOG.md b/CHANGELOG.md index 124421f3..ac1e3077 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ master === +* Removed `with_layout`. Use loops of `page` instead. * Removed Queryable Sitemap API * Removed `css_compressor` setting, use `activate :minify_css, :compressor =>` instead. * Removed `js_compressor` setting, use `activate :minify_javascript, :compressor =>` instead. diff --git a/middleman-core/features/custom_layouts.feature b/middleman-core/features/custom_layouts.feature index 32feaa99..09c7faa1 100644 --- a/middleman-core/features/custom_layouts.feature +++ b/middleman-core/features/custom_layouts.feature @@ -7,18 +7,6 @@ Feature: Custom layouts When I go to "/custom-layout.html" Then I should see "Custom Layout" - Scenario: Using with_layout block - Given "/custom-layout.html" with_layout block has layout "custom" - And the Server is running at "custom-layout-app2" - When I go to "/custom-layout.html" - Then I should see "Custom Layout" - - Scenario: Using with_layout block with globs - Given "/custom-*" with_layout block has layout "custom" - And the Server is running at "custom-layout-app2" - When I go to "/custom-layout.html" - Then I should see "Custom Layout" - Scenario: Using custom :layout attribute with folders Given page "/custom-layout-dir/" has layout "custom" And the Server is running at "custom-layout-app2" diff --git a/middleman-core/features/step_definitions/page_layout_steps.rb b/middleman-core/features/step_definitions/page_layout_steps.rb index 9456d4cf..311b4d4d 100644 --- a/middleman-core/features/step_definitions/page_layout_steps.rb +++ b/middleman-core/features/step_definitions/page_layout_steps.rb @@ -4,12 +4,3 @@ Given /^page "([^\"]*)" has layout "([^\"]*)"$/ do |url, layout| page(url, :layout => layout.to_sym) } end - -Given /^"([^\"]*)" with_layout block has layout "([^\"]*)"$/ do |url, layout| - @initialize_commands ||= [] - @initialize_commands << lambda { - with_layout(layout.to_sym) do - page(url) - end - } -end diff --git a/middleman-core/fixtures/auto-css-app/config.rb b/middleman-core/fixtures/auto-css-app/config.rb index 10ff8ae6..154cfd92 100644 --- a/middleman-core/fixtures/auto-css-app/config.rb +++ b/middleman-core/fixtures/auto-css-app/config.rb @@ -1,11 +1,9 @@ -with_layout false do - %w{ - /auto-css.html - /auto-css - /auto-css/ - /auto-css/auto-css.html - /auto-css/sub/auto-css.html - }.each do |path| - page path - end +%w{ + /auto-css.html + /auto-css + /auto-css/ + /auto-css/auto-css.html + /auto-css/sub/auto-css.html +}.each do |path| + page path, layout: false end diff --git a/middleman-core/fixtures/auto-js-app/config.rb b/middleman-core/fixtures/auto-js-app/config.rb index 31d649c2..cf40d463 100644 --- a/middleman-core/fixtures/auto-js-app/config.rb +++ b/middleman-core/fixtures/auto-js-app/config.rb @@ -1,11 +1,9 @@ -with_layout false do - %w{ - /auto-js.html - /auto-js - /auto-js/ - /auto-js/auto-js.html - /auto-js/sub/auto-js.html - }.each do |path| - page path - end +%w{ + /auto-js.html + /auto-js + /auto-js/ + /auto-js/auto-js.html + /auto-js/sub/auto-js.html +}.each do |path| + page path, layout: false end diff --git a/middleman-core/fixtures/basic-data-app/config.rb b/middleman-core/fixtures/basic-data-app/config.rb index 8d9a6629..7a6d8ba1 100644 --- a/middleman-core/fixtures/basic-data-app/config.rb +++ b/middleman-core/fixtures/basic-data-app/config.rb @@ -1,4 +1,2 @@ -with_layout false do - page "/data.html" - page "/data3.html" -end +page "/data.html", layout: false +page "/data3.html", layout: false diff --git a/middleman-core/fixtures/capture-html-app/config.rb b/middleman-core/fixtures/capture-html-app/config.rb index c0621cbe..da6dc3ae 100644 --- a/middleman-core/fixtures/capture-html-app/config.rb +++ b/middleman-core/fixtures/capture-html-app/config.rb @@ -1,7 +1,5 @@ require "slim" -with_layout :capture_html do - page "/capture_html_erb.html" - page "/capture_html_haml.html" - page "/capture_html_slim.html" -end +page "/capture_html_erb.html", layout: :capture_html +page "/capture_html_haml.html", layout: :capture_html +page "/capture_html_slim.html", layout: :capture_html diff --git a/middleman-core/fixtures/content-for-app/config.rb b/middleman-core/fixtures/content-for-app/config.rb index 229347fb..1e5daaae 100644 --- a/middleman-core/fixtures/content-for-app/config.rb +++ b/middleman-core/fixtures/content-for-app/config.rb @@ -1,7 +1,5 @@ require "slim" -with_layout :content_for do - page "/content_for_erb.html" - page "/content_for_haml.html" - page "/content_for_slim.html" -end +page "/content_for_erb.html", layout: :content_for +page "/content_for_haml.html", layout: :content_for +page "/content_for_slim.html", layout: :content_for diff --git a/middleman-core/fixtures/generator-test/config.rb b/middleman-core/fixtures/generator-test/config.rb index 74ab3a21..e753409f 100644 --- a/middleman-core/fixtures/generator-test/config.rb +++ b/middleman-core/fixtures/generator-test/config.rb @@ -22,11 +22,6 @@ # # With alternative layout # page "/path/to/file.html", :layout => :otherlayout -# -# A path which all have the same layout -# with_layout :admin do -# page "/admin/*" -# end # Proxy (fake) files # page "/this-page-has-no-template.html", :proxy => "/template-file.html" do diff --git a/middleman-core/fixtures/large-build-app/config.rb b/middleman-core/fixtures/large-build-app/config.rb index 77df0b3c..ae596127 100644 --- a/middleman-core/fixtures/large-build-app/config.rb +++ b/middleman-core/fixtures/large-build-app/config.rb @@ -1,3 +1 @@ -with_layout false do - page "/spaces in file.html" -end +page "/spaces in file.html", layout: false diff --git a/middleman-core/fixtures/page-classes-app/config.rb b/middleman-core/fixtures/page-classes-app/config.rb index 05be0d07..ac693f9b 100644 --- a/middleman-core/fixtures/page-classes-app/config.rb +++ b/middleman-core/fixtures/page-classes-app/config.rb @@ -1,4 +1,2 @@ -with_layout false do - page "/sub1/page-classes.html" - page "/sub1/sub2/page-classes.html" -end +page "/sub1/page-classes.html", layout: false +page "/sub1/sub2/page-classes.html", layout: false diff --git a/middleman-core/lib/middleman-core/config_context.rb b/middleman-core/lib/middleman-core/config_context.rb index 248184f9..3d46b88b 100644 --- a/middleman-core/lib/middleman-core/config_context.rb +++ b/middleman-core/lib/middleman-core/config_context.rb @@ -1,6 +1,6 @@ module Middleman class ConfigContext - # with_layout and page routing + # page routing include Middleman::CoreExtensions::Routing attr_reader :app diff --git a/middleman-core/lib/middleman-core/core_extensions/routing.rb b/middleman-core/lib/middleman-core/core_extensions/routing.rb index 633ecc57..9d695d6a 100644 --- a/middleman-core/lib/middleman-core/core_extensions/routing.rb +++ b/middleman-core/lib/middleman-core/core_extensions/routing.rb @@ -2,36 +2,6 @@ module Middleman module CoreExtensions module Routing - # Sandboxed layout to implement temporary overriding of layout. - class LayoutBlock - attr_reader :scope - - def initialize(scope, layout_name) - @scope = scope - @layout_name = layout_name - end - - def page(url, opts={}) - opts[:layout] ||= @layout_name - @scope.page(url, opts) - end - - delegate :proxy, to: :scope - end - - # Takes a block which allows many pages to have the same layout - # - # with_layout :admin do - # page "/admin/" - # page "/admin/login.html" - # end - # - # @param [String, Symbol] layout_name - # @return [void] - def with_layout(layout_name, &block) - LayoutBlock.new(self, layout_name).instance_eval(&block) - end - # The page method allows the layout to be set on a specific path # # page "/about.html", :layout => false diff --git a/middleman-templates/lib/middleman-templates/shared/config.tt b/middleman-templates/lib/middleman-templates/shared/config.tt index f6d586a1..27673596 100755 --- a/middleman-templates/lib/middleman-templates/shared/config.tt +++ b/middleman-templates/lib/middleman-templates/shared/config.tt @@ -20,11 +20,6 @@ page '/*.txt', layout: false # # With alternative layout # page "/path/to/file.html", :layout => :otherlayout -# -# A path which all have the same layout -# with_layout :admin do -# page "/admin/*" -# end # Proxy pages (http://middlemanapp.com/basics/dynamic-pages/) # proxy "/this-page-has-no-template.html", "/template-file.html", :locals => {