summaryrefslogtreecommitdiff
path: root/lib/gitlab/regex.rb
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2018-07-06 11:35:30 +0100
committerSean McGivern <sean@gitlab.com>2018-07-06 11:35:30 +0100
commit0d9ef34a2541a2adf00677132eac3637de33b6d4 (patch)
tree3fd6cc6aeffc6d33b5e28d1d054a26cdf15e50e5 /lib/gitlab/regex.rb
parent7ff24772b63691f857a1ee1d113dcbdc3b01f064 (diff)
downloadgitlab-ce-0d9ef34a2541a2adf00677132eac3637de33b6d4.tar.gz
Add documentation and specs for webhook URL rewriting
Diffstat (limited to 'lib/gitlab/regex.rb')
-rw-r--r--lib/gitlab/regex.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/gitlab/regex.rb b/lib/gitlab/regex.rb
index ac3de2a8f71..e1a958c508a 100644
--- a/lib/gitlab/regex.rb
+++ b/lib/gitlab/regex.rb
@@ -73,5 +73,31 @@ module Gitlab
def build_trace_section_regex
@build_trace_section_regexp ||= /section_((?:start)|(?:end)):(\d+):([a-zA-Z0-9_.-]+)\r\033\[0K/.freeze
end
+
+ def markdown_code_or_html_blocks
+ @markdown_code_or_html_blocks ||= %r{
+ (?<code>
+ # Code blocks:
+ # ```
+ # Anything, including `>>>` blocks which are ignored by this filter
+ # ```
+
+ ^```
+ .+?
+ \n```\ *$
+ )
+ |
+ (?<html>
+ # HTML block:
+ # <tag>
+ # Anything, including `>>>` blocks which are ignored by this filter
+ # </tag>
+
+ ^<[^>]+?>\ *\n
+ .+?
+ \n<\/[^>]+?>\ *$
+ )
+ }mx
+ end
end
end