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
iv
gitlab-ce
Commits
331154ff
Commit
331154ff
authored
Dec 24, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Escape reference link text
parent
e622259d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
lib/banzai/filter/abstract_reference_filter.rb
lib/banzai/filter/abstract_reference_filter.rb
+10
-7
lib/banzai/filter/reference_filter.rb
lib/banzai/filter/reference_filter.rb
+1
-1
No files found.
lib/banzai/filter/abstract_reference_filter.rb
View file @
331154ff
...
...
@@ -110,13 +110,7 @@ module Banzai
url
=
matches
[
:url
]
if
matches
.
names
.
include?
(
"url"
)
url
||=
url_for_object
(
object
,
project
)
text
=
link_text
unless
text
text
=
object
.
reference_link_text
(
context
[
:project
])
extras
=
object_link_text_extras
(
object
,
matches
)
text
+=
" (
#{
extras
.
join
(
", "
)
}
)"
if
extras
.
any?
end
text
=
link_text
||
escape_once
(
object_link_text
(
object
,
matches
))
%(<a href="#{url}" #{data}
title="#{title}"
...
...
@@ -140,6 +134,15 @@ module Banzai
def
object_link_title
(
object
)
"
#{
object_class
.
name
.
titleize
}
:
#{
object
.
title
}
"
end
def
object_link_text
(
object
,
matches
)
text
=
object
.
reference_link_text
(
context
[
:project
])
extras
=
object_link_text_extras
(
object
,
matches
)
text
+=
" (
#{
extras
.
join
(
", "
)
}
)"
if
extras
.
any?
text
end
end
end
end
lib/banzai/filter/reference_filter.rb
View file @
331154ff
...
...
@@ -48,7 +48,7 @@ module Banzai
end
def
escape_once
(
html
)
ERB
::
Util
.
html_escape_once
(
html
)
html
.
html_safe?
?
html
:
ERB
::
Util
.
html_escape_once
(
html
)
end
def
ignore_parents
...
...
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