Skip to content

Commit

Permalink
Fix hyphen support in INI lexer
Browse files Browse the repository at this point in the history
  • Loading branch information
KrzysiekJ committed Feb 2, 2016
1 parent d989f18 commit e6af035
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/rouge/lexers/ini.rb
Expand Up @@ -12,10 +12,10 @@ class INI < RegexLexer
mimetypes 'text/x-ini'

def self.analyze_text(text)
return 0.1 if text =~ /\A\[[\w.]+\]\s*\w+=\w+/
return 0.1 if text =~ /\A\[[\w\-.]+\]\s*[\w\-]+=\w+/
end

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

state :basic do
rule /[;#].*?\n/, Comment
Expand Down
4 changes: 4 additions & 0 deletions spec/visual/samples/ini
Expand Up @@ -69,3 +69,7 @@ EGA80WOA.FON=EGA80WOA.FON
EGA40WOA.FON=EGA40WOA.FON
CGA80WOA.FON=CGA80WOA.FON
CGA40WOA.FON=CGA40WOA.FON

## Other ##
[section-name]
foo-bar_ = baz

0 comments on commit e6af035

Please sign in to comment.