summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarin Jankovski <maxlazio@gmail.com>2014-10-09 14:20:49 +0200
committerMarin Jankovski <maxlazio@gmail.com>2014-10-09 14:20:49 +0200
commit64e72af3cb65731c84e1aa27b68a04fe378bebd9 (patch)
tree7c151c6911b8d42462aa942be164455ec2709281
parent099cf3558f9e41022ac38d2f8226bdbe3c9aa470 (diff)
downloadgitlab-ce-64e72af3cb65731c84e1aa27b68a04fe378bebd9.tar.gz
Replace apostrophe with right single quote to avoid markdown interpretation as issue 39.
-rw-r--r--lib/redcarpet/render/gitlab_html.rb5
-rw-r--r--spec/helpers/gitlab_markdown_helper_spec.rb4
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/redcarpet/render/gitlab_html.rb b/lib/redcarpet/render/gitlab_html.rb
index c3378d6a18f..53c5a1e09c0 100644
--- a/lib/redcarpet/render/gitlab_html.rb
+++ b/lib/redcarpet/render/gitlab_html.rb
@@ -10,6 +10,11 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML
super options
end
+ def normal_text(text)
+ return text unless text.present?
+ text.gsub("'", "&rsquo;")
+ end
+
def block_code(code, language)
# New lines are placed to fix an rendering issue
# with code wrapped inside <h1> tag for next case:
diff --git a/spec/helpers/gitlab_markdown_helper_spec.rb b/spec/helpers/gitlab_markdown_helper_spec.rb
index f7b87f2966e..55270a9c204 100644
--- a/spec/helpers/gitlab_markdown_helper_spec.rb
+++ b/spec/helpers/gitlab_markdown_helper_spec.rb
@@ -535,7 +535,7 @@ describe GitlabMarkdownHelper do
project.issues.stub(:where).with(iid: '39').and_return([issue])
actual = "Yes, it is @#{member.user.username}'s task."
- expected = /Yes, it is <a.+>@#{member.user.username}<\/a>'s task/
+ expected = /Yes, it is <a.+>@#{member.user.username}<\/a>’s task/
markdown(actual).should match(expected)
end
@@ -566,7 +566,7 @@ describe GitlabMarkdownHelper do
it "should leave inline code untouched" do
markdown("\nDon't use `$#{snippet.id}` here.\n").should ==
- "<p>Don't use <code>$#{snippet.id}</code> here.</p>\n"
+ "<p>Don’t use <code>$#{snippet.id}</code> here.</p>\n"
end
it "should leave ref-like autolinks untouched" do