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:
Stephen Kelly 2013-12-26 07:49:20 +01:00
parent 0cf550b2ca
commit 0de81bba8c
1 changed files with 10 additions and 0 deletions

View File

@ -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: