Add support for `*.xhtml` files (#6854)

Merge pull request 6854
This commit is contained in:
ExE Boss 2018-08-25 13:07:28 +03:00 committed by jekyllbot
parent 130292f15e
commit 9195b61d51
4 changed files with 19 additions and 2 deletions

View File

@ -45,6 +45,8 @@ module Jekyll
index.htm index.htm
index.html index.html
index.rhtml index.rhtml
index.xht
index.xhtml
index.cgi index.cgi
index.xml index.xml
index.json index.json

View File

@ -140,7 +140,9 @@ module Jekyll
end end
def search_index_file(req, res) def search_index_file(req, res)
super || search_file(req, res, ".html") super ||
search_file(req, res, ".html") ||
search_file(req, res, ".xhtml")
end end
# Add the ability to tap file.html the same way that Nginx does on our # Add the ability to tap file.html the same way that Nginx does on our
@ -149,7 +151,9 @@ module Jekyll
def search_file(req, res, basename) def search_file(req, res, basename)
# /file.* > /file/index.html > /file.html # /file.* > /file/index.html > /file.html
super || super(req, res, "#{basename}.html") super ||
super(req, res, "#{basename}.html") ||
super(req, res, "#{basename}.xhtml")
end end
# rubocop:disable Naming/MethodName # rubocop:disable Naming/MethodName

1
test/fixtures/webrick/bar/foo.xhtml vendored Normal file
View File

@ -0,0 +1 @@
<html xmlns="http://www.w3.org/1999/xhtml">Content of foo.xhtml</html>

View File

@ -34,5 +34,15 @@ class TestCommandsServeServlet < JekyllUnitTest
assert_equal("404", response.code) assert_equal("404", response.code)
end end
end end
should "find xhtml file" do
get("/bar/foo") do |response|
assert_equal("200", response.code)
assert_equal(
'<html xmlns="http://www.w3.org/1999/xhtml">Content of foo.xhtml</html>',
response.body.strip
)
end
end
end end
end end