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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
0c2da7f7
Commit
0c2da7f7
authored
Jul 18, 2016
by
Paco Guzman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't parse Rinku returned value to DocFragment when it didn't change the original html string.
parent
240a4aa6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
0 deletions
+23
-0
CHANGELOG
CHANGELOG
+1
-0
lib/banzai/filter/autolink_filter.rb
lib/banzai/filter/autolink_filter.rb
+2
-0
spec/lib/banzai/filter/autolink_filter_spec.rb
spec/lib/banzai/filter/autolink_filter_spec.rb
+20
-0
No files found.
CHANGELOG
View file @
0c2da7f7
...
@@ -64,6 +64,7 @@ v 8.10.0 (unreleased)
...
@@ -64,6 +64,7 @@ v 8.10.0 (unreleased)
- Collapse large diffs by default (!4990)
- Collapse large diffs by default (!4990)
- Fix mentioned users list on diff notes
- Fix mentioned users list on diff notes
- Fix creation of deployment on build that is retried, redeployed or rollback
- Fix creation of deployment on build that is retried, redeployed or rollback
- Don't parse Rinku returned value to DocFragment when it didn't change the original html string.
- Check for conflicts with existing Project's wiki path when creating a new project.
- Check for conflicts with existing Project's wiki path when creating a new project.
- Show last push widget in upstream after push to fork
- Show last push widget in upstream after push to fork
- Fix stage status shown for pipelines
- Fix stage status shown for pipelines
...
...
lib/banzai/filter/autolink_filter.rb
View file @
0c2da7f7
...
@@ -56,6 +56,8 @@ module Banzai
...
@@ -56,6 +56,8 @@ module Banzai
# period (e.g., http://localhost:3000/)
# period (e.g., http://localhost:3000/)
rinku
=
Rinku
.
auto_link
(
html
,
:urls
,
options
,
IGNORE_PARENTS
.
to_a
,
1
)
rinku
=
Rinku
.
auto_link
(
html
,
:urls
,
options
,
IGNORE_PARENTS
.
to_a
,
1
)
return
if
rinku
==
html
# Rinku returns a String, so parse it back to a Nokogiri::XML::Document
# Rinku returns a String, so parse it back to a Nokogiri::XML::Document
# for further processing.
# for further processing.
@doc
=
parse_html
(
rinku
)
@doc
=
parse_html
(
rinku
)
...
...
spec/lib/banzai/filter/autolink_filter_spec.rb
View file @
0c2da7f7
...
@@ -15,6 +15,16 @@ describe Banzai::Filter::AutolinkFilter, lib: true do
...
@@ -15,6 +15,16 @@ describe Banzai::Filter::AutolinkFilter, lib: true do
expect
(
filter
(
act
).
to_html
).
to
eq
exp
expect
(
filter
(
act
).
to_html
).
to
eq
exp
end
end
context
'when the input contains no links'
do
it
'does not parse_html back the rinku returned value'
do
act
=
HTML
::
Pipeline
.
parse
(
'<p>This text contains no links to autolink</p>'
)
expect_any_instance_of
(
described_class
).
not_to
receive
(
:parse_html
)
filter
(
act
).
to_html
end
end
context
'Rinku schemes'
do
context
'Rinku schemes'
do
it
'autolinks http'
do
it
'autolinks http'
do
doc
=
filter
(
"See
#{
link
}
"
)
doc
=
filter
(
"See
#{
link
}
"
)
...
@@ -58,6 +68,16 @@ describe Banzai::Filter::AutolinkFilter, lib: true do
...
@@ -58,6 +68,16 @@ describe Banzai::Filter::AutolinkFilter, lib: true do
expect
(
filter
(
act
).
to_html
).
to
eq
exp
expect
(
filter
(
act
).
to_html
).
to
eq
exp
end
end
end
end
context
'when the input contains link'
do
it
'does parse_html back the rinku returned value'
do
act
=
HTML
::
Pipeline
.
parse
(
"<p>See
#{
link
}
</p>"
)
expect_any_instance_of
(
described_class
).
to
receive
(
:parse_html
).
at_least
(
:once
).
and_call_original
filter
(
act
).
to_html
end
end
end
end
context
'other schemes'
do
context
'other schemes'
do
...
...
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