Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarka Kadlecová <jarka@gitlab.com>2018-02-16 16:33:50 +0300
committerJarka Kadlecová <jarka@gitlab.com>2018-02-21 21:37:08 +0300
commit1a09d5cda8e9f6b90b85351a16fcddea351b869f (patch)
tree8f122084c92e11a76d7035fe4d5f635be363dd26 /lib/gitlab/string_regex_marker.rb
parent0ef19f1cfa6163a17e745c36ed6d3f3c51942661 (diff)
Render htmlentities correctly for links not supported by Rinku
Diffstat (limited to 'lib/gitlab/string_regex_marker.rb')
-rw-r--r--lib/gitlab/string_regex_marker.rb12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/gitlab/string_regex_marker.rb b/lib/gitlab/string_regex_marker.rb
index 7ebf1c0428c..b19aa6dea35 100644
--- a/lib/gitlab/string_regex_marker.rb
+++ b/lib/gitlab/string_regex_marker.rb
@@ -1,13 +1,15 @@
module Gitlab
class StringRegexMarker < StringRangeMarker
def mark(regex, group: 0, &block)
- regex_match = raw_line.match(regex)
- return rich_line unless regex_match
+ ranges = []
- begin_index, end_index = regex_match.offset(group)
- name_range = begin_index..(end_index - 1)
+ raw_line.scan(regex) do
+ begin_index, end_index = Regexp.last_match.offset(group)
- super([name_range], &block)
+ ranges << (begin_index..(end_index - 1))
+ end
+
+ super(ranges, &block)
end
end
end