Help: Workaround pygments reporting an error for genexes.
Without the workaround, CMake code snippets are not highlighted at all because pygments can not lex the generator expressions.
This commit is contained in:
parent
0cf550b2ca
commit
0de81bba8c
|
@ -12,6 +12,16 @@
|
|||
import os
|
||||
import re
|
||||
|
||||
# Monkey patch for pygments reporting an error when generator expressions are
|
||||
# used.
|
||||
# https://bitbucket.org/birkenfeld/pygments-main/issue/942/cmake-generator-expressions-not-handled
|
||||
from pygments.lexers import CMakeLexer
|
||||
from pygments.token import Name, Operator
|
||||
from pygments.lexer import bygroups
|
||||
CMakeLexer.tokens["args"].append(('(\\$<)(.+?)(>)',
|
||||
bygroups(Operator, Name.Variable, Operator)))
|
||||
|
||||
|
||||
from docutils.parsers.rst import Directive, directives
|
||||
from docutils.transforms import Transform
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue