Merge pull request #2552 from jekyll/collections-with-dots
This commit is contained in:
commit
7eb5e07e9d
|
@ -52,7 +52,7 @@ module Jekyll
|
||||||
def filtered_entries
|
def filtered_entries
|
||||||
return Array.new unless exists?
|
return Array.new unless exists?
|
||||||
Dir.chdir(directory) do
|
Dir.chdir(directory) do
|
||||||
entry_filter.filter(entries)
|
entry_filter.filter(entries).reject { |f| File.directory?(f) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns a sanitized version of the label.
|
# Returns a sanitized version of the label.
|
||||||
def sanitize_label(label)
|
def sanitize_label(label)
|
||||||
label.gsub(/[^a-z0-9_\-]/i, '')
|
label.gsub(/[^a-z0-9_\-\.]/i, '')
|
||||||
end
|
end
|
||||||
|
|
||||||
# Produce a representation of this Collection for use in Liquid.
|
# Produce a representation of this Collection for use in Liquid.
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
title: v2.4.0
|
||||||
|
---
|
||||||
|
|
||||||
|
v2.4.0
|
|
@ -17,15 +17,15 @@ class TestCollections < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
should "sanitize the label name" do
|
should "sanitize the label name" do
|
||||||
assert_equal @collection.label, "etcpassword"
|
assert_equal @collection.label, "....etcpassword"
|
||||||
end
|
end
|
||||||
|
|
||||||
should "have a sanitized relative path name" do
|
should "have a sanitized relative path name" do
|
||||||
assert_equal @collection.relative_directory, "_etcpassword"
|
assert_equal @collection.relative_directory, "_....etcpassword"
|
||||||
end
|
end
|
||||||
|
|
||||||
should "have a sanitized full path" do
|
should "have a sanitized full path" do
|
||||||
assert_equal @collection.directory, source_dir("_etcpassword")
|
assert_equal @collection.directory, source_dir("_....etcpassword")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -194,4 +194,31 @@ class TestCollections < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "with dots in the filenames" do
|
||||||
|
setup do
|
||||||
|
@site = fixture_site({
|
||||||
|
"collections" => ["with.dots"],
|
||||||
|
"safe" => true
|
||||||
|
})
|
||||||
|
@site.process
|
||||||
|
@collection = @site.collections["with.dots"]
|
||||||
|
end
|
||||||
|
|
||||||
|
should "exist" do
|
||||||
|
assert_not_nil @collection
|
||||||
|
end
|
||||||
|
|
||||||
|
should "contain one document" do
|
||||||
|
assert_equal 2, @collection.docs.size
|
||||||
|
end
|
||||||
|
|
||||||
|
should "allow dots in the filename" do
|
||||||
|
assert_equal "_with.dots", @collection.relative_directory
|
||||||
|
end
|
||||||
|
|
||||||
|
should "read document in subfolders with dots" do
|
||||||
|
assert @collection.docs.any? { |d| d.path.include?("all.dots") }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue