mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Make searchtools.js compatible with pre-Sphinx1.5 templates
There are still plenty of projects which use custom templates where DOCUMENTATION_OPTIONS does not define SOURCELINK_SUFFIX. Currently search does not work in these projects. Make suffix fall back to .txt since that is the default value of configuration option.
This commit is contained in:
parent
3ec2a649b4
commit
9da3bf93ff
@ -269,6 +269,9 @@ var Search = {
|
||||
});
|
||||
} else if (DOCUMENTATION_OPTIONS.HAS_SOURCE) {
|
||||
var suffix = DOCUMENTATION_OPTIONS.SOURCELINK_SUFFIX;
|
||||
if (suffix === undefined) {
|
||||
suffix = '.txt';
|
||||
}
|
||||
$.ajax({url: DOCUMENTATION_OPTIONS.URL_ROOT + '_sources/' + item[5] + (item[5].slice(-suffix.length) === suffix ? '' : suffix),
|
||||
dataType: "text",
|
||||
complete: function(jqxhr, textstatus) {
|
||||
|
Loading…
Reference in New Issue
Block a user