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
a4e4fde3
Commit
a4e4fde3
authored
Aug 27, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restore the forwarded HTML options in link_to_gfm
parent
4340dd3e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
+15
-0
app/helpers/gitlab_markdown_helper.rb
app/helpers/gitlab_markdown_helper.rb
+5
-0
spec/helpers/gitlab_markdown_helper_spec.rb
spec/helpers/gitlab_markdown_helper_spec.rb
+10
-0
No files found.
app/helpers/gitlab_markdown_helper.rb
View file @
a4e4fde3
...
@@ -38,6 +38,11 @@ module GitlabMarkdownHelper
...
@@ -38,6 +38,11 @@ module GitlabMarkdownHelper
end
end
end
end
# Add any custom CSS classes to the GFM-generated reference links
if
html_options
[
:class
]
fragment
.
css
(
'a.gfm'
).
add_class
(
html_options
[
:class
])
end
fragment
.
to_html
.
html_safe
fragment
.
to_html
.
html_safe
end
end
...
...
spec/helpers/gitlab_markdown_helper_spec.rb
View file @
a4e4fde3
...
@@ -79,6 +79,16 @@ describe GitlabMarkdownHelper do
...
@@ -79,6 +79,16 @@ describe GitlabMarkdownHelper do
expect
(
doc
.
css
(
'a'
)[
4
].
text
).
to
eq
' for real'
expect
(
doc
.
css
(
'a'
)[
4
].
text
).
to
eq
' for real'
end
end
it
'should forward HTML options'
do
actual
=
link_to_gfm
(
"Fixed in
#{
commit
.
id
}
"
,
commit_path
,
class:
'foo'
)
doc
=
Nokogiri
::
HTML
.
parse
(
actual
)
expect
(
doc
.
css
(
'a'
)).
to
satisfy
do
|
v
|
# 'foo' gets added to all links
v
.
all?
{
|
a
|
a
.
attr
(
'class'
).
match
(
/foo$/
)
}
end
end
it
"escapes HTML passed in as the body"
do
it
"escapes HTML passed in as the body"
do
actual
=
"This is a <h1>test</h1> - see
#{
issues
[
0
].
to_reference
}
"
actual
=
"This is a <h1>test</h1> - see
#{
issues
[
0
].
to_reference
}
"
expect
(
link_to_gfm
(
actual
,
commit_path
)).
expect
(
link_to_gfm
(
actual
,
commit_path
)).
...
...
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