diff --git a/middleman-core/features/directory_index.feature b/middleman-core/features/directory_index.feature index f8c87a21..ddbd703f 100644 --- a/middleman-core/features/directory_index.feature +++ b/middleman-core/features/directory_index.feature @@ -9,6 +9,7 @@ Feature: Directory Index | a_folder/needs_index/index.html | | leave_me_alone.html | | wildcard_leave_me_alone.html | + | regex_leave_me_alone2.html | | evil spaces/index.html | | regular/index.html | | .htaccess | @@ -21,12 +22,13 @@ Feature: Directory Index | a_folder/needs_index.html | | leave_me_alone/index.html | | wildcard_leave_me_alone/index.html | + | regex_leave_me_alone2/index.html | And the file "needs_index/index.html" should contain "Indexable" And the file "a_folder/needs_index/index.html" should contain "Indexable" And the file "leave_me_alone.html" should contain "Stay away" And the file "regular/index.html" should contain "Regular" And the file "evil spaces/index.html" should contain "Filled with Evil Spaces" - + Scenario: Preview normal file Given the Server is running at "indexable-app" When I go to "/needs_index/" diff --git a/middleman-core/fixtures/indexable-app/config.rb b/middleman-core/fixtures/indexable-app/config.rb index fdccfcbb..17c25ecf 100644 --- a/middleman-core/fixtures/indexable-app/config.rb +++ b/middleman-core/fixtures/indexable-app/config.rb @@ -2,3 +2,4 @@ activate :directory_indexes page "/leave_me_alone.html", directory_index: false page "/wildcard*", directory_index: false +page /regex_.*/, directory_index: false diff --git a/middleman-core/fixtures/indexable-app/source/regex_leave_me_alone2.html b/middleman-core/fixtures/indexable-app/source/regex_leave_me_alone2.html new file mode 100644 index 00000000..5ff5317a --- /dev/null +++ b/middleman-core/fixtures/indexable-app/source/regex_leave_me_alone2.html @@ -0,0 +1 @@ +Stay away, wildcards! diff --git a/middleman-core/lib/middleman-core/core_extensions/routing.rb b/middleman-core/lib/middleman-core/core_extensions/routing.rb index db773d29..dcbea0ec 100644 --- a/middleman-core/lib/middleman-core/core_extensions/routing.rb +++ b/middleman-core/lib/middleman-core/core_extensions/routing.rb @@ -44,7 +44,7 @@ module Middleman # @option opts [Hash] locals Local variables for the template. These will be available when the template renders. # @option opts [Hash] data Extra metadata to add to the page. This is the same as frontmatter, though frontmatter will take precedence over metadata defined here. Available via {Resource#data}. # @return [void] - Contract String, Hash => Any + Contract Or[String, Regexp], Hash => Any def page(path, opts={}) options = opts.dup