Comments (9)
FYI @JulienPalard , you can simply transfer this issue directly to that repo
Wow thanks!
from docsbuild-scripts.
from docsbuild-scripts.
Thanks for opening this issue, it's interesting!
It also happen in any other change of whatsnew, but when "decreasing" the version it lands you on the homepage as the target file does not exist.
The page switch is handled client-side via this function:
=> https://github.com/python/docsbuild-scripts/blob/main/templates/switchers.js#L81
so can you please reopen the issue (and or a PR) on the docsbuild-script repo?
from docsbuild-scripts.
FYI @JulienPalard , you can simply transfer this issue directly to that repo with the (not easy to spot) Transfer Issue
button at the bottom of the right sidebar, without having to recreate a whole new one (I can't as a triager, until the forthcoming permissions workaround is implemented):
For me, this is the expected (if not necessarily ideal) behavior, not a "bad redirection" per say—each What's New is its own separate page, and there is no one "current version" What's New page, so naturally switching between different branches gets that branch's version of that What's New page,
What this issue is really requesting is not a bug fix, but rather an enhancement to the behavior of the version switcher, to add special-case logic to more "intelligently" handle switching between "What's New" pages of different Python versions in a way that is more useful to most users. Of course, its more complicated than the issue initially implies, as there are a number of cases to consider and its not completely obvious what the ideal logic should be in every case, but if @JulienPalard thinks its worth it, then it would be an improvement. cc @hugovk
If so, I propose the following logic, in psuedocode:
# If on the What's New for the current Python version,
# Navigate to the selected Python version's What's New page
if current_version == current_whatsnew_version:
new_whatsnew_version = selected_version
# If the selected version is too early to have the current What's New version
# fall back to the latest What's New version present (i.e. that version's)
elif selected_version > whatsnew_version:
new_whatsnew_version = selected_version
# Otherwise, just keep the same What's New version, as now
else:
new_whatsnew_version = whatsnew_version
One possible design for the implementation:
- Add a function
get_whatsnew_version()
that takes aurl
, and returns the capture group in/whatsnew/(\d\d?\.\d\d?)
, or elsenull
(or some falsely value) - Add a function
switch_whatsnew_version()
that takes the current, selected and what's new versions,.split('.')
s them into arrays, applies the above logic (since JS array comparisons appear to work like Python tuple comparisons) and then returns the new what's new version re-knit into a string. - Add a function
set_whatsnew_version()
that takes aurl
and the newwhatsnew_version
and returns the the URL with/whatsnew/\d\d?\.\d\d?
replaced with the new version. - Either stick all those into one function and call it from
on_version_switch
, or callget_whatsnew_version
there and then call the other two in sequence to replaceurl
if the result of the first is truthy
from docsbuild-scripts.
Yeah, I've experienced this and found it a little surprising, albeit logical when you think about it for a moment.
I think the common case would to expect a "sticky" What's New, as suggested.
from docsbuild-scripts.
I think we all agree that something better can be implemented.
I'm not sure we need to complicate things more than just navigating to f"{selected_version}/whatsnew/{selected_version}.html"
, after all:
- It's simple and predictible.
- The page always exists.
- If the reader choose a version from the picker while reading a whatsnew, it's highly probable that he wanted to see the choosen version (am I wrong?).
from docsbuild-scripts.
I certainly understand the desire to not complicate the logic, which was my one concern with this proposal to begin with.
That's essentially what the above proposed implementation boils down to (in perhaps a dozen or so total lines of JS for the whole thing), except that if the reader is browsing a What's New that isn't the current version's, and exists on the target, the What's New version isn't touched, as it wouldn't make sense to arbitrarily change it (given the reader deliberately navigated to that older version, which I would view as a regression).
from docsbuild-scripts.
I completely agree with @JulienPalard what I wanted here and what I think everyone wants is to be redirected to the version they want.
When I arrived on the Whatsnew of 3.11 and I saw that the version 3.12 was available in alpha I said to myself I want to see the news about 3.12
So I think the best thing would be to keep it simple like Julien suggested in his message :)
from docsbuild-scripts.
See also python/cpython#100734.
from docsbuild-scripts.
Related Issues (20)
- Deleted file still on 3.11 docs HOT 1
- blurb now needs python >= 3.7 HOT 1
- Show "PDF are currently being built" instead of a 404
- documentation_options.js not invalidated when symlink changes
- Generate separate pages for every individual free function and class HOT 2
- 3.10 docs render incorrectly HOT 2
- Get URL's version number inside conf.py? HOT 7
- How to add Sphinx extensions to the docs? HOT 3
- Japanese translation has not been updated since 2022-08-01 HOT 5
- Deploying extra images with docs HOT 2
- Note on progress on not completed translations HOT 11
- switchers.js not compatible with Sphinx 6 / requires jQuery
- Increase the build frequency of English HTML stable (and pre-release?) documentation HOT 6
- Translations do not redirect to 3.12 HOT 3
- Full build with PDF is taking more than 24h HOT 29
- Track output of `check_versions.py` in a GitHub Actions workflow's job summary HOT 1
- Skip cache invalidation not used in symlink()
- Dev docs not updating HOT 2
- make logs public? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docsbuild-scripts.