Merge pull request #5920 from jekyll/allow-brief-post-dates

Merge pull request 5920
This commit is contained in:
jekyllbot 2017-03-02 12:32:13 -05:00 committed by GitHub
commit 3d5cf99df5
3 changed files with 18 additions and 3 deletions

View File

@ -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{4}-\d{2}-\d{2})-(.*)(\.[^.]+)$! DATE_FILENAME_MATCHER = %r!^(?:.+/)*(\d{2,4}-\d{1,2}-\d{1,2})-(.*)(\.[^.]+)$!
# Create a new Document. # Create a new Document.
# #

View File

@ -0,0 +1,5 @@
---
foo: bar
---
I have an abbreviated date. Instead of "2017-02-05", I am instead "2017-2-5".
Zeros have always seemed superfluous.

View File

@ -7,11 +7,14 @@ class TestGeneratedSite < JekyllUnitTest
@site = fixture_site @site = fixture_site
@site.process @site.process
@index = File.read(dest_dir("index.html")) @index = File.read(
dest_dir("index.html"),
Utils.merged_file_read_opts(@site, {})
)
end end
should "ensure post count is as expected" do should "ensure post count is as expected" do
assert_equal 51, @site.posts.size assert_equal 52, @site.posts.size
end end
should "insert site.posts into the index" do should "insert site.posts into the index" do
@ -48,6 +51,13 @@ class TestGeneratedSite < JekyllUnitTest
assert_exist dest_dir("dynamic_file.php") assert_exist dest_dir("dynamic_file.php")
end end
should "include a post with a abbreviated dates" do
refute_nil @site.posts.index { |post|
post.relative_path == "_posts/2017-2-5-i-dont-like-zeroes.md"
}
assert_exist dest_dir("2017", "02", "05", "i-dont-like-zeroes.html")
end
should "print a nice list of static files" do should "print a nice list of static files" do
time_regexp = "\\d+:\\d+" time_regexp = "\\d+:\\d+"
# #