summaryrefslogtreecommitdiffstats
path: root/Utilities/Sphinx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-12-26 06:49:20 (GMT)
committerStephen Kelly <steveire@gmail.com>2014-01-04 10:28:56 (GMT)
commit0de81bba8ca5a4fedace010a88027591071cde36 (patch)
treee2451870c9bdbb2d9f5fdeed69c818497ed5829f /Utilities/Sphinx
parent0cf550b2ca500be0e3dffc47be92438d3e789b81 (diff)
downloadCMake-0de81bba8ca5a4fedace010a88027591071cde36.zip
CMake-0de81bba8ca5a4fedace010a88027591071cde36.tar.gz
CMake-0de81bba8ca5a4fedace010a88027591071cde36.tar.bz2
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.
Diffstat (limited to 'Utilities/Sphinx')
-rw-r--r--Utilities/Sphinx/cmake.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Utilities/Sphinx/cmake.py b/Utilities/Sphinx/cmake.py
index 1955e42..336c74a 100644
--- a/Utilities/Sphinx/cmake.py
+++ b/Utilities/Sphinx/cmake.py
@@ -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: