Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 71dd8bf

Browse files
committed
HTML: Add sourcelink_suffix to globalcontext
1 parent 71e1aaf commit 71dd8bf

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

sphinx/builders/html.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ def prepare_writing(self, docnames):
339339
show_sphinx = self.config.html_show_sphinx,
340340
has_source = self.config.html_copy_source,
341341
show_source = self.config.html_show_sourcelink,
342+
sourcelink_suffix = self.config.html_sourcelink_suffix,
342343
file_suffix = self.out_suffix,
343344
script_files = self.script_files,
344345
language = self.config.language,

sphinx/themes/basic/layout.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ <h3>{{ _('Navigation') }}</h3>
9191
VERSION: '{{ release|e }}',
9292
COLLAPSE_INDEX: false,
9393
FILE_SUFFIX: '{{ '' if no_search_suffix else file_suffix }}',
94-
HAS_SOURCE: {{ has_source|lower }}
94+
HAS_SOURCE: {{ has_source|lower }},
95+
SOURCELINK_SUFFIX: '{{ sourcelink_suffix }}'
9596
};
9697
</script>
9798
{%- for scriptfile in script_files %}

sphinx/themes/basic/static/searchtools.js_t

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,8 @@ var Search = {
256256
displayNextItem();
257257
});
258258
} else if (DOCUMENTATION_OPTIONS.HAS_SOURCE) {
259-
$.ajax({url: DOCUMENTATION_OPTIONS.URL_ROOT + '_sources/' + item[5] + (item[5].endsWith('.txt') ? '' : '.txt'),
259+
var suffix = DOCUMENTATION_OPTIONS.SOURCELINK_SUFFIX;
260+
$.ajax({url: DOCUMENTATION_OPTIONS.URL_ROOT + '_sources/' + item[5] + (item[5].endsWith(suffix) ? '' : suffix),
260261
dataType: "text",
261262
complete: function(jqxhr, textstatus) {
262263
var data = jqxhr.responseText;

0 commit comments

Comments
 (0)