Merge pull request #3732 from jekyll/fix-frontmatter-defaults
Fix it so that 'blog.html' matches 'blog.html'
This commit is contained in:
commit
e9215ec047
|
@ -173,7 +173,7 @@ module Jekyll
|
|||
if path.nil? || path.empty?
|
||||
""
|
||||
else
|
||||
path.gsub(/\A\//, '').gsub(/([^\/])\z/, '\1/')
|
||||
path.gsub(/\A\//, '').gsub(/([^\/])\z/, '\1')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -28,6 +28,32 @@ class TestFrontMatterDefaults < JekyllUnitTest
|
|||
end
|
||||
end
|
||||
|
||||
context "A site with fron matter type pages and an extension" do
|
||||
setup do
|
||||
@site = Site.new(Jekyll.configuration({
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
"defaults" => [{
|
||||
"scope" => {
|
||||
"path" => "index.html"
|
||||
},
|
||||
"values" => {
|
||||
"key" => "val"
|
||||
}
|
||||
}]
|
||||
}))
|
||||
|
||||
@site.process
|
||||
@affected = @site.pages.find { |page| page.relative_path == "index.html" }
|
||||
@not_affected = @site.pages.find { |page| page.relative_path == "about.html" }
|
||||
end
|
||||
|
||||
should "affect only the specified path" do
|
||||
assert_equal @affected.data["key"], "val"
|
||||
assert_equal @not_affected.data["key"], nil
|
||||
end
|
||||
end
|
||||
|
||||
context "A site with front matter defaults with no type" do
|
||||
setup do
|
||||
@site = Site.new(Jekyll.configuration({
|
||||
|
|
Loading…
Reference in New Issue