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
Tatuya Kamada
gitlab-ce
Commits
e0f9d3a5
Commit
e0f9d3a5
authored
Oct 07, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update ReferenceFilter docs
[ci skip]
parent
72afcbcd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
10 deletions
+9
-10
lib/gitlab/markdown/reference_filter.rb
lib/gitlab/markdown/reference_filter.rb
+9
-10
No files found.
lib/gitlab/markdown/reference_filter.rb
View file @
e0f9d3a5
...
@@ -11,9 +11,6 @@ module Gitlab
...
@@ -11,9 +11,6 @@ module Gitlab
# Context options:
# Context options:
# :project (required) - Current project, ignored if reference is cross-project.
# :project (required) - Current project, ignored if reference is cross-project.
# :only_path - Generate path-only links.
# :only_path - Generate path-only links.
#
# Results:
# :references - A Hash of references that were found and replaced.
class
ReferenceFilter
<
HTML
::
Pipeline
::
Filter
class
ReferenceFilter
<
HTML
::
Pipeline
::
Filter
def
self
.
user_can_reference?
(
user
,
node
,
context
)
def
self
.
user_can_reference?
(
user
,
node
,
context
)
if
node
.
has_attribute?
(
'data-project'
)
if
node
.
has_attribute?
(
'data-project'
)
...
@@ -33,14 +30,16 @@ module Gitlab
...
@@ -33,14 +30,16 @@ module Gitlab
# Returns a data attribute String to attach to a reference link
# Returns a data attribute String to attach to a reference link
#
#
#
id - Object ID
#
attributes - Hash, where the key becomes the data attribute name and the
#
type - Object type (default: :project)
#
value is the data attribute value
#
#
# Examples:
# Examples:
#
#
# data_attribute(project: 1) # => "data-reference-filter=\"SomeReferenceFilter\" data-project=\"1\""
# data_attribute(project: 1, issue: 2)
# data_attribute(user: 2) # => "data-reference-filter=\"SomeReferenceFilter\" data-user=\"2\""
# # => "data-reference-filter=\"Gitlab::Markdown::SomeReferenceFilter\" data-project=\"1\" data-issue=\"2\""
# data_attribute(group: 3) # => "data-reference-filter=\"SomeReferenceFilter\" data-group=\"3\""
#
# data_attribute(project: 3, merge_request: 4)
# # => "data-reference-filter=\"Gitlab::Markdown::SomeReferenceFilter\" data-project=\"3\" data-merge-request=\"4\""
#
#
# Returns a String
# Returns a String
def
data_attribute
(
attributes
=
{})
def
data_attribute
(
attributes
=
{})
...
@@ -86,7 +85,7 @@ module Gitlab
...
@@ -86,7 +85,7 @@ module Gitlab
# Yields the current node's String contents. The result of the block will
# Yields the current node's String contents. The result of the block will
# replace the node's existing content and update the current document.
# replace the node's existing content and update the current document.
#
#
# Returns the updated Nokogiri::
XML::Docu
ment object.
# Returns the updated Nokogiri::
HTML::DocumentFrag
ment object.
def
replace_text_nodes_matching
(
pattern
)
def
replace_text_nodes_matching
(
pattern
)
return
doc
if
project
.
nil?
return
doc
if
project
.
nil?
...
...
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