From d1fee3f6bc271b17df29eb953cd0a1911e7503c0 Mon Sep 17 00:00:00 2001 From: Dmitry Zenovich Date: Sat, 11 Oct 2014 02:38:32 +0400 Subject: [PATCH] fix special characters escaping --- lib/html2confluence.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/html2confluence.rb b/lib/html2confluence.rb index 35e99f7..3dfcf56 100644 --- a/lib/html2confluence.rb +++ b/lib/html2confluence.rb @@ -44,10 +44,9 @@ def normalise_space(s) # Escape any special characters. def escape_special_characters(s) - return s # Escaping is disabled now since it caused more problems that not having # it. The insertion of unecessary escaping was annoying for JIRA users. - s.to_s.gsub(/[*#+\-_{}|]/) do |s| + s.to_s.gsub(/[*#+\-_{}|!]/) do |s| "\\#{s}" end end @@ -125,7 +124,7 @@ def handle_data(data) write(data) else data ||= "" - data = normalise_space(escape_special_characters(data)) + data = normalise_space(data) if @last_write[-1] =~ /\s/ data = data.lstrip # Collapse whitespace if the previous character was whitespace. end @@ -427,6 +426,7 @@ def tag_end(name) end def text(string) + string = escape_special_characters(string) unless @preserveWhitespace handle_data(string) end end