summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiyad Preukschas <riyad@informatik.uni-bremen.de>2012-11-16 23:25:07 +0100
committerRiyad Preukschas <riyad@informatik.uni-bremen.de>2012-12-03 22:51:56 +0100
commit534bd5a268bc3409db1352198222275ff844316d (patch)
treee5896cd8d280ad266de614b04a2bf1780afa0b84
parentbd60a4ed40ca52fd23e027de8f30e2f094eb6e5c (diff)
downloadgitlab-ce-534bd5a268bc3409db1352198222275ff844316d.tar.gz
Fix emoji generation and styling
-rw-r--r--app/assets/stylesheets/common.scss6
-rw-r--r--lib/gitlab/markdown.rb26
2 files changed, 19 insertions, 13 deletions
diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss
index 738ec2bf1dc..44bfb619ead 100644
--- a/app/assets/stylesheets/common.scss
+++ b/app/assets/stylesheets/common.scss
@@ -692,3 +692,9 @@ h1.http_status_code {
}
}
}
+
+img.emoji {
+ height: 20px;
+ vertical-align: middle;
+ width: 20px;
+}
diff --git a/lib/gitlab/markdown.rb b/lib/gitlab/markdown.rb
index ee0ee05c3be..23f408c697c 100644
--- a/lib/gitlab/markdown.rb
+++ b/lib/gitlab/markdown.rb
@@ -25,18 +25,6 @@ module Gitlab
# >> gfm(":trollface:")
# => "<img alt=\":trollface:\" class=\"emoji\" src=\"/images/trollface.png" title=\":trollface:\" />
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
# Public: Parse the provided text with GitLab-Flavored Markdown
@@ -92,6 +80,16 @@ module Gitlab
text
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)
# parse reference links
text.gsub!(REFERENCE_PATTERN) do |match|
@@ -111,11 +109,13 @@ module Gitlab
end
end
+ EMOJI_PATTERN = %r{(:(\S+):)}.freeze
+
def parse_emoji(text)
# 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)
+ image_tag("emoji/#{$2}.png", class: 'emoji', title: $1, alt: $1)
else
match
end