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
2c0f375f
Commit
2c0f375f
authored
Aug 13, 2016
by
Jared Deckard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix inline comment images by removing wrapper #20890
parent
30f5b9a5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
12 deletions
+5
-12
lib/banzai/filter/image_link_filter.rb
lib/banzai/filter/image_link_filter.rb
+1
-8
spec/features/atom/users_spec.rb
spec/features/atom/users_spec.rb
+1
-1
spec/lib/banzai/filter/image_link_filter_spec.rb
spec/lib/banzai/filter/image_link_filter_spec.rb
+3
-3
No files found.
lib/banzai/filter/image_link_filter.rb
View file @
2c0f375f
...
...
@@ -8,11 +8,6 @@ module Banzai
# of the anchor, and then replace the img with the link-wrapped version.
def
call
doc
.
xpath
(
'descendant-or-self::img[not(ancestor::a)]'
).
each
do
|
img
|
div
=
doc
.
document
.
create_element
(
'div'
,
class:
'image-container'
)
link
=
doc
.
document
.
create_element
(
'a'
,
class:
'no-attachment-icon'
,
...
...
@@ -22,9 +17,7 @@ module Banzai
link
.
children
=
img
.
clone
div
.
children
=
link
img
.
replace
(
div
)
img
.
replace
(
link
)
end
doc
...
...
spec/features/atom/users_spec.rb
View file @
2c0f375f
...
...
@@ -61,7 +61,7 @@ describe "User Feed", feature: true do
end
it
'has XHTML summaries in merge request descriptions'
do
expect
(
body
).
to
match
/Here is the fix: <
\/p><div[^>]*><a[^>]*><img[^>]*\/><\/a><\/div
>/
expect
(
body
).
to
match
/Here is the fix: <
a[^>]*><img[^>]*\/><\/a
>/
end
end
end
...
...
spec/lib/banzai/filter/image_link_filter_spec.rb
View file @
2c0f375f
...
...
@@ -22,8 +22,8 @@ describe Banzai::Filter::ImageLinkFilter, lib: true do
expect
(
doc
.
at_css
(
'img'
)[
'src'
]).
to
eq
doc
.
at_css
(
'a'
)[
'href'
]
end
it
'w
raps the image with a link and a div
'
do
doc
=
filter
(
image
(
'/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg'
))
expect
(
doc
.
to_html
).
to
include
(
'<div class="image-container">'
)
it
'w
orks with inline images
'
do
doc
=
filter
(
%Q(<p>test
#{
image
(
'/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg'
)
}
inline</p>
)
)
expect
(
doc
.
to_html
).
to
match
/^<p>test <a[^>]*><img[^>]*><\/a> inline<\/p>$/
end
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