1
Fork 0

rustdoc: clean up the layout for annotated version numbers

This should result in a layout for the actual standard library,
when built on CI, that looks like this:

    _____
   /     \ std
   |  R  | 1.74.0-nightly
   \_____/

   (203c57dbe 2023-09-17)

Having the whole version as one string caused it to flex wrap,
because the sidebar isn't wide enough to fit the whole thing.
This commit is contained in:
Michael Howell 2023-09-18 17:48:18 -07:00
parent 957c5db6be
commit 6d6fa792ff
6 changed files with 23 additions and 6 deletions

View file

@ -51,12 +51,13 @@ function setMobileTopbar() {
// but with the current code it's hard to get the right information in the right place.
const mobileTopbar = document.querySelector(".mobile-topbar");
const locationTitle = document.querySelector(".sidebar h2.location");
if (mobileLocationTitle) {
if (mobileTopbar) {
const mobileTitle = document.createElement("h2");
mobileTitle.className = "location";
if (hasClass(document.body, "crate")) {
mobileLocationTitle.innerText = `Crate ${window.currentCrate}`;
mobileTitle.innerText = `Crate ${window.currentCrate}`;
} else if (locationTitle) {
mobileLocationTitle.innerHTML = locationTitle.innerHTML;
mobileTitle.innerHTML = locationTitle.innerHTML;
}
mobileTopbar.appendChild(mobileTitle);
}