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
This commit is contained in:
Fabian Homborg 2021-04-25 09:42:02 +02:00
parent 981a07d4c7
commit 58885fbd0b

View file

@ -268,7 +268,8 @@ var Search = {
} else { } else {
// normal html builders // normal html builders
requestUrl = DOCUMENTATION_OPTIONS.URL_ROOT + item[0] + DOCUMENTATION_OPTIONS.FILE_SUFFIX; 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($('<a/>').attr('href', listItem.append($('<a/>').attr('href',
linkUrl + linkUrl +