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
ed6ed251
Commit
ed6ed251
authored
Apr 24, 2017
by
Toon Claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused optional parameter `asciidoc_opts`
parent
a5344275
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
27 deletions
+6
-27
lib/gitlab/asciidoc.rb
lib/gitlab/asciidoc.rb
+4
-8
spec/lib/gitlab/asciidoc_spec.rb
spec/lib/gitlab/asciidoc_spec.rb
+2
-19
No files found.
lib/gitlab/asciidoc.rb
View file @
ed6ed251
...
@@ -14,15 +14,11 @@ module Gitlab
...
@@ -14,15 +14,11 @@ module Gitlab
# Public: Converts the provided Asciidoc markup into HTML.
# Public: Converts the provided Asciidoc markup into HTML.
#
#
# input - the source text in Asciidoc format
# input - the source text in Asciidoc format
# asciidoc_opts - a Hash of options to pass to the Asciidoctor converter
#
#
def
self
.
render
(
input
,
asciidoc_opts
=
{})
def
self
.
render
(
input
)
asciidoc_opts
.
reverse_merge!
(
asciidoc_opts
=
{
safe: :secure
,
safe: :secure
,
backend: :gitlab_html5
,
backend: :gitlab_html5
,
attributes:
DEFAULT_ADOC_ATTRS
}
attributes:
[]
)
asciidoc_opts
[
:attributes
].
unshift
(
*
DEFAULT_ADOC_ATTRS
)
plantuml_setup
plantuml_setup
...
...
spec/lib/gitlab/asciidoc_spec.rb
View file @
ed6ed251
...
@@ -22,26 +22,9 @@ module Gitlab
...
@@ -22,26 +22,9 @@ module Gitlab
expect
(
Asciidoctor
).
to
receive
(
:convert
)
expect
(
Asciidoctor
).
to
receive
(
:convert
)
.
with
(
input
,
expected_asciidoc_opts
).
and_return
(
html
)
.
with
(
input
,
expected_asciidoc_opts
).
and_return
(
html
)
expect
(
render
(
input
,
context
)
).
to
eql
html
expect
(
render
(
input
)).
to
eq
(
html
)
end
end
context
"with asciidoc_opts"
do
let
(
:asciidoc_opts
)
{
{
safe: :safe
,
attributes:
[
'foo'
]
}
}
it
"merges the options with default ones"
do
expected_asciidoc_opts
=
{
safe: :safe
,
backend: :gitlab_html5
,
attributes:
described_class
::
DEFAULT_ADOC_ATTRS
+
[
'foo'
]
}
expect
(
Asciidoctor
).
to
receive
(
:convert
)
.
with
(
input
,
expected_asciidoc_opts
).
and_return
(
html
)
render
(
input
,
context
,
asciidoc_opts
)
end
end
context
"XSS"
do
context
"XSS"
do
links
=
{
links
=
{
'links'
=>
{
'links'
=>
{
...
@@ -60,7 +43,7 @@ module Gitlab
...
@@ -60,7 +43,7 @@ module Gitlab
links
.
each
do
|
name
,
data
|
links
.
each
do
|
name
,
data
|
it
"does not convert dangerous
#{
name
}
into HTML"
do
it
"does not convert dangerous
#{
name
}
into HTML"
do
expect
(
render
(
data
[
:input
]
,
context
)).
to
eql
data
[
:output
]
expect
(
render
(
data
[
:input
]
)).
to
eq
(
data
[
:output
])
end
end
end
end
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