Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
24e7c3e3
Commit
24e7c3e3
authored
8 years ago
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add more comments to regex
parent
2fcb2b33
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
13 deletions
+34
-13
lib/banzai/filter/blockquote_fence_filter.rb
lib/banzai/filter/blockquote_fence_filter.rb
+32
-11
spec/fixtures/blockquote_fence_after.md
spec/fixtures/blockquote_fence_after.md
+1
-1
spec/fixtures/blockquote_fence_before.md
spec/fixtures/blockquote_fence_before.md
+1
-1
No files found.
lib/banzai/filter/blockquote_fence_filter.rb
View file @
24e7c3e3
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
spec/fixtures/blockquote_fence_after.md
View file @
24e7c3e3
...
...
@@ -8,7 +8,7 @@ Single `>>>` inside code block:
Double
`>>>`
inside code block:
```
```
txt
# Code
>>>
# Code
...
...
This diff is collapsed.
Click to expand it.
spec/fixtures/blockquote_fence_before.md
View file @
24e7c3e3
...
...
@@ -8,7 +8,7 @@ Single `>>>` inside code block:
Double
`>>>`
inside code block:
```
```
txt
# Code
>>>
# Code
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment