fix date parsing in file names
This commit is contained in:
parent
4bd6240a1d
commit
fac041933c
|
@ -9,7 +9,7 @@ module Jekyll
|
||||||
|
|
||||||
YAML_FRONT_MATTER_REGEXP = %r!\A(---\s*\n.*?\n?)^((---|\.\.\.)\s*$\n?)!m
|
YAML_FRONT_MATTER_REGEXP = %r!\A(---\s*\n.*?\n?)^((---|\.\.\.)\s*$\n?)!m
|
||||||
DATELESS_FILENAME_MATCHER = %r!^(?:.+/)*(.*)(\.[^.]+)$!
|
DATELESS_FILENAME_MATCHER = %r!^(?:.+/)*(.*)(\.[^.]+)$!
|
||||||
DATE_FILENAME_MATCHER = %r!^(?:.+/)*(\d+-\d+-\d+)-(.*)(\.[^.]+)$!
|
DATE_FILENAME_MATCHER = %r!^(?:.+/)*(\d{4}-\d{2}-\d{2})-(.*)(\.[^.]+)$!
|
||||||
|
|
||||||
# Create a new Document.
|
# Create a new Document.
|
||||||
#
|
#
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
title: "this is a test!"
|
||||||
|
---
|
||||||
|
|
||||||
|
wheee
|
|
@ -492,4 +492,33 @@ class TestDocument < JekyllUnitTest
|
||||||
assert_equal true, File.file?(@dest_file)
|
assert_equal true, File.file?(@dest_file)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "a document in a collection with dash-separated numeric file name" do
|
||||||
|
setup do
|
||||||
|
@site = fixture_site({
|
||||||
|
"collections" => {
|
||||||
|
"methods" => {
|
||||||
|
"output" => true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
@site.process
|
||||||
|
@document = @site.collections["methods"].docs.find do |doc|
|
||||||
|
doc.relative_path == "_methods/3940394-21-9393050-fifif1323-test.md"
|
||||||
|
end
|
||||||
|
@dest_file = dest_dir("methods/3940394-21-9393050-fifif1323-test.html")
|
||||||
|
end
|
||||||
|
|
||||||
|
should "produce the right URL" do
|
||||||
|
assert_equal "/methods/3940394-21-9393050-fifif1323-test.html", @document.url
|
||||||
|
end
|
||||||
|
|
||||||
|
should "produce the right destination" do
|
||||||
|
assert_equal @dest_file, @document.destination(dest_dir)
|
||||||
|
end
|
||||||
|
|
||||||
|
should "be output in the correct place" do
|
||||||
|
assert_equal true, File.file?(@dest_file)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue