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
466bec7c
Commit
466bec7c
authored
Apr 29, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename SCHEME_PATTERN to LINK_PATTERN
parent
cd3c24a8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
lib/gitlab/markdown/autolink_filter.rb
lib/gitlab/markdown/autolink_filter.rb
+5
-5
No files found.
lib/gitlab/markdown/autolink_filter.rb
View file @
466bec7c
...
...
@@ -27,9 +27,9 @@ module Gitlab
# in the generated link.
#
# Rubular: http://rubular.com/r/cxjPyZc7Sb
SCHEME
_PATTERN
=
%r{([a-z][a-z0-9
\+\.
-]+://
\S
+)(?<!,|
\.
)}
LINK
_PATTERN
=
%r{([a-z][a-z0-9
\+\.
-]+://
\S
+)(?<!,|
\.
)}
# Text matching
SCHEME
_PATTERN inside these elements will not be linked
# Text matching
LINK
_PATTERN inside these elements will not be linked
IGNORE_PARENTS
=
%w(a code kbd pre script style)
.
to_set
def
call
...
...
@@ -62,14 +62,14 @@ module Gitlab
@doc
=
parse_html
(
rinku
)
end
# Autolinks any text matching
SCHEME
_PATTERN that Rinku didn't already
# Autolinks any text matching
LINK
_PATTERN that Rinku didn't already
# replace
def
text_parse
search_text_nodes
(
doc
).
each
do
|
node
|
content
=
node
.
to_html
next
if
has_ancestor?
(
node
,
IGNORE_PARENTS
)
next
unless
content
.
match
(
SCHEME
_PATTERN
)
next
unless
content
.
match
(
LINK
_PATTERN
)
# If Rinku didn't link this, there's probably a good reason, so we'll
# skip it too
...
...
@@ -86,7 +86,7 @@ module Gitlab
end
def
autolink_filter
(
text
)
text
.
gsub
(
SCHEME
_PATTERN
)
do
|
match
|
text
.
gsub
(
LINK
_PATTERN
)
do
|
match
|
options
=
link_options
.
merge
(
href:
match
)
content_tag
(
:a
,
match
,
options
)
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