From 18f5c767bceb54326669d0683799b1a9378b9a31 Mon Sep 17 00:00:00 2001
From: Guillaume Gomez
Date: Mon, 15 Aug 2016 16:18:53 +0200
Subject: [PATCH] Center content of the generated docs
---
src/librustdoc/html/layout.rs | 2 +-
src/librustdoc/html/static/main.js | 8 ++++----
src/librustdoc/html/static/rustdoc.css | 18 ++++++++++++------
3 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs
index 265ed6be1552d..f345f5f6f40d2 100644
--- a/src/librustdoc/html/layout.rs
+++ b/src/librustdoc/html/layout.rs
@@ -80,7 +80,7 @@ r##"
-
+
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index 68035e5abe4c2..e90d6e88885f9 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -617,7 +617,7 @@
}
output += "
";
- $('#main.content').addClass('hidden');
+ $('#main>div.content').addClass('hidden');
$('#search.content').removeClass('hidden').html(output);
$('#search .desc').width($('#search').width() - 40 -
$('#search td:first-child').first().width());
@@ -748,7 +748,7 @@
if (browserSupportsHistoryApi()) {
history.replaceState("", "std - Rust", "?search=");
}
- $('#main.content').removeClass('hidden');
+ $('#main>div.content').removeClass('hidden');
$('#search.content').addClass('hidden');
} else {
searchTimeout = setTimeout(search, 500);
@@ -779,7 +779,7 @@
// When browsing back from search results the main page
// visibility must be reset.
if (!params.search) {
- $('#main.content').removeClass('hidden');
+ $('#main>div.content').removeClass('hidden');
$('#search.content').addClass('hidden');
}
// Revert to the previous title manually since the History
@@ -1002,7 +1002,7 @@
.css('display', 'none')
.html(' Expand description'));
var wrapper = $("").append(mainToggle);
- $("#main > .docblock").before(wrapper);
+ $("#main > div > .docblock").before(wrapper);
});
$('pre.line-numbers').on('click', 'span', function() {
diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css
index de0457592fc88..4a1ab2fff0919 100644
--- a/src/librustdoc/html/static/rustdoc.css
+++ b/src/librustdoc/html/static/rustdoc.css
@@ -157,11 +157,6 @@ img {
min-width: 70em;
}
-nav.sub {
- font-size: 16px;
- text-transform: uppercase;
-}
-
.sidebar {
width: 200px;
position: absolute;
@@ -172,6 +167,12 @@ nav.sub {
.content, nav { max-width: 960px; }
+nav.sub {
+ font-size: 16px;
+ text-transform: uppercase;
+ max-width: none;
+}
+
/* Everything else */
.js-only, .hidden { display: none !important; }
@@ -299,7 +300,12 @@ h4 > code, h3 > code {
}
#main { position: relative; }
-#main > .since {
+#main > div {
+ margin-left: auto;
+ margin-right: auto;
+ position: relative;
+}
+#main > div > .since {
top: inherit;
font-family: "Fira Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}