Skip to content

Commit

Permalink
Add more extensions and mimetypes for INI lexer
Browse files Browse the repository at this point in the history
  • Loading branch information
tancnle committed Sep 18, 2024
1 parent 7b993a3 commit 4d24220
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/rouge/lexers/ini.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ class INI < RegexLexer
desc 'the INI configuration format'
tag 'ini'

# TODO add more here
filenames '*.ini', '*.INI', '*.gitconfig', '*.cfg'
mimetypes 'text/x-ini'
filenames '*.ini', '*.INI', '*.gitconfig', '*.cfg', '.editorconfig', '*.inf'
mimetypes 'text/x-ini', 'text/inf'

identifier = /[\w\-.]+/

Expand Down
3 changes: 3 additions & 0 deletions spec/lexers/ini_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@
assert_guess :filename => 'foo.ini'
assert_guess :filename => '.gitconfig'
assert_guess :filename => 'setup.cfg', :source => "[metadata]\nname = my_package"
assert_guess :filename => '.editorconfig'
assert_guess :filename => 'request.inf'
end

it 'guesses by mimetype' do
assert_guess :mimetype => 'text/x-ini'
assert_guess :mimetype => 'text/inf'
end
end
end

0 comments on commit 4d24220

Please sign in to comment.