From 64e72af3cb65731c84e1aa27b68a04fe378bebd9 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Thu, 9 Oct 2014 14:20:49 +0200 Subject: Replace apostrophe with right single quote to avoid markdown interpretation as issue 39. --- lib/redcarpet/render/gitlab_html.rb | 5 +++++ spec/helpers/gitlab_markdown_helper_spec.rb | 4 ++-- 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("'", "’") + end + def block_code(code, language) # New lines are placed to fix an rendering issue # with code wrapped inside

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 @#{member.user.username}<\/a>'s task/ + expected = /Yes, it is @#{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 == - "

Don't use $#{snippet.id} here.

\n" + "

Don’t use $#{snippet.id} here.

\n" end it "should leave ref-like autolinks untouched" do -- cgit v1.2.1