summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dzaporozhets@gitlab.com>2015-04-20 08:40:13 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-04-20 12:39:39 +0300
commit59e3832b6e9c6a01b4e59fecff9d19eff7ec54f6 (patch)
treef110d09cc808c3c7acf8068428214381da9f50df
parent5bbd2b8c4653af03ca0c24e8573cc3817fdf9499 (diff)
downloadgitlab-ce-59e3832b6e9c6a01b4e59fecff9d19eff7ec54f6.tar.gz
Merge branch 'fix-label-color' into 'master'
Parse GFM references after sanitizing Parse GFM references - labels, issues, MRs, etc. - after calling the HTML Pipeline `SanitizationFilter` so that we can use non-whitelisted attributes like `style`. See #2188. See merge request !1745
-rw-r--r--lib/gitlab/markdown.rb32
1 files changed, 16 insertions, 16 deletions
diff --git a/lib/gitlab/markdown.rb b/lib/gitlab/markdown.rb
index 8073417a16a..47c456d8dc7 100644
--- a/lib/gitlab/markdown.rb
+++ b/lib/gitlab/markdown.rb
@@ -68,23 +68,8 @@ module Gitlab
@options = options
@html_options = html_options
- # Extract pre blocks so they are not altered
- # from http://github.github.com/github-flavored-markdown/
- text.gsub!(%r{<pre>.*?</pre>|<code>.*?</code>}m) { |match| extract_piece(match) }
- # Extract links with probably parsable hrefs
- text.gsub!(%r{<a.*?>.*?</a>}m) { |match| extract_piece(match) }
- # Extract images with probably parsable src
- text.gsub!(%r{<img.*?>}m) { |match| extract_piece(match) }
-
# TODO: add popups with additional information
- text = parse(text, project)
-
- # Insert pre block extractions
- text.gsub!(/\{gfm-extraction-(\h{32})\}/) do
- insert_piece($1)
- end
-
# Used markdown pipelines in GitLab:
# GitlabEmojiFilter - performs emoji replacement.
# SanitizationFilter - remove unsafe HTML tags and attributes
@@ -129,6 +114,21 @@ module Gitlab
text = result[:output].to_html(save_with: save_options)
+ # Extract pre blocks so they are not altered
+ # from http://github.github.com/github-flavored-markdown/
+ text.gsub!(%r{<pre>.*?</pre>|<code>.*?</code>}m) { |match| extract_piece(match) }
+ # Extract links with probably parsable hrefs
+ text.gsub!(%r{<a.*?>.*?</a>}m) { |match| extract_piece(match) }
+ # Extract images with probably parsable src
+ text.gsub!(%r{<img.*?>}m) { |match| extract_piece(match) }
+
+ text = parse(text, project)
+
+ # Insert pre block extractions
+ text.gsub!(/\{gfm-extraction-(\h{32})\}/) do
+ insert_piece($1)
+ end
+
if options[:parse_tasks]
text = parse_tasks(text)
end
@@ -150,7 +150,7 @@ module Gitlab
@extractions[id]
end
- # Private: Parses text for references and emoji
+ # Private: Parses text for references
#
# text - Text to parse
#