From 6d6fa792fffa6e22eec1b30cedee6e8306d0df64 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Mon, 18 Sep 2023 17:48:18 -0700 Subject: 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. --- src/librustdoc/html/static/css/rustdoc.css | 1 + src/librustdoc/html/static/js/main.js | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src/librustdoc/html/static') diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 6a6747affb2..5e1bccb9b5b 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -492,6 +492,7 @@ ul.block, .block li { } .sidebar-elems, +.sidebar > .version, .sidebar > h2 { padding-left: 24px; } diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js index 5e852af2196..25e9da57a05 100644 --- a/src/librustdoc/html/static/js/main.js +++ b/src/librustdoc/html/static/js/main.js @@ -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); } -- cgit 1.4.1-3-g733a5