Merge pull request #1397 from nfagerlund/error_187_undefined_method_encoding_for_mailto

Fix 'undefined method `encoding` for "mailto"' errors w/ Ruby 1.8 and Kramdown > 0.14.0
This commit is contained in:
Parker Moore 2013-08-08 02:14:36 -07:00
commit 3703bde3b1
2 changed files with 3 additions and 9 deletions

View File

@ -24,7 +24,9 @@ module Jekyll
private
def replace_generated_toc(rd, html, toc_token)
if rd.generate_toc && html.include?(toc_token)
html.gsub(toc_token, rd.toc_content.force_encoding('utf-8'))
utf8_toc = rd.toc_content
utf8_toc.force_encoding('utf-8') if utf8_toc.respond_to?(:force_encoding)
html.gsub(toc_token, utf8_toc)
else
html
end

View File

@ -69,11 +69,3 @@ module Enumerable
any? { |exp| File.fnmatch?(exp, e) }
end
end
if RUBY_VERSION < "1.9"
class String
def force_encoding(enc)
self
end
end
end