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
Kazuhiko Shiozaki
gitlab-ce
Commits
534bd5a2
Commit
534bd5a2
authored
Nov 16, 2012
by
Riyad Preukschas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix emoji generation and styling
parent
bd60a4ed
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
13 deletions
+19
-13
app/assets/stylesheets/common.scss
app/assets/stylesheets/common.scss
+6
-0
lib/gitlab/markdown.rb
lib/gitlab/markdown.rb
+13
-13
No files found.
app/assets/stylesheets/common.scss
View file @
534bd5a2
...
@@ -692,3 +692,9 @@ h1.http_status_code {
...
@@ -692,3 +692,9 @@ h1.http_status_code {
}
}
}
}
}
}
img
.emoji
{
height
:
20px
;
vertical-align
:
middle
;
width
:
20px
;
}
lib/gitlab/markdown.rb
View file @
534bd5a2
...
@@ -25,18 +25,6 @@ module Gitlab
...
@@ -25,18 +25,6 @@ module Gitlab
# >> gfm(":trollface:")
# >> gfm(":trollface:")
# => "<img alt=\":trollface:\" class=\"emoji\" src=\"/images/trollface.png" title=\":trollface:\" />
# => "<img alt=\":trollface:\" class=\"emoji\" src=\"/images/trollface.png" title=\":trollface:\" />
module
Markdown
module
Markdown
REFERENCE_PATTERN
=
%r{
(
\W
)? # Prefix (1)
( # Reference (2)
@([
\w\.
_]+) # User name (3)
|[#!$](
\d
+) # Issue/MR/Snippet ID (4)
|([
\h
]{6,40}) # Commit ID (5)
)
(
\W
)? # Suffix (6)
}x
.
freeze
EMOJI_PATTERN
=
%r{(:(
\S
+):)}
.
freeze
attr_reader
:html_options
attr_reader
:html_options
# Public: Parse the provided text with GitLab-Flavored Markdown
# Public: Parse the provided text with GitLab-Flavored Markdown
...
@@ -92,6 +80,16 @@ module Gitlab
...
@@ -92,6 +80,16 @@ module Gitlab
text
text
end
end
REFERENCE_PATTERN
=
%r{
(
\W
)? # Prefix (1)
( # Reference (2)
@([
\w\.
_]+) # User name (3)
|[#!$](
\d
+) # Issue/MR/Snippet ID (4)
|([
\h
]{6,40}) # Commit ID (5)
)
(
\W
)? # Suffix (6)
}x
.
freeze
def
parse_references
(
text
)
def
parse_references
(
text
)
# parse reference links
# parse reference links
text
.
gsub!
(
REFERENCE_PATTERN
)
do
|
match
|
text
.
gsub!
(
REFERENCE_PATTERN
)
do
|
match
|
...
@@ -111,11 +109,13 @@ module Gitlab
...
@@ -111,11 +109,13 @@ module Gitlab
end
end
end
end
EMOJI_PATTERN
=
%r{(:(
\S
+):)}
.
freeze
def
parse_emoji
(
text
)
def
parse_emoji
(
text
)
# parse emoji
# parse emoji
text
.
gsub!
(
EMOJI_PATTERN
)
do
|
match
|
text
.
gsub!
(
EMOJI_PATTERN
)
do
|
match
|
if
valid_emoji?
(
$2
)
if
valid_emoji?
(
$2
)
image_tag
(
"emoji/
#{
$2
}
.png"
,
size:
"20x20"
,
class:
'emoji'
,
title:
$1
,
alt:
$1
)
image_tag
(
"emoji/
#{
$2
}
.png"
,
class:
'emoji'
,
title:
$1
,
alt:
$1
)
else
else
match
match
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