From cf8aa0121ec8b6f63c3f22577c7a56facd26d9f2 Mon Sep 17 00:00:00 2001 From: Tan Le Date: Wed, 18 Sep 2024 12:09:32 +1000 Subject: [PATCH] Add more extensions and mimetypes for INI lexer --- lib/rouge/lexers/ini.rb | 5 ++--- spec/lexers/ini_spec.rb | 3 +++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/rouge/lexers/ini.rb b/lib/rouge/lexers/ini.rb index ae5464ba5e..86adb3826c 100644 --- a/lib/rouge/lexers/ini.rb +++ b/lib/rouge/lexers/ini.rb @@ -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\-.]+/ diff --git a/spec/lexers/ini_spec.rb b/spec/lexers/ini_spec.rb index fa1f6c3f84..adb776a85c 100644 --- a/spec/lexers/ini_spec.rb +++ b/spec/lexers/ini_spec.rb @@ -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/x-inf' end end end