lib/rouge/lexers/shell.rb in rouge-0.0.6 vs lib/rouge/lexers/shell.rb in rouge-0.0.7
- old
+ new
@@ -1,10 +1,15 @@
module Rouge
module Lexers
- class ShellLexer < RegexLexer
+ class Shell < RegexLexer
tag 'shell'
aliases 'bash', 'zsh', 'ksh', 'sh'
- extensions 'sh', 'bash', 'zsh', 'ksh'
+ filenames '*.sh', '*.bash', '*.zsh', '*.ksh'
+ mimetypes 'application/x-sh', 'application/x-shellscript'
+
+ def self.analyze_text(text)
+ text.shebang?(/(ba|z|k)?sh/) ? 1 : 0
+ end
KEYWORDS = %w(
if fi else while do done for then return function
select continue until esac elif in
).join('|')