From 56101ed26444d0b0fe5ec76a8d270e34e76a0e5e Mon Sep 17 00:00:00 2001 From: bootstraponline Date: Sat, 13 Oct 2012 13:32:08 -0600 Subject: [PATCH] Fix #535 and add test --- lib/gollum/markup.rb | 2 +- test/test_wiki.rb | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/gollum/markup.rb b/lib/gollum/markup.rb index d7cb1003..300ec037 100644 --- a/lib/gollum/markup.rb +++ b/lib/gollum/markup.rb @@ -122,7 +122,7 @@ module Gollum end node = Nokogiri::XML::Node.new('li', doc) # % -> %25 so anchors work on Firefox. See issue #475 - node.add_child("#{h.content}") + node.add_child(%Q{#{h.content}}) tail.add_child(node) end toc = toc.to_xhtml if toc != nil diff --git a/test/test_wiki.rb b/test/test_wiki.rb index 9e2c2176..eaed4676 100644 --- a/test/test_wiki.rb +++ b/test/test_wiki.rb @@ -142,6 +142,16 @@ context "Wiki TOC" do assert_equal '

Bilbo

', page.formatted_data.gsub(/\n/,"") assert_equal %{
Table of Contents
}, page.toc_data.gsub(/\n */,"") end + + # Ensure ' creates valid links in TOC + # Incorrect: + # Correct: + test "' in link" do + page = @wiki.preview_page("Test", "# a'b", :markdown) + assert_equal "# a'b", page.raw_data + assert_equal %q{

a'b

}, page.formatted_data.gsub(/\n/,"") + assert_equal %{
Table of Contents
}, page.toc_data.gsub(/\n */,"") + end end context "Wiki page writing" do