Skip to content

Commit

Permalink
Fix syntax highlighting of INI language doesn't parse comments presen…
Browse files Browse the repository at this point in the history
…t on same line #2161
  • Loading branch information
jmzambon committed Aug 26, 2022
1 parent cbc7143 commit 79bf469
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pygments/lexers/configs.py
Expand Up @@ -46,7 +46,7 @@ class IniLexer(RegexLexer):
(r'\s+', Whitespace),
(r'[;#].*', Comment.Single),
(r'\[.*?\]$', Keyword),
(r'(.*?)([ \t]*)(=)([ \t]*)([^\t\n]*)',
(r'(.*?)([  \t]*)(=)([  \t]*)([^;#\n]*)',
bygroups(Name.Attribute, Whitespace, Operator, Whitespace, String)),
# standalone option, supported by some INI parsers
(r'(.+?)$', Name.Attribute),
Expand Down
4 changes: 2 additions & 2 deletions tests/examplefiles/ini/test.ini
@@ -1,7 +1,7 @@
[section]

foo = bar
continued = foo
foo = bar ; inline comment
continued = foo # inline comment
baz
conttwo =
foo
Expand Down
6 changes: 4 additions & 2 deletions tests/examplefiles/ini/test.ini.output

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 79bf469

Please sign in to comment.