Skip to content

Commit

Permalink
use ini lexer for systemd service files (#1849)
Browse files Browse the repository at this point in the history
* use ini lexer for systemd service files

* add more unit file names

* make mapfiles

Co-authored-by: Aku Viljanen <aku.viljanen@puheet.com>
  • Loading branch information
Akuli and Aku Viljanen committed Jul 18, 2021
1 parent 727401e commit 6d9b79e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pygments/lexers/_mapping.py
Expand Up @@ -215,7 +215,7 @@
'Inform6Lexer': ('pygments.lexers.int_fiction', 'Inform 6', ('inform6', 'i6'), ('*.inf',), ()),
'Inform6TemplateLexer': ('pygments.lexers.int_fiction', 'Inform 6 template', ('i6t',), ('*.i6t',), ()),
'Inform7Lexer': ('pygments.lexers.int_fiction', 'Inform 7', ('inform7', 'i7'), ('*.ni', '*.i7x'), ()),
'IniLexer': ('pygments.lexers.configs', 'INI', ('ini', 'cfg', 'dosini'), ('*.ini', '*.cfg', '*.inf'), ('text/x-ini', 'text/inf')),
'IniLexer': ('pygments.lexers.configs', 'INI', ('ini', 'cfg', 'dosini'), ('*.ini', '*.cfg', '*.inf', '*.service', '*.socket', '*.device', '*.mount', '*.automount', '*.swap', '*.target', '*.path', '*.timer', '*.slice', '*.scope'), ('text/x-ini', 'text/inf')),
'IoLexer': ('pygments.lexers.iolang', 'Io', ('io',), ('*.io',), ('text/x-iosrc',)),
'IokeLexer': ('pygments.lexers.jvm', 'Ioke', ('ioke', 'ik'), ('*.ik',), ('text/x-iokesrc',)),
'IrcLogsLexer': ('pygments.lexers.textfmts', 'IRC logs', ('irc',), ('*.weechatlog',), ('text/x-irclog',)),
Expand Down
8 changes: 7 additions & 1 deletion pygments/lexers/configs.py
Expand Up @@ -31,7 +31,13 @@ class IniLexer(RegexLexer):

name = 'INI'
aliases = ['ini', 'cfg', 'dosini']
filenames = ['*.ini', '*.cfg', '*.inf']
filenames = [
'*.ini', '*.cfg', '*.inf',
# systemd unit files
# https://www.freedesktop.org/software/systemd/man/systemd.unit.html
'*.service', '*.socket', '*.device', '*.mount', '*.automount',
'*.swap', '*.target', '*.path', '*.timer', '*.slice', '*.scope',
]
mimetypes = ['text/x-ini', 'text/inf']

tokens = {
Expand Down

0 comments on commit 6d9b79e

Please sign in to comment.