From e773e8c1a9adb228dc77575fab67161dd2ebf955 Mon Sep 17 00:00:00 2001 From: Ben Hollis Date: Sat, 19 Oct 2013 19:02:34 -0700 Subject: [PATCH] Fix tests under 1.8 by coercing Kramdown's OrderedHash into a real Hash. --- middleman-core/features/markdown_kramdown.feature | 1 + middleman-core/lib/middleman-core/renderers/kramdown.rb | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/middleman-core/features/markdown_kramdown.feature b/middleman-core/features/markdown_kramdown.feature index 898e12b2..097fc4b9 100644 --- a/middleman-core/features/markdown_kramdown.feature +++ b/middleman-core/features/markdown_kramdown.feature @@ -1,6 +1,7 @@ Feature: Markdown (Kramdown) support In order to test included Kramdown support + @no18 Scenario: Kramdown smartypants extension Given a fixture app "markdown-app" And a file named "config.rb" with: diff --git a/middleman-core/lib/middleman-core/renderers/kramdown.rb b/middleman-core/lib/middleman-core/renderers/kramdown.rb index 216a73cd..81bb867a 100644 --- a/middleman-core/lib/middleman-core/renderers/kramdown.rb +++ b/middleman-core/lib/middleman-core/renderers/kramdown.rb @@ -19,14 +19,17 @@ module Middleman cattr_accessor :middleman_app def convert_img(el, indent) - attrs = el.attr.dup + # Constructing a new hash is required because Kramdown uses a crazy non-hash in 1.8 + attrs = Hash[el.attr.dup.to_a] + link = attrs.delete('src') middleman_app.image_tag(link, attrs) end def convert_a(el, indent) content = inner(el, indent) - attr = el.attr.dup + # Constructing a new hash is required because Kramdown uses a crazy non-hash in 1.8 + attr = Hash[el.attr.dup.to_a] if attr['href'] =~ /\Amailto:/ mail_addr = attr['href'].sub(/\Amailto:/, '') attr['href'] = obfuscate('mailto') << ":" << obfuscate(mail_addr) @@ -34,6 +37,7 @@ module Middleman end link = attr.delete('href') + middleman_app.link_to(content, link, attr) end end