Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci] Fix version matching between RTD pages and R-package pages #6673

Merged
merged 7 commits into from
Oct 29, 2024
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 7 additions & 12 deletions docs/_static/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,16 @@ $(function() {

/* List each class property item on a new line
https://github.com/microsoft/LightGBM/issues/5073 */
if(window.location.pathname.toLocaleLowerCase().indexOf('pythonapi') != -1) {
if(window.location.pathname.toLocaleLowerCase().indexOf('pythonapi') !== -1) {
$('.py.property').each(function() { this.style.setProperty('display', 'inline', 'important'); });
}

/* Point to the same version of R API as the current docs version */
var current_version_elems = $('.rst-current-version');
if(current_version_elems.length !== 0) {
var current_version = $(current_version_elems[0]).contents().filter(function() {
return this.nodeType == 3;
}).text().trim().split(' ').pop();
if(current_version !== 'latest') {
$('a.reference.external[href$="/latest/R/reference/"]').each(function() {
$(this).attr('href', function (_, val) { return val.replace('/latest/', '/' + current_version + '/'); });
});
}
/* Point to the same version of R API as the current docs branch */
var current_branch = window.location.pathname.toLocaleLowerCase().split('/')[2];
if(current_branch !== 'latest') {
$('a.reference.external[href$="/latest/R/reference/"]').each(function() {
$(this).attr('href', function (_, val) { return val.replace('/latest/', '/' + current_branch + '/'); });
});
}

/* Collapse specified sections in the installation guide */
Expand Down
Loading