Merge pull request #5605 from Lunderberg/master

Merge pull request 5605
This commit is contained in:
jekyllbot 2016-11-28 09:25:11 -08:00 committed by GitHub
commit c3bf59c72c
4 changed files with 38 additions and 3 deletions

View File

@ -14,8 +14,9 @@ module Jekyll
"'#{name}' does not contain valid date and/or title."
end
@name_regex = %r!^_posts/#{path}#{date}-#{slug}\.[^.]+|
^#{path}_posts/?#{date}-#{slug}\.[^.]+!x
escaped_slug = Regexp.escape(slug)
@name_regex = %r!^_posts/#{path}#{date}-#{escaped_slug}\.[^.]+|
^#{path}_posts/?#{date}-#{escaped_slug}\.[^.]+!x
end
def post_date

View File

@ -0,0 +1,8 @@
---
layout: default
title: Special Characters
---
url: {{ page.url }}
date: {{ page.date }}
id: {{ page.id }}

View File

@ -11,7 +11,7 @@ class TestGeneratedSite < JekyllUnitTest
end
should "ensure post count is as expected" do
assert_equal 50, @site.posts.size
assert_equal 51, @site.posts.size
end
should "insert site.posts into the index" do

View File

@ -554,6 +554,32 @@ CONTENT
end
end
context "simple page with post linking containing special characters" do
setup do
content = <<CONTENT
---
title: Post linking
---
{% post_url 2016-11-26-special-chars-(+) %}
CONTENT
create_post(content, {
"permalink" => "pretty",
"source" => source_dir,
"destination" => dest_dir,
"read_posts" => true
})
end
should "not cause an error" do
refute_match(%r!markdown\-html\-error!, @result)
end
should 'have the URL to the "special-chars" post from 2016-11-26' do
assert_match %r!/2016/11/26/special-chars-\(\+\)/!, @result
end
end
context "simple page with nested post linking" do
setup do
content = <<CONTENT