Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
5c840d7dbba8
Commit
a3c6ed5c
authored
Oct 01, 2015
by
SAKATA Sinji
Browse files
Fix link with emoji
parent
09c6c6e1653a
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/helpers/gitlab_markdown_helper.rb
View file @
5c840d7d
...
...
@@ -21,7 +21,7 @@ def link_to_gfm(body, url, html_options = {})
gfm_body
=
Gitlab
::
Markdown
.
gfm
(
escaped_body
,
project:
@project
,
current_user:
current_user
)
fragment
=
Nokogiri
::
X
ML
::
DocumentFragment
.
parse
(
gfm_body
)
fragment
=
Nokogiri
::
HT
ML
::
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.
...
...
spec/helpers/gitlab_markdown_helper_spec.rb
View file @
5c840d7d
...
...
@@ -106,6 +106,12 @@
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment