summaryrefslogtreecommitdiff
path: root/doc/source/conf.py
diff options
context:
space:
mode:
authormattip <matti.picus@gmail.com>2020-09-16 16:14:14 +0300
committermattip <matti.picus@gmail.com>2020-09-16 16:14:14 +0300
commita182f32c77e557cadb0cd70f788e17c14671d171 (patch)
treeb0eff5bb2fd0cee7967ba59ef61ab4656d063c5b /doc/source/conf.py
parentbd263912e11f7f79310c5516fab6bd0a7b7c8eb9 (diff)
downloadnumpy-a182f32c77e557cadb0cd70f788e17c14671d171.tar.gz
DOC, BLD: fix templated C highlighting
Diffstat (limited to 'doc/source/conf.py')
-rw-r--r--doc/source/conf.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/doc/source/conf.py b/doc/source/conf.py
index e34be7f5c..032e828ce 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -367,15 +367,15 @@ def linkcode_resolve(domain, info):
numpy.__version__, fn, linespec)
from pygments.lexers import CLexer
-import copy
+from pygments.lexer import inherit, bygroups
+from pygments.token import Comment
class NumPyLexer(CLexer):
name = 'NUMPYLEXER'
- tokens = copy.deepcopy(CLexer.tokens)
- # Extend the regex for valid identifiers with @
- for k, val in tokens.items():
- for i, v in enumerate(val):
- if isinstance(v, tuple):
- if isinstance(v[0], str):
- val[i] = (v[0].replace('a-zA-Z', 'a-zA-Z@'),) + v[1:]
+ tokens = {
+ 'statements': [
+ (r'@[a-zA-Z_]*@', Comment.Preproc, 'macro'),
+ inherit,
+ ],
+ }