Added unit test for special character, fixed error that it exposed.
This commit is contained in:
parent
bbdeb32f38
commit
a55760d4ad
|
@ -16,7 +16,7 @@ module Jekyll
|
||||||
|
|
||||||
escaped_slug = Regexp.escape(slug)
|
escaped_slug = Regexp.escape(slug)
|
||||||
@name_regex = %r!^_posts/#{path}#{date}-#{escaped_slug}\.[^.]+|
|
@name_regex = %r!^_posts/#{path}#{date}-#{escaped_slug}\.[^.]+|
|
||||||
^#{path}_posts/?#{date}-#{slug}\.[^.]+!x
|
^#{path}_posts/?#{date}-#{escaped_slug}\.[^.]+!x
|
||||||
end
|
end
|
||||||
|
|
||||||
def post_date
|
def post_date
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
layout: default
|
||||||
|
title: Special Characters
|
||||||
|
---
|
||||||
|
|
||||||
|
url: {{ page.url }}
|
||||||
|
date: {{ page.date }}
|
||||||
|
id: {{ page.id }}
|
|
@ -554,6 +554,32 @@ CONTENT
|
||||||
end
|
end
|
||||||
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 \"complex\" post from 2008-11-21" do
|
||||||
|
assert_match %r!/2016/11/26/special-chars-\(\+\)/!, @result
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context "simple page with nested post linking" do
|
context "simple page with nested post linking" do
|
||||||
setup do
|
setup do
|
||||||
content = <<CONTENT
|
content = <<CONTENT
|
||||||
|
|
Loading…
Reference in New Issue