Correctly generates file basename. Fixes #208.

The previous procedure generated invalid basenames when the filename had
more than one dot.
This commit is contained in:
Leandro Lisboa Penz 2010-09-05 18:11:09 -03:00
parent 3fa9af17fa
commit b1049c84cd
4 changed files with 22 additions and 1 deletions

View File

@ -1,3 +1,7 @@
== HEAD
* Bug Fixes
* Fixed filename basename generation (#208)
== 0.7.0 / 2010-08-24
* Minor Enhancements
* Add support for rdiscount extensions (#173)

View File

@ -71,7 +71,7 @@ module Jekyll
# Returns nothing
def process(name)
self.ext = File.extname(name)
self.basename = name.split('.')[0..-2].first
self.basename = name[0 .. -self.ext.length-1]
end
# Add any necessary layouts to this post

View File

@ -0,0 +1,7 @@
---
title: Deal with dots
permalink: /deal.with.dots/
---
Let's test if jekyll deals properly with dots.

View File

@ -23,6 +23,16 @@ class TestPage < Test::Unit::TestCase
assert_equal "/contacts.html", @page.url
end
should "deal properly with extensions" do
@page = setup_page('deal.with.dots.html')
assert_equal ".html", @page.ext
end
should "deal properly with dots" do
@page = setup_page('deal.with.dots.html')
assert_equal "deal.with.dots", @page.basename
end
context "with pretty url style" do
setup do
@site.permalink_style = :pretty