diff --git a/lib/jekyll/page.rb b/lib/jekyll/page.rb index 0c71c7d1..fa85a250 100644 --- a/lib/jekyll/page.rb +++ b/lib/jekyll/page.rb @@ -86,8 +86,8 @@ module Jekyll # desired placeholder replacements. For details see "url.rb" def url_placeholders { - :path => @dir, - :basename => basename, + :path => URL.escape_path(@dir), + :basename => URL.escape_path(basename), :output_ext => output_ext } end @@ -135,7 +135,7 @@ module Jekyll # # Returns the destination file path String. def destination(dest) - path = Jekyll.sanitized_path(dest, url) + path = Jekyll.sanitized_path(dest, URL.unescape_path(url)) path = File.join(path, "index.html") if url =~ /\/$/ path end diff --git a/test/source/+/%# +.md b/test/source/+/%# +.md new file mode 100644 index 00000000..a850f4dc --- /dev/null +++ b/test/source/+/%# +.md @@ -0,0 +1,6 @@ +--- +layout: default +title : Page name with non-alphabetic character +--- +Line 1 +{{ page.title }} diff --git a/test/test_filters.rb b/test/test_filters.rb index 9a514229..8c6e0259 100644 --- a/test/test_filters.rb +++ b/test/test_filters.rb @@ -125,7 +125,7 @@ class TestFilters < Test::Unit::TestCase case g["name"] when "default" assert g["items"].is_a?(Array), "The list of grouped items for 'default' is not an Array." - assert_equal 4, g["items"].size + assert_equal 5, g["items"].size when "nil" assert g["items"].is_a?(Array), "The list of grouped items for 'nil' is not an Array." assert_equal 2, g["items"].size diff --git a/test/test_page.rb b/test/test_page.rb index 8e60922f..90f68c96 100644 --- a/test/test_page.rb +++ b/test/test_page.rb @@ -30,6 +30,11 @@ class TestPage < Test::Unit::TestCase assert_equal false, @page.published? end + should "create url with non-alphabetic characters" do + @page = setup_page('+', '%# +.md') + assert_equal "/+/%25%23%20+.html", @page.url + end + context "in a directory hierarchy" do should "create url based on filename" do @page = setup_page('/contacts', 'bar.html') @@ -174,6 +179,15 @@ class TestPage < Test::Unit::TestCase assert File.exists?(File.join(dest_dir, '+', 'plus+in+url')) end + should "write even when permalink has '%# +'" do + page = setup_page('+', '%# +.md') + do_render(page) + page.write(dest_dir) + + assert File.directory?(dest_dir) + assert File.exists?(File.join(dest_dir, '+', '%# +.html')) + end + should "write properly without html extension" do page = setup_page('contacts.html') page.site.permalink_style = :pretty diff --git a/test/test_site.rb b/test/test_site.rb index c7ba23f9..f166c5a5 100644 --- a/test/test_site.rb +++ b/test/test_site.rb @@ -159,6 +159,7 @@ class TestSite < Test::Unit::TestCase @site.process # files in symlinked directories may appear twice sorted_pages = %w( + %#\ +.md .htaccess about.html bar.html