Skip to content
Snippets Groups Projects
Commit 126af66b authored by Studer Gabriel's avatar Studer Gabriel
Browse files

update doc/cmake.py - resolves import errors observed in sphinx 4.3.2

parent e443aba5
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,8 @@
# file Copyright.txt or https://cmake.org/licensing for details.
# Team SMNG note: This file comes from here: https://github.com/Kitware/CMake/blob/master/Utilities/Sphinx/cmake.py
# Team SMNG note: applied patch from here: https://salsa.debian.org/science-team/ycm-cmake-modules/-/blob/master/debian/patches/fix-sphinx-build.patch
# On Ubuntu 22.04 LTS I needed to additionally install the following package: python3-sphinxcontrib.qthelp
import os
import re
......@@ -61,8 +63,12 @@ CMakeLexer.tokens["root"] = [
# 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
import html
try:
from sphinxcontrib.qthelp import QtHelpBuilder
except ImportError:
# sphinx < 4.0
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)
......@@ -71,7 +77,7 @@ def new_build_keywords(self, title, refs, subitems):
before, rest = item.split("ref=\"", 1)
ref, after = rest.split("\"")
if ("<" in ref and ">" in ref):
new_items.append(before + "ref=\"" + htmlescape(ref) + "\"" + after)
new_items.append(before + "ref=\"" + html.escape(ref) + "\"" + after)
else:
new_items.append(item)
return new_items
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment