-
Notifications
You must be signed in to change notification settings - Fork 81
Script to warn when viewing version other than stable #13
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
(function() { | ||
var latestStable = '0.21'; | ||
var goodPaths = ['stable', 'dev', latestStable]; | ||
var showWarning = (msg) => { | ||
$('.body[role=main]').prepend( | ||
'<p style="' + | ||
[ | ||
'padding: 1em', | ||
'font-size: 1.5em', | ||
'border: 1px solid red', | ||
'background: pink', | ||
'width: 100%', | ||
].join('; ') + | ||
'">' + msg + '</p>') | ||
}; | ||
if (location.hostname == 'scikit-learn.org') { | ||
var versionPath = location.pathname.split('/')[1]; | ||
if (!goodPaths.includes(versionPath)) { | ||
showWarning('This is documentation for an old release of ' + | ||
'Scikit-learn (version ' + versionPath + '). Try the ' + | ||
'<a href="https://scikit-learn.org">latest stable ' + | ||
'release</a> (version ' + latestStable + ') or ' + | ||
'<a href="https://scikit-learn.org/dev">development</a> ' + | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure for putting the dev on outdated versions. Few users need it and it can lead to confusion. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm, the dev version would be nice if we also tell people that they can have it through the nightly wheels. We would also get more testers before the release that way. I wouldn't mind that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you mean that the warning shown on dev should point the user to installation instructions? Nice idea There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with @rth about not strictly encouraging the dev docs. Maybe we can make it clearer with
And yes linking to installation instructions on the dev version would be great too |
||
'(unstable) versions.') | ||
} else if (versionPath == 'dev') { | ||
showWarning('This is documentation for the unstable ' + | ||
'development version of Scikit-learn. (To use it, ' + | ||
'<a href="https://scikit-learn.org/stable/developers/advanced_installation.html#installing-nightly-builds">install the nightly build</a>.) ' + | ||
'The latest stable ' + | ||
'release is <a href="https://scikit-learn.org">version ' + | ||
latestStable + '</a>.') | ||
} | ||
} | ||
})() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This specific line makes the box non mobile-phone friendly (it creates a horizontal scroll by extending out of the viewport). It is not needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opened the following PR to address this problem: #14