From 58885fbd0ba6b2b414bcf897f6226fe5419e2c05 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Sun, 25 Apr 2021 09:42:02 +0200 Subject: [PATCH] docs: Handle undefined LINK_SUFFIX When building the docs with an old sphinx (like e.g. on Debian), this would break links in the search results. This happens because we've nabbed the searchtools.js from a sphinx to add our special handling of short builtins like "and", "end", "cd" (as part of #7757). I don't believe this will change *a lot* in practice, so it's probably still okay, but this hack is still worthwhile. See #7946 --- doc_src/python_docs_theme/static/searchtools.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc_src/python_docs_theme/static/searchtools.js b/doc_src/python_docs_theme/static/searchtools.js index b38a9845a..b451f1ef5 100644 --- a/doc_src/python_docs_theme/static/searchtools.js +++ b/doc_src/python_docs_theme/static/searchtools.js @@ -268,7 +268,8 @@ var Search = { } else { // normal html builders requestUrl = DOCUMENTATION_OPTIONS.URL_ROOT + item[0] + DOCUMENTATION_OPTIONS.FILE_SUFFIX; - linkUrl = item[0] + DOCUMENTATION_OPTIONS.LINK_SUFFIX; + // If LINK_SUFFIX is undefined, default to ".html" - I actually don't see this being anything else. + linkUrl = item[0] + (DOCUMENTATION_OPTIONS.LINK_SUFFIX || ".html"); } listItem.append($('').attr('href', linkUrl +