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
1759ea18
Commit
1759ea18
authored
Jun 21, 2019
by
Stan Hu
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'patch-71' into 'master'
Update rouge See merge request gitlab-org/gitlab-ce!29541
parents
868da1d6
4a349944
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
7 deletions
+8
-7
Gemfile.lock
Gemfile.lock
+1
-1
spec/lib/gitlab/highlight_spec.rb
spec/lib/gitlab/highlight_spec.rb
+7
-6
No files found.
Gemfile.lock
View file @
1759ea18
...
@@ -770,7 +770,7 @@ GEM
...
@@ -770,7 +770,7 @@ GEM
retriable (3.1.2)
retriable (3.1.2)
rinku (2.0.0)
rinku (2.0.0)
rotp (2.1.2)
rotp (2.1.2)
rouge (3.
3.0
)
rouge (3.
4.1
)
rqrcode (0.7.0)
rqrcode (0.7.0)
chunky_png
chunky_png
rqrcode-rails3 (0.1.7)
rqrcode-rails3 (0.1.7)
...
...
spec/lib/gitlab/highlight_spec.rb
View file @
1759ea18
...
@@ -18,9 +18,10 @@ describe Gitlab::Highlight do
...
@@ -18,9 +18,10 @@ describe Gitlab::Highlight do
end
end
describe
'#highlight'
do
describe
'#highlight'
do
let
(
:plain_text_file_name
)
{
"test.txt"
}
let
(
:plain_text_content
)
{
"plain text contents"
}
let
(
:file_name
)
{
'test.lisp'
}
let
(
:file_name
)
{
'test.lisp'
}
let
(
:no_context_content
)
{
":type
\"
assem
\"
))"
}
let
(
:content
)
{
"(make-pathname :defaults name
\n
:type
\"
assem
\"
)"
}
let
(
:content
)
{
"(make-pathname :defaults name
\n
#{
no_context_content
}
"
}
let
(
:multiline_content
)
do
let
(
:multiline_content
)
do
%q(
%q(
def test(input):
def test(input):
...
@@ -32,22 +33,22 @@ describe Gitlab::Highlight do
...
@@ -32,22 +33,22 @@ describe Gitlab::Highlight do
it
'highlights'
do
it
'highlights'
do
expected
=
%Q[<span id="LC1" class="line" lang="common_lisp"><span class="p">(</span><span class="nb">make-pathname</span> <span class="ss">:defaults</span> <span class="nv">name</span></span>
expected
=
%Q[<span id="LC1" class="line" lang="common_lisp"><span class="p">(</span><span class="nb">make-pathname</span> <span class="ss">:defaults</span> <span class="nv">name</span></span>
<span id="LC2" class="line" lang="common_lisp"><span class="ss">:type</span> <span class="s">"assem"</span><span class="p">)
)
</span></span>]
<span id="LC2" class="line" lang="common_lisp"><span class="ss">:type</span> <span class="s">"assem"</span><span class="p">)</span></span>]
expect
(
described_class
.
highlight
(
file_name
,
content
)).
to
eq
(
expected
)
expect
(
described_class
.
highlight
(
file_name
,
content
)).
to
eq
(
expected
)
end
end
it
'returns plain version for unknown lexer context'
do
it
'returns plain version for unknown lexer context'
do
result
=
described_class
.
highlight
(
file_name
,
no_con
text_content
)
result
=
described_class
.
highlight
(
plain_text_file_name
,
plain_
text_content
)
expect
(
result
).
to
eq
(
%[<span id="LC1" class="line" lang="
">:type "assem"))
</span>]
)
expect
(
result
).
to
eq
(
%[<span id="LC1" class="line" lang="
plaintext">plain text contents
</span>]
)
end
end
it
'returns plain version for long content'
do
it
'returns plain version for long content'
do
stub_const
(
'Gitlab::Highlight::MAXIMUM_TEXT_HIGHLIGHT_SIZE'
,
1
)
stub_const
(
'Gitlab::Highlight::MAXIMUM_TEXT_HIGHLIGHT_SIZE'
,
1
)
result
=
described_class
.
highlight
(
file_name
,
content
)
result
=
described_class
.
highlight
(
file_name
,
content
)
expect
(
result
).
to
eq
(
%[<span id="LC1" class="line" lang="">(make-pathname :defaults name</span>\n<span id="LC2" class="line" lang="">:type "assem")
)
</span>]
)
expect
(
result
).
to
eq
(
%[<span id="LC1" class="line" lang="">(make-pathname :defaults name</span>\n<span id="LC2" class="line" lang="">:type "assem")</span>]
)
end
end
it
'highlights multi-line comments'
do
it
'highlights multi-line comments'
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