Commit 0de81bba authored by Stephen Kelly's avatar Stephen Kelly
Browse files

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.
parent 0cf550b2
......@@ -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:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment