summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/easyfloats/doc/lexer/latex_atletter.py
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/easyfloats/doc/lexer/latex_atletter.py')
-rw-r--r--macros/latex/contrib/easyfloats/doc/lexer/latex_atletter.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/macros/latex/contrib/easyfloats/doc/lexer/latex_atletter.py b/macros/latex/contrib/easyfloats/doc/lexer/latex_atletter.py
new file mode 100644
index 0000000000..41670d07a8
--- /dev/null
+++ b/macros/latex/contrib/easyfloats/doc/lexer/latex_atletter.py
@@ -0,0 +1,17 @@
+#!/usr/bin/env python
+
+# Copyright © 2020 E. Zöllner
+# Alternatively to the terms of the LPPL, at your choice,
+# you can redistribute and/or modify this file under the
+# terms of the Do What The Fuck You Want To Public License, Version 2,
+# as published by Sam Hocevar. See http://www.wtfpl.net/about/.
+
+from pygments.lexers.markup import TexLexer
+
+re_cmd = r'\\([a-zA-Z@]+|.)'
+
+tokens_root = TexLexer.tokens['root']
+t = next(t for t in tokens_root if 'command' in t)
+i = tokens_root.index(t)
+t = (re_cmd,) + t[1:]
+tokens_root[i] = t