about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAdrien Tétar <adri-from-59@hotmail.fr>2014-04-25 17:34:32 +0900
committerAdrien Tétar <adri-from-59@hotmail.fr>2014-04-25 18:04:59 +0900
commitb3577a10f35ef237e2cad7cc3f1947d2218f0ee4 (patch)
tree45407758eecf771486f6f218d6c4500ba302271d
parentc9d995d384f795af96bd4a435539656c97eecdc6 (diff)
downloadrust-b3577a10f35ef237e2cad7cc3f1947d2218f0ee4.tar.gz
rust-b3577a10f35ef237e2cad7cc3f1947d2218f0ee4.zip
rustdoc: bring it inline
-rw-r--r--src/doc/rust.css21
-rw-r--r--src/librustdoc/html/render.rs28
-rw-r--r--src/librustdoc/html/static/main.css17
3 files changed, 30 insertions, 36 deletions
diff --git a/src/doc/rust.css b/src/doc/rust.css
index b9dd7d42fe0..d60dd54a67d 100644
--- a/src/doc/rust.css
+++ b/src/doc/rust.css
@@ -41,7 +41,7 @@
     src: local('Heuristica Bold'), url("Heuristica-Bold.woff") format('woff');
 }
 
-* {
+*:not(body) {
   -webkit-box-sizing: border-box;
      -moz-box-sizing: border-box;
           box-sizing: border-box;
@@ -78,16 +78,6 @@ h1, h2, h3 {
 h1 {
     margin-bottom: 20px;
 }
-@media (min-width: 1170px) {
-    h1 {
-        margin-top: 40px;
-        margin-bottom: 30px;
-    }
-    h1, h2, h3 {
-        margin-top: 30px;
-        margin-bottom: 15px;
-    }
-}
 h4, h5, h6 {
     margin-top: 12px;
     margin-bottom: 10px;
@@ -197,7 +187,6 @@ pre, code {
 }
 pre {
     border-left: 2px solid #eee;
-    border-radius: 0;
     white-space: pre-wrap;
     padding: 14px;
     padding-right: 0;
@@ -209,14 +198,12 @@ pre {
 code {
     padding: 0 2px;
     color: #8D1A38;
-    white-space: nowrap;
+    white-space: pre-wrap;
 }
 pre code {
     padding: 0;
     font-size: inherit;
     color: inherit;
-    white-space: pre-wrap;
-    background-color: transparent;
 }
 
 /* Code highlighting */
@@ -237,7 +224,7 @@ pre.rust .lifetime { color: #B76514; }
     margin: 0.5em;
     font-size: 1.1em;
 }
-@media (min-width: 768px) {
+@media (min-width: 992px) {
     #versioninfo {
         font-size: 0.8em;
         position: fixed;
@@ -248,7 +235,7 @@ pre.rust .lifetime { color: #B76514; }
         background-color: #fff;
         margin: 2px;
         padding: 0 2px;
-        border-radius: .3em;
+        border-radius: .2em;
     }
 }
 #versioninfo a.hash {
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index d65876a1c83..539eb42305c 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -924,19 +924,6 @@ impl<'a> Item<'a> {
 
 impl<'a> fmt::Show for Item<'a> {
     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
-        match attr::find_stability(self.item.attrs.iter()) {
-            Some(ref stability) => {
-                try!(write!(fmt.buf,
-                       "<a class='stability {lvl}' title='{reason}'>{lvl}</a>",
-                       lvl = stability.level.to_str(),
-                       reason = match stability.text {
-                           Some(ref s) => (*s).clone(),
-                           None => InternedString::new(""),
-                       }));
-            }
-            None => {}
-        }
-
         // Write the breadcrumb trail header for the top
         try!(write!(fmt.buf, "\n<h1 class='fqn'>"));
         match self.item.inner {
@@ -964,6 +951,21 @@ impl<'a> fmt::Show for Item<'a> {
         try!(write!(fmt.buf, "<a class='{}' href=''>{}</a>",
                       shortty(self.item), self.item.name.get_ref().as_slice()));
 
+        // Write stability attributes
+        match attr::find_stability(self.item.attrs.iter()) {
+            Some(ref stability) => {
+                try!(write!(fmt.buf,
+                       "<a class='stability {lvl}' title='{reason}'>{lvl}</a>",
+                       lvl = stability.level.to_str(),
+                       reason = match stability.text {
+                           Some(ref s) => (*s).clone(),
+                           None => InternedString::new(""),
+                       }));
+            }
+            None => {}
+        }
+
+        // Write `src` tag
         if self.cx.include_sources {
             let mut path = Vec::new();
             clean_srcpath(self.item.source.filename.as_bytes(), |component| {
diff --git a/src/librustdoc/html/static/main.css b/src/librustdoc/html/static/main.css
index 71bac527801..b5ce3919bdd 100644
--- a/src/librustdoc/html/static/main.css
+++ b/src/librustdoc/html/static/main.css
@@ -98,9 +98,18 @@ p {
 
 code, pre {
     font-family: "Source Code Pro", Menlo, Monaco, Consolas, "DejaVu Sans Mono", Inconsolata, monospace;
+    white-space: pre-wrap;
 }
 pre {
     font-size: 15px;
+    padding: 14px;
+    padding-right: 0;
+    border-left: 2px solid #eee;
+}
+
+.source pre {
+    border-left: none;
+    padding: 20px;
 }
 
 nav.sub {
@@ -164,7 +173,6 @@ nav.sub {
     padding: 20px 0;
 }
 
-.content pre { padding: 14px; }
 .content.source pre.rust {
     white-space: pre;
     overflow: auto;
@@ -355,10 +363,9 @@ a {
 .stability {
     border-left: 6px solid #000;
     border-radius: 3px;
-    padding: 8px 3px 8px 10px;
+    padding: 2px 10px;
     text-transform: lowercase;
-    display: block;
-    margin-bottom: 20px;
+    margin-left: 10px;
 }
 
 .stability.Deprecated { border-color: #D60027; color: #880017; }
@@ -370,8 +377,6 @@ a {
 
 :target { background: #FDFFD3; }
 
-pre.rust, pre.line-numbers { background-color: #F5F5F5; }
-
 /* Code highlighting */
 pre.rust .kw { color: #8959A8; }
 pre.rust .kw-2, pre.rust .prelude-ty { color: #4271AE; }