-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Add version switcher #58603
Add version switcher #58603
Conversation
cc #44687 @rust-lang/docs |
It's not complete yet. I'm not really satisfied on how I handle the raw HTML. I think that I'll create "temporary" files instead and reference to them. |
8883159
to
555a07b
Compare
This comment has been minimized.
This comment has been minimized.
555a07b
to
6800c29
Compare
It's now ready for review. |
This comment has been minimized.
This comment has been minimized.
6800c29
to
e3c5018
Compare
This comment has been minimized.
This comment has been minimized.
e3c5018
to
7799379
Compare
This comment has been minimized.
This comment has been minimized.
7799379
to
e99ab4e
Compare
Finally fixed! \o/ |
ping @rust-lang/docs |
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.
🥇
let mut middle_version = i32::from_str_radix(version_parts[1], 10).expect("unknown number"); | ||
|
||
while middle_version >= 0 { | ||
versions.push(format!("\"1.{}.0\"", middle_version)); |
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.
would be cool if we could also add bugfix releases in here, but that might be hard
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.
Bugfixes don't change API normally so I'm not sure it's really useful to add them in here.
ping @frewsxcv |
I haven't approved a rustdoc PR before and am not familiar with the source so I don't feel comfortable approving this |
I'll need to give this PR an actual read-through, but i wanted to make sure that this didn't derail the discussion that was happening on #44687 last year. I don't remember the specifics of that discussion (it's been a while), but this seems like a different approach than the people in that thread were considering. If it achieves the same goals, then we can fold it into that effort. But this came up independently, so i want to make sure it's not getting in the way. |
From my point of view, it doesn't prevent the #44687 to happen if they think it's not solving the issue but I'm always glad to wait for reviews coming from you. :) |
src/librustdoc/lib.rs
Outdated
@@ -201,6 +201,18 @@ fn opts() -> Vec<RustcOptGroup> { | |||
Markdown file or generated documentation", | |||
"FILES") | |||
}), | |||
unstable("raw-js-in-header", |o| { | |||
o.optopt("", "raw-js-in-header", |
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.
Bikeshed warning: Since the included file eventually gets named additional.js
/additional.css
, i feel like these flags would be better named --additional-js
/--additional-css
.
I also feel like the flag description is a little misleading. Maybe something like:
(JS|CSS) file to include as a static file to be linked from generated documentation
(I feel like this feature would be much better served if it allowed multiple files, but that can be added in a separate PR. Since the flag will be unstable, we can edit it after it lands.)
627d477
to
c0b54dc
Compare
I would've expected the version selector to be injected by the server running on doc.rust-lang.org because it needs to be injected into the older docs as well as all of the books. It will also need to be kept up to date with the list of released stable versions. |
The files are just generated then copied into the server. There is nothing dynamic in there. The only thing we can do is injecting the JS/CSS content required to have it. |
☔ The latest upstream changes (presumably #59447) made this pull request unmergeable. Please resolve the merge conflicts. |
ping from triage @rust-lang/docs |
Nominating to move this forward |
I don't think it'll. It needs to be added directly to the website so it has nothing to do in rustdoc directly. Closing it. |
Fixes #58190.
r? @QuietMisdreavus