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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
d313a768
Commit
d313a768
authored
Oct 14, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Explicitly only parse references by specified filter
parent
d6fb96b9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
lib/gitlab/markdown/reference_gatherer_filter.rb
lib/gitlab/markdown/reference_gatherer_filter.rb
+2
-0
lib/gitlab/reference_extractor.rb
lib/gitlab/reference_extractor.rb
+6
-2
No files found.
lib/gitlab/markdown/reference_gatherer_filter.rb
View file @
d313a768
...
@@ -33,6 +33,8 @@ module Gitlab
...
@@ -33,6 +33,8 @@ module Gitlab
reference_type
=
node
.
attr
(
'data-reference-filter'
)
reference_type
=
node
.
attr
(
'data-reference-filter'
)
reference_filter
=
reference_type
.
constantize
reference_filter
=
reference_type
.
constantize
return
if
context
[
:reference_filter
]
&&
reference_filter
!=
context
[
:reference_filter
]
return
unless
reference_filter
.
user_can_reference?
(
current_user
,
node
,
context
)
return
unless
reference_filter
.
user_can_reference?
(
current_user
,
node
,
context
)
references
=
reference_filter
.
referenced_by
(
node
)
references
=
reference_filter
.
referenced_by
(
node
)
...
...
lib/gitlab/reference_extractor.rb
View file @
d313a768
...
@@ -40,16 +40,20 @@ module Gitlab
...
@@ -40,16 +40,20 @@ module Gitlab
#
#
# Returns the results Array for the requested filter type
# Returns the results Array for the requested filter type
def
pipeline_result
(
filter_type
)
def
pipeline_result
(
filter_type
)
klass
=
filter_type
.
to_s
.
camelize
+
'ReferenceFilter'
klass
=
"
#{
filter_type
.
to_s
.
camelize
}
ReferenceFilter"
filter
=
Gitlab
::
Markdown
.
const_get
(
klass
)
filter
=
Gitlab
::
Markdown
.
const_get
(
klass
)
context
=
{
context
=
{
project:
project
,
project:
project
,
current_user:
current_user
,
current_user:
current_user
,
# We don't actually care about the links generated
# We don't actually care about the links generated
only_path:
true
,
only_path:
true
,
ignore_blockquotes:
true
,
ignore_blockquotes:
true
,
load_lazy_references:
false
# ReferenceGathererFilter
load_lazy_references:
false
,
reference_filter:
filter
}
}
pipeline
=
HTML
::
Pipeline
.
new
([
filter
,
Gitlab
::
Markdown
::
ReferenceGathererFilter
],
context
)
pipeline
=
HTML
::
Pipeline
.
new
([
filter
,
Gitlab
::
Markdown
::
ReferenceGathererFilter
],
context
)
...
...
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