Fixing paginate_path on windows

This commit is contained in:
Christopher Giroir 2013-05-07 23:24:10 -07:00
parent 8bd14f18f6
commit 09fafd6418
2 changed files with 8 additions and 2 deletions

View File

@ -92,8 +92,9 @@ module Jekyll
# Returns the pagination path as a string
def self.paginate_path(site_config, num_page)
return nil if num_page.nil? || num_page <= 1
format = File.basename(site_config['paginate_path'])
format.sub(':num', num_page.to_s)
format = site_config['paginate_path']
format = format.sub(':num', num_page.to_s)
File.basename(format)
end
# Initialize a new Pager.

View File

@ -11,6 +11,11 @@ class TestPager < Test::Unit::TestCase
assert_equal(3, Pager.calculate_pages([1,2,3,4,5], '2'))
end
should "determine the pagination path" do
assert_nil(Pager.paginate_path(Jekyll::Configuration::DEFAULTS, 1))
assert_equal("page2", Pager.paginate_path(Jekyll::Configuration::DEFAULTS, 2))
end
context "pagination disabled" do
setup do
stub(Jekyll).configuration do