Skip to content
Snippets Groups Projects
Commit 66b37149 authored by http://jneen.net/'s avatar http://jneen.net/
Browse files

support cgi style options, such as erb?parent=json

parent e7b512ef
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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 = {})
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment