Merge pull request #992 from maul-esel/consistent-page.url
add leading slash to page.url and post.url
This commit is contained in:
		
						commit
						ce999f12fc
					
				| 
						 | 
				
			
			@ -78,6 +78,7 @@ module Jekyll
 | 
			
		|||
      # sanitize url
 | 
			
		||||
      @url = url.split('/').reject{ |part| part =~ /^\.+$/ }.join('/')
 | 
			
		||||
      @url += "/" if url =~ /\/$/
 | 
			
		||||
      @url.gsub!(/\A([^\/])/, '/\1')
 | 
			
		||||
      @url
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -228,6 +228,7 @@ module Jekyll
 | 
			
		|||
      # sanitize url
 | 
			
		||||
      @url = url.split('/').reject{ |part| part =~ /^\.+$/ }.join('/')
 | 
			
		||||
      @url += "/" if url =~ /\/$/
 | 
			
		||||
      @url.gsub!(/\A([^\/])/, '/\1')
 | 
			
		||||
      @url
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -176,7 +176,8 @@ following is a reference of the available data.
 | 
			
		|||
      <td><p><code>page.url</code></p></td>
 | 
			
		||||
      <td><p>
 | 
			
		||||
 | 
			
		||||
        The URL of the Post without the domain. e.g.
 | 
			
		||||
        The URL of the Post without the domain, but
 | 
			
		||||
        with a leading slash, e.g.
 | 
			
		||||
        <code>/2008/12/14/my-post.html</code>
 | 
			
		||||
 | 
			
		||||
      </p></td>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -71,8 +71,8 @@ class TestPost < Test::Unit::TestCase
 | 
			
		|||
        @post.read_yaml(@source, file)
 | 
			
		||||
 | 
			
		||||
        assert_equal "my_category/permalinked-post", @post.permalink
 | 
			
		||||
        assert_equal "my_category", @post.dir
 | 
			
		||||
        assert_equal "my_category/permalinked-post", @post.url
 | 
			
		||||
        assert_equal "/my_category", @post.dir
 | 
			
		||||
        assert_equal "/my_category/permalinked-post", @post.url
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      context "with CRLF linebreaks" do
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue