diff --git a/doc/cmake.py b/doc/cmake.py index 6075cf5a75c6a62eba1bf43be6d153cf12c6a653..2bdb01c9dc68dd650bdb4c387d06d0abcfae705a 100644 --- a/doc/cmake.py +++ b/doc/cmake.py @@ -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