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
66b37149
Commit
66b37149
authored
Jun 22, 2016
by
http://jneen.net/
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support cgi style options, such as erb?parent=json
parent
e7b512ef
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
7 deletions
+18
-7
lib/gitlab/highlight.rb
lib/gitlab/highlight.rb
+3
-3
spec/lib/gitlab/highlight_spec.rb
spec/lib/gitlab/highlight_spec.rb
+14
-3
spec/support/test_env.rb
spec/support/test_env.rb
+1
-1
No files found.
lib/gitlab/highlight.rb
View file @
66b37149
...
...
@@ -40,11 +40,11 @@ module Gitlab
private
def
custom_language
return
nil
if
@repository
.
nil?
language_name
=
@repository
&&
@repository
.
gitattribute
(
@blob_name
,
'gitlab-language'
)
language_name
=
@repository
.
gitattribute
(
@blob_name
,
'gitlab-language'
)
return
nil
unless
language_name
Rouge
::
Lexer
.
find
(
language_name
)
Rouge
::
Lexer
.
find
_fancy
(
language_name
)
end
def
rouge_formatter
(
options
=
{})
...
...
spec/lib/gitlab/highlight_spec.rb
View file @
66b37149
...
...
@@ -21,7 +21,6 @@ describe Gitlab::Highlight, lib: true do
describe
'custom highlighting from .gitattributes'
do
let
(
:branch
)
{
'gitattributes'
}
let
(
:path
)
{
'custom-highlighting/test.gitlab-custom'
}
let
(
:blob
)
{
repository
.
blob_at_branch
(
branch
,
path
)
}
let
(
:highlighter
)
do
...
...
@@ -30,8 +29,20 @@ describe Gitlab::Highlight, lib: true do
before
{
project
.
change_head
(
'gitattributes'
)
}
it
'highlights as ruby'
do
expect
(
highlighter
.
lexer
.
tag
).
to
eq
'ruby'
describe
'basic language selection'
do
let
(
:path
)
{
'custom-highlighting/test.gitlab-custom'
}
it
'highlights as ruby'
do
expect
(
highlighter
.
lexer
.
tag
).
to
eq
'ruby'
end
end
describe
'cgi options'
do
let
(
:path
)
{
'custom-highlighting/test.gitlab-cgi'
}
it
'highlights as json with erb'
do
expect
(
highlighter
.
lexer
.
tag
).
to
eq
'erb'
expect
(
highlighter
.
lexer
.
parent
.
tag
).
to
eq
'json'
end
end
end
end
spec/support/test_env.rb
View file @
66b37149
...
...
@@ -17,7 +17,7 @@ module TestEnv
"'test'"
=>
'e56497b'
,
'orphaned-branch'
=>
'45127a9'
,
'binary-encoding'
=>
'7b1cf43'
,
'gitattributes'
=>
'
281d3a76'
'gitattributes'
=>
'
5a62481'
,
}
# gitlab-test-fork is a fork of gitlab-fork, but we don't necessarily
...
...
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