diff options
author | Dmitriy Zaporozhets <dzaporozhets@gitlab.com> | 2014-10-12 18:50:55 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dzaporozhets@gitlab.com> | 2014-10-12 18:50:55 +0000 |
commit | 7a01d0cc74eac15475f4c2245447c7f751744219 (patch) | |
tree | 29653aeb070b545e0cde107377f71d2bb2da6fbf /lib | |
parent | b09fd2337a20e7d45cb9ef6ac1f4dde0d0e43e2a (diff) | |
parent | fc2adfb6e4af59e45809661e32be0d2ad3158503 (diff) | |
download | gitlab-ce-7a01d0cc74eac15475f4c2245447c7f751744219.tar.gz |
Merge branch 'bug_with_apostrophe' into 'master'
Bug with apostrophe when at mentioning users
This fixes the situation where mentioning user with apostrophe at the end causes a link to issue 39 if the project has that issue, so `@marin` would look like `@marin's`.
Fixes #1034
See merge request !1165
Diffstat (limited to 'lib')
-rw-r--r-- | lib/redcarpet/render/gitlab_html.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/redcarpet/render/gitlab_html.rb b/lib/redcarpet/render/gitlab_html.rb index c3378d6a18f..54d740908d5 100644 --- a/lib/redcarpet/render/gitlab_html.rb +++ b/lib/redcarpet/render/gitlab_html.rb @@ -10,6 +10,17 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML super options end + # If project has issue number 39, apostrophe will be linked in + # regular text to the issue as Redcarpet will convert apostrophe to + # #39; + # We replace apostrophe with right single quote before Redcarpet + # does the processing and put the apostrophe back in postprocessing. + # This only influences regular text, code blocks are untouched. + 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 <h1> tag for next case: @@ -44,6 +55,7 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML end def postprocess(full_document) + full_document.gsub!("’", "'") unless @template.instance_variable_get("@project_wiki") || @project.nil? full_document = h.create_relative_links(full_document) end |