diff options
author | Stan Hu <stanhu@gmail.com> | 2015-10-01 14:12:43 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2015-10-01 14:12:43 -0700 |
commit | 24320724667f7a66af494511a92e72ec38e3c52b (patch) | |
tree | 813f66828f285e47e575c1acb8895bdfd187a2fa | |
parent | 8366ce364c3c777474adfdd3721976cb4c963030 (diff) | |
parent | 1c53c28c795f70536da74fecf0cd7abfaeacd2a5 (diff) | |
download | gitlab-ce-24320724667f7a66af494511a92e72ec38e3c52b.tar.gz |
Merge branch 'master' of https://github.com/gitlabhq/gitlabhq
-rw-r--r-- | app/helpers/gitlab_markdown_helper.rb | 2 | ||||
-rw-r--r-- | spec/helpers/gitlab_markdown_helper_spec.rb | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/app/helpers/gitlab_markdown_helper.rb b/app/helpers/gitlab_markdown_helper.rb index 153a44870f6..12b87dca798 100644 --- a/app/helpers/gitlab_markdown_helper.rb +++ b/app/helpers/gitlab_markdown_helper.rb @@ -21,7 +21,7 @@ module GitlabMarkdownHelper gfm_body = Gitlab::Markdown.gfm(escaped_body, project: @project, current_user: current_user) - fragment = Nokogiri::XML::DocumentFragment.parse(gfm_body) + fragment = Nokogiri::HTML::DocumentFragment.parse(gfm_body) if fragment.children.size == 1 && fragment.children[0].name == 'a' # Fragment has only one node, and it's a link generated by `gfm`. # Replace it with our requested link. diff --git a/spec/helpers/gitlab_markdown_helper_spec.rb b/spec/helpers/gitlab_markdown_helper_spec.rb index be0e0c747b7..20ae29e2bd3 100644 --- a/spec/helpers/gitlab_markdown_helper_spec.rb +++ b/spec/helpers/gitlab_markdown_helper_spec.rb @@ -106,6 +106,12 @@ describe GitlabMarkdownHelper do act = link_to_gfm(text, '/foo') expect(act).to eq %Q(<a href="/foo">#{issues[0].to_reference}</a>) end + + it 'should replace commit message with emoji to link' do + actual = link_to_gfm(':book:Book', '/foo') + expect(actual). + to eq %Q(<img class="emoji" title=":book:" alt=":book:" src="http://localhost/assets/emoji/1F4D6.png" height="20" width="20" align="absmiddle"><a href="/foo">Book</a>) + end end describe '#render_wiki_content' do |