diff options
author | Stephen Kelly <steveire@gmail.com> | 2014-03-31 13:44:27 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2014-03-31 21:55:08 (GMT) |
commit | 85582d14fe19ba3d66c49ec95286bcaf7c675ca4 (patch) | |
tree | b6abe26c48b8699677b94108843048d4de118be9 /Utilities/Sphinx/cmake.py | |
parent | 521b930bf4e211735842e71f1eb0018c2184a05f (diff) | |
download | CMake-85582d14fe19ba3d66c49ec95286bcaf7c675ca4.zip CMake-85582d14fe19ba3d66c49ec95286bcaf7c675ca4.tar.gz CMake-85582d14fe19ba3d66c49ec95286bcaf7c675ca4.tar.bz2 |
Help: Add option to create and install Qt .qch file.
Diffstat (limited to 'Utilities/Sphinx/cmake.py')
-rw-r--r-- | Utilities/Sphinx/cmake.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Utilities/Sphinx/cmake.py b/Utilities/Sphinx/cmake.py index 336c74a..2d83376 100644 --- a/Utilities/Sphinx/cmake.py +++ b/Utilities/Sphinx/cmake.py @@ -21,6 +21,24 @@ from pygments.lexer import bygroups CMakeLexer.tokens["args"].append(('(\\$<)(.+?)(>)', bygroups(Operator, Name.Variable, Operator))) +# Monkey patch for sphinx generating invalid content for qcollectiongenerator +# https://bitbucket.org/birkenfeld/sphinx/issue/1435/qthelp-builder-should-htmlescape-keywords +from sphinx.util.pycompat import htmlescape +from sphinx.builders.qthelp import QtHelpBuilder +old_build_keywords = QtHelpBuilder.build_keywords +def new_build_keywords(self, title, refs, subitems): + old_items = old_build_keywords(self, title, refs, subitems) + new_items = [] + for item in old_items: + before, rest = item.split("ref=\"", 1) + ref, after = rest.split("\"") + if ("<" in ref and ">" in ref): + new_items.append(before + "ref=\"" + htmlescape(ref) + "\"" + after) + else: + new_items.append(item) + return new_items +QtHelpBuilder.build_keywords = new_build_keywords + from docutils.parsers.rst import Directive, directives from docutils.transforms import Transform |