Fix Page#relative_path so that it consistently does NOT have the prepending slash (previously inconsistent)

Fixes for #4946
This commit is contained in:
Parker Moore 2016-05-25 17:57:09 -07:00
parent de39107c76
commit 4fbbeddae2
No known key found for this signature in database
GPG Key ID: 193CDEBA72063C58
2 changed files with 3 additions and 3 deletions

View File

@ -135,12 +135,12 @@ module Jekyll
#
# Returns the path to the source file
def path
data.fetch("path") { relative_path.sub(%r{!\A\/!}, "") }
data.fetch("path") { relative_path }
end
# The path to the page source file, relative to the site source
def relative_path
File.join(*[@dir, @name].map(&:to_s).reject(&:empty?))
File.join(*[@dir, @name].map(&:to_s).reject(&:empty?)).sub(%r{\A\/}, "")
end
# Obtain destination path.

View File

@ -17,7 +17,7 @@ class TestFrontMatterDefaults < JekyllUnitTest
}]
}))
@site.process
@affected = @site.pages.find { |page| page.relative_path == "/contacts/bar.html" }
@affected = @site.pages.find { |page| page.relative_path == "contacts/bar.html" }
@not_affected = @site.pages.find { |page| page.relative_path == "about.html" }
end