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
Tatuya Kamada
gitlab-ce
Commits
ce3fb949
Commit
ce3fb949
authored
Sep 08, 2012
by
Riyad Preukschas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug where parsing of emoji was unnecessarily dependent on @project being set
parent
9a4c22d3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
lib/gitlab/markdown.rb
lib/gitlab/markdown.rb
+5
-2
spec/helpers/gitlab_markdown_helper_spec.rb
spec/helpers/gitlab_markdown_helper_spec.rb
+5
-0
No files found.
lib/gitlab/markdown.rb
View file @
ce3fb949
...
...
@@ -47,7 +47,6 @@ module Gitlab
# Note: reference links will only be generated if @project is set
def
gfm
(
text
,
html_options
=
{})
return
text
if
text
.
nil?
return
text
if
@project
.
nil?
@html_options
=
html_options
...
...
@@ -78,8 +77,11 @@ module Gitlab
#
# text - Text to parse
#
# Note: reference links will only be generated if @project is set
#
# Returns parsed text
def
parse
(
text
)
# parse reference links
text
.
gsub!
(
REFERENCE_PATTERN
)
do
|
match
|
prefix
=
$1
||
''
reference
=
$2
...
...
@@ -91,8 +93,9 @@ module Gitlab
else
match
end
end
end
if
@project
# parse emoji
text
.
gsub!
(
EMOJI_PATTERN
)
do
|
match
|
if
valid_emoji?
(
$2
)
image_tag
(
"emoji/
#{
$2
}
.png"
,
size:
"20x20"
,
class:
'emoji'
,
title:
$1
,
alt:
$1
)
...
...
spec/helpers/gitlab_markdown_helper_spec.rb
View file @
ce3fb949
...
...
@@ -247,6 +247,11 @@ describe GitlabMarkdownHelper do
it
"ignores invalid emoji"
do
gfm
(
":invalid-emoji:"
).
should_not
match
(
/<img/
)
end
it
"should work independet of reference links (i.e. without @project being set)"
do
@project
=
nil
gfm
(
":+1:"
).
should
match
(
/<img/
)
end
end
end
...
...
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