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:
authorDouwe Maan <douwe@selenight.nl>2016-07-10 22:47:53 +0300
committerDouwe Maan <douwe@selenight.nl>2016-07-10 22:47:53 +0300
commit24e7c3e3255111ee7a4907db26d4a37f5de9286d (patch)
tree8f85f6032b6dbc3a9f51d9e2c0c9c59d5c4ec58d /lib/banzai
parent2fcb2b339bbaad7a04414363eed81d2af82674a6 (diff)
Add more comments to regex
Diffstat (limited to 'lib/banzai')
-rw-r--r--lib/banzai/filter/blockquote_fence_filter.rb43
1 files changed, 32 insertions, 11 deletions
diff --git a/lib/banzai/filter/blockquote_fence_filter.rb b/lib/banzai/filter/blockquote_fence_filter.rb
index fb815c2d837..d2c4b1e4d76 100644
--- a/lib/banzai/filter/blockquote_fence_filter.rb
+++ b/lib/banzai/filter/blockquote_fence_filter.rb
@@ -5,35 +5,56 @@ module Banzai
(?<code>
# Code blocks:
# ```
- # Anything, including ignored `>>>` blocks
+ # Anything, including `>>>` blocks which are ignored by this filter
# ```
- ^```.+?\n```$
+
+ ^```
+ .+?
+ \n```$
)
|
(?<html>
- # HTML:
+ # HTML block:
# <tag>
- # Anything, including ignored `>>>` blocks
+ # Anything, including `>>>` blocks which are ignored by this filter
# </tag>
- ^<[^>]+?>.+?\n<\/[^>]+?>$
+
+ ^<[^>]+?>\n
+ .+?
+ \n<\/[^>]+?>$
)
|
- (
- ^>>>\n(?<quote>
+ (?:
+ # Blockquote:
+ # >>>
+ # Anything, including code and HTML blocks
+ # >>>
+
+ ^>>>\n
+ (?<quote>
(?:
- (?!^```|^<[^>]+?>).
+ # Any character that doesn't introduce a code or HTML block
+ (?!
+ ^```
+ |
+ ^<[^>]+?>\n
+ )
+ .
|
+ # A code block
\g<code>
|
+ # An HTML block
\g<html>
- )
- +?)\n>>>$
+ )+?
+ )
+ \n>>>$
)
}mx.freeze
def initialize(text, context = nil, result = nil)
super text, context, result
- @text = @text.delete "\r"
+ @text = @text.delete("\r")
end
def call