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
Léo-Paul Géneau
gitlab-ce
Commits
94919c7e
Commit
94919c7e
authored
Jun 02, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ignore references in blockquotes.
parent
fe78984f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
5 deletions
+16
-5
lib/gitlab/markdown/reference_filter.rb
lib/gitlab/markdown/reference_filter.rb
+10
-4
lib/gitlab/reference_extractor.rb
lib/gitlab/reference_extractor.rb
+2
-1
spec/lib/gitlab/reference_extractor_spec.rb
spec/lib/gitlab/reference_extractor_spec.rb
+4
-0
No files found.
lib/gitlab/markdown/reference_filter.rb
View file @
94919c7e
...
...
@@ -25,12 +25,18 @@ module Gitlab
ERB
::
Util
.
html_escape_once
(
html
)
end
# Don't look for references in text nodes that are children of these
# elements.
IGNORE_PARENTS
=
%w(pre code a style)
.
to_set
def
ignore_parents
@ignore_parents
||=
begin
# Don't look for references in text nodes that are children of these
# elements.
parents
=
%w(pre code a style)
parents
<<
'blockquote'
if
context
[
:ignore_blockquotes
]
parents
.
to_set
end
end
def
ignored_ancestry?
(
node
)
has_ancestor?
(
node
,
IGNORE_PARENTS
)
has_ancestor?
(
node
,
ignore_parents
)
end
def
project
...
...
lib/gitlab/reference_extractor.rb
View file @
94919c7e
...
...
@@ -48,7 +48,8 @@ module Gitlab
project:
project
,
current_user:
current_user
,
# We don't actually care about the links generated
only_path:
true
only_path:
true
,
ignore_blockquotes:
true
}
pipeline
=
HTML
::
Pipeline
.
new
([
filter
],
context
)
...
...
spec/lib/gitlab/reference_extractor_spec.rb
View file @
94919c7e
...
...
@@ -32,6 +32,10 @@ describe Gitlab::ReferenceExtractor do
```
@bar
```
Quote:
> @offteam
}
)
expect
(
subject
.
users
).
to
eq
([])
end
...
...
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