summaryrefslogtreecommitdiff
path: root/Utilities/Sphinx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-12-26 07:49:20 +0100
committerStephen Kelly <steveire@gmail.com>2014-01-04 11:28:56 +0100
commit0de81bba8ca5a4fedace010a88027591071cde36 (patch)
treee2451870c9bdbb2d9f5fdeed69c818497ed5829f /Utilities/Sphinx
parent0cf550b2ca500be0e3dffc47be92438d3e789b81 (diff)
downloadcmake-0de81bba8ca5a4fedace010a88027591071cde36.tar.gz
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 1955e42957..336c74aa3a 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: