diff options
| author | Douwe Maan <douwe@selenight.nl> | 2016-07-10 14:47:53 -0500 |
|---|---|---|
| committer | Douwe Maan <douwe@selenight.nl> | 2016-07-10 14:47:53 -0500 |
| commit | 24e7c3e3255111ee7a4907db26d4a37f5de9286d (patch) | |
| tree | 8f85f6032b6dbc3a9f51d9e2c0c9c59d5c4ec58d /lib/banzai | |
| parent | 2fcb2b339bbaad7a04414363eed81d2af82674a6 (diff) | |
| download | gitlab-ce-24e7c3e3255111ee7a4907db26d4a37f5de9286d.tar.gz | |
Add more comments to regex
Diffstat (limited to 'lib/banzai')
| -rw-r--r-- | lib/banzai/filter/blockquote_fence_filter.rb | 43 |
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 |
