diff --git a/lib/jekyll/tags/post_url.rb b/lib/jekyll/tags/post_url.rb index c8b820b8..b865cd67 100644 --- a/lib/jekyll/tags/post_url.rb +++ b/lib/jekyll/tags/post_url.rb @@ -14,7 +14,8 @@ module Jekyll "'#{name}' does not contain valid date and/or title." end - @name_regex = %r!^_posts/#{path}#{date}-#{slug}\.[^.]+|^#{path}_posts/?#{date}-#{slug}\.[^.]+! + @name_regex = %r!^_posts/#{path}#{date}-#{slug}\.[^.]+| + ^#{path}_posts/?#{date}-#{slug}\.[^.]+!x end def post_date diff --git a/test/test_tags.rb b/test/test_tags.rb index 5bfbd2f8..7a929281 100644 --- a/test/test_tags.rb +++ b/test/test_tags.rb @@ -596,19 +596,27 @@ title: Deprecated Post linking - 1 {% post_url 2008-11-21-nested %} CONTENT - create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true}) + create_post(content, { + "permalink" => "pretty", + "source" => source_dir, + "destination" => dest_dir, + "read_posts" => true + }) end should "not cause an error" do - refute_match(/markdown\-html\-error/, @result) + refute_match(%r!markdown\-html\-error!, @result) end should "have the url to the \"nested\" post from 2008-11-21" do - assert_match %r{1\s/2008/11/21/nested/}, @result + assert_match %r!1\s/2008/11/21/nested/!, @result end should "throw a deprecation warning" do - deprecation_warning = " Deprecation: A call to '{{ post_url 2008-11-21-nested }}' did not match a post using the new matching method of checking name (path-date-slug) equality. Please make sure that you change this tag to match the post's name exactly." + deprecation_warning = " Deprecation: A call to "\ + "'{{ post_url 2008-11-21-nested }}' did not match a post using the new matching "\ + "method of checking name (path-date-slug) equality. Please make sure that you "\ + "change this tag to match the post's name exactly." assert_includes Jekyll.logger.messages, deprecation_warning end end