Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #684 from mattr-/issue-680.

  • Loading branch information...
commit f231ef76445344e9a4c63a710732f1e8c9b35c3f 2 parents 85c3bf6 + 8fb4e8f
@parkr parkr authored
View
3  jekyll.gemspec
@@ -42,6 +42,9 @@ Gem::Specification.new do |s|
s.add_development_dependency('redcarpet', "~> 2.1.1")
s.add_development_dependency('launchy', "~> 2.1.2")
s.add_development_dependency('simplecov', "~> 0.7")
+ s.add_development_dependency('sequel', "~> 3.42")
+ s.add_development_dependency('htmlentities', "~> 4.3")
+ s.add_development_dependency('hpricot', "~> 0.8")
# = MANIFEST =
s.files = %w[
View
1  lib/jekyll/migrators/wordpress.rb
@@ -276,6 +276,7 @@ def self.clean_entities( text )
text.gsub!(">", ">")
text.gsub!(""", '"')
text.gsub!("'", "'")
+ text.gsub!("/", "/")
text
end
View
6 lib/jekyll/migrators/wordpressdotcom.rb
@@ -19,7 +19,7 @@ def self.process(filename = "wordpress.xml")
permalink_title = item.at('wp:post_name').inner_text
# Fallback to "prettified" title if post_name is empty (can happen)
if permalink_title == ""
- permalink_title = title.downcase.split.join('-')
+ permalink_title = sluggify(title)
end
date = Time.parse(item.at('wp:post_date').inner_text)
@@ -74,5 +74,9 @@ def self.process(filename = "wordpress.xml")
puts "Imported #{value} #{key}s"
end
end
+
+ def self.sluggify(title)
+ title.downcase.split.join('-').gsub('/','-')
+ end
end
end
View
10 test/test_wordpress_migrator.rb
@@ -0,0 +1,10 @@
+require 'helper'
+require 'jekyll/migrators/wordpress'
+require 'htmlentities'
+
+class TestWordpressMigrator < Test::Unit::TestCase
+ should "clean slashes from slugs" do
+ test_title = "blogs part 1/2"
+ assert_equal("blogs-part-1-2", Jekyll::WordPress.sluggify(test_title))
+ end
+end
View
9 test/test_wordpressdotcom_migrator.rb
@@ -0,0 +1,9 @@
+require 'helper'
+require 'jekyll/migrators/wordpressdotcom'
+
+class TestWordpressDotComMigrator < Test::Unit::TestCase
+ should "clean slashes from slugs" do
+ test_title = "blogs part 1/2"
+ assert_equal("blogs-part-1-2", Jekyll::WordpressDotCom.sluggify(test_title))
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.