Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
gitlab-ce
Commits
a3c6ed5c
Commit
a3c6ed5c
authored
Oct 01, 2015
by
SAKATA Sinji
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix link with emoji
parent
54452412
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletion
+7
-1
app/helpers/gitlab_markdown_helper.rb
app/helpers/gitlab_markdown_helper.rb
+1
-1
spec/helpers/gitlab_markdown_helper_spec.rb
spec/helpers/gitlab_markdown_helper_spec.rb
+6
-0
No files found.
app/helpers/gitlab_markdown_helper.rb
View file @
a3c6ed5c
...
@@ -21,7 +21,7 @@ module GitlabMarkdownHelper
...
@@ -21,7 +21,7 @@ module GitlabMarkdownHelper
gfm_body
=
Gitlab
::
Markdown
.
gfm
(
escaped_body
,
project:
@project
,
current_user:
current_user
)
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'
if
fragment
.
children
.
size
==
1
&&
fragment
.
children
[
0
].
name
==
'a'
# Fragment has only one node, and it's a link generated by `gfm`.
# Fragment has only one node, and it's a link generated by `gfm`.
# Replace it with our requested link.
# Replace it with our requested link.
...
...
spec/helpers/gitlab_markdown_helper_spec.rb
View file @
a3c6ed5c
...
@@ -106,6 +106,12 @@ describe GitlabMarkdownHelper do
...
@@ -106,6 +106,12 @@ describe GitlabMarkdownHelper do
act
=
link_to_gfm
(
text
,
'/foo'
)
act
=
link_to_gfm
(
text
,
'/foo'
)
expect
(
act
).
to
eq
%Q(<a href="/foo">
#{
issues
[
0
].
to_reference
}
</a>)
expect
(
act
).
to
eq
%Q(<a href="/foo">
#{
issues
[
0
].
to_reference
}
</a>)
end
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
end
describe
'#render_wiki_content'
do
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