diff --git a/lib/rouge/lexers/groovy.rb b/lib/rouge/lexers/groovy.rb index e794427cb1..4c1045870f 100644 --- a/lib/rouge/lexers/groovy.rb +++ b/lib/rouge/lexers/groovy.rb @@ -7,11 +7,13 @@ class Groovy < RegexLexer title "Groovy" desc 'The Groovy programming language (http://www.groovy-lang.org/)' tag 'groovy' - filenames '*.groovy', 'Jenkinsfile', '*.Jenkinsfile' + aliases 'nextflow', 'nf' + filenames '*.groovy', 'Jenkinsfile', '*.Jenkinsfile', '*.nf' mimetypes 'text/x-groovy' def self.detect?(text) return true if text.shebang?(/groovy/) + return true if text.shebang?(/nextflow/) end def self.keywords diff --git a/spec/lexers/groovy_spec.rb b/spec/lexers/groovy_spec.rb index 4f0115f268..e11d8639fa 100644 --- a/spec/lexers/groovy_spec.rb +++ b/spec/lexers/groovy_spec.rb @@ -11,10 +11,16 @@ assert_guess :filename => 'foo.groovy' assert_guess :filename => 'Jenkinsfile' assert_guess :filename => 'foo.Jenkinsfile' + assert_guess :filename => 'foo.nf' end it 'guesses by mimetype' do assert_guess :mimetype => 'text/x-groovy' end + + it "guesses by source" do + assert_guess :source => "#!/usr/bin/env groovy" + assert_guess :source => "#!/usr/bin/env nextflow" + end end end