| 1 |
#!/usr/bin/env python |
| 2 |
|
| 3 |
# Copyright © 2020 E. Zöllner |
| 4 |
# Alternatively to the terms of the LPPL, at your choice, |
| 5 |
# you can redistribute and/or modify this file under the |
| 6 |
# terms of the Do What The Fuck You Want To Public License, Version 2, |
| 7 |
# as published by Sam Hocevar. See http://www.wtfpl.net/about/. |
| 8 |
|
| 9 |
from pygments.lexers.markup import TexLexer |
| 10 |
|
| 11 |
re_cmd = r'\\([a-zA-Z@]+|.)' |
| 12 |
|
| 13 |
tokens_root = TexLexer.tokens['root'] |
| 14 |
t = next(t for t in tokens_root if 'command' in t) |
| 15 |
i = tokens_root.index(t) |
| 16 |
t = (re_cmd,) + t[1:] |
| 17 |
tokens_root[i] = t |