about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-04-25 18:26:33 -0700
committerbors <bors@rust-lang.org>2014-04-25 18:26:33 -0700
commit395d8857d60c66876d41484d6caea05c03882fad (patch)
treeef2cf507f51c4d41b73b594ddf428bfedbeda641
parent6c3bdbe2e45739a5396316392ae3eb8c1d7a7434 (diff)
parentb3577a10f35ef237e2cad7cc3f1947d2218f0ee4 (diff)
downloadrust-395d8857d60c66876d41484d6caea05c03882fad.tar.gz
rust-395d8857d60c66876d41484d6caea05c03882fad.zip
auto merge of #13744 : adrientetar/rust/derp, r=brson
- Serve webfonts locally
- Style changes around `blockquote` and `code`
- Minor adjustments from previous changes

Bringing back updated examples: [modified tutorial](http://adrientetar.legtux.org/cached/rust-docs/tutorial.htm) and [modified manual](http://adrientetar.legtux.org/cached/rust-docs/manual.htm).
And for rustdoc, [modified `enum.FileType`](http://adrientetar.legtux.org/cached/rust-docs/enum.FileType.htm), [modified `std`](http://adrientetar.legtux.org/cached/rust-docs/std.htm) and [modified `std::io`](http://adrientetar.legtux.org/cached/rust-docs/io.htm).
-rw-r--r--mk/docs.mk20
-rw-r--r--src/doc/FiraSans-Medium.woffbin0 -> 89883 bytes
-rw-r--r--src/doc/FiraSans-Regular.woffbin0 -> 91946 bytes
-rw-r--r--src/doc/Heuristica-Bold.woffbin0 -> 123031 bytes
-rw-r--r--src/doc/Heuristica-Italic.woffbin0 -> 119956 bytes
-rw-r--r--src/doc/Heuristica-Regular.woffbin0 -> 160994 bytes
-rw-r--r--src/doc/favicon.inc4
-rw-r--r--src/doc/rust.css78
-rw-r--r--src/librustdoc/html/layout.rs4
-rw-r--r--src/librustdoc/html/render.rs28
-rw-r--r--src/librustdoc/html/static/main.css34
11 files changed, 98 insertions, 70 deletions
diff --git a/mk/docs.mk b/mk/docs.mk
index 9c79e1e8642..3e032d59728 100644
--- a/mk/docs.mk
+++ b/mk/docs.mk
@@ -141,6 +141,26 @@ doc/footer.inc: $(D)/footer.inc | doc/
 	@$(call E, cp: $@)
 	$(Q)cp -a $< $@ 2> /dev/null
 
+doc/FiraSans-Regular.woff: $(D)/FiraSans-Regular.woff | doc/
+	@$(call E, cp: $@)
+	$(Q)cp -a $< $@ 2> /dev/null
+
+doc/FiraSans-Medium.woff: $(D)/FiraSans-Medium.woff | doc/
+	@$(call E, cp: $@)
+	$(Q)cp -a $< $@ 2> /dev/null
+
+doc/Heuristica-Regular.woff: $(D)/Heuristica-Regular.woff | doc/
+	@$(call E, cp: $@)
+	$(Q)cp -a $< $@ 2> /dev/null
+
+doc/Heuristica-Italic.woff: $(D)/Heuristica-Italic.woff | doc/
+	@$(call E, cp: $@)
+	$(Q)cp -a $< $@ 2> /dev/null
+
+doc/Heuristica-Bold.woff: $(D)/Heuristica-Bold.woff | doc/
+	@$(call E, cp: $@)
+	$(Q)cp -a $< $@ 2> /dev/null
+
 # The (english) documentation for each doc item.
 
 define DEF_SHOULD_BUILD_PDF_DOC
diff --git a/src/doc/FiraSans-Medium.woff b/src/doc/FiraSans-Medium.woff
new file mode 100644
index 00000000000..5627227744a
--- /dev/null
+++ b/src/doc/FiraSans-Medium.woff
Binary files differdiff --git a/src/doc/FiraSans-Regular.woff b/src/doc/FiraSans-Regular.woff
new file mode 100644
index 00000000000..9ff40445bf4
--- /dev/null
+++ b/src/doc/FiraSans-Regular.woff
Binary files differdiff --git a/src/doc/Heuristica-Bold.woff b/src/doc/Heuristica-Bold.woff
new file mode 100644
index 00000000000..1c952d10e96
--- /dev/null
+++ b/src/doc/Heuristica-Bold.woff
Binary files differdiff --git a/src/doc/Heuristica-Italic.woff b/src/doc/Heuristica-Italic.woff
new file mode 100644
index 00000000000..b0cebf01de4
--- /dev/null
+++ b/src/doc/Heuristica-Italic.woff
Binary files differdiff --git a/src/doc/Heuristica-Regular.woff b/src/doc/Heuristica-Regular.woff
new file mode 100644
index 00000000000..8d824e6f547
--- /dev/null
+++ b/src/doc/Heuristica-Regular.woff
Binary files differdiff --git a/src/doc/favicon.inc b/src/doc/favicon.inc
index b68c58c9b61..a11e5cc9568 100644
--- a/src/doc/favicon.inc
+++ b/src/doc/favicon.inc
@@ -1 +1,3 @@
-<link rel="shortcut icon" href="http://www.rust-lang.org/favicon.ico" />
+<link rel="shortcut icon" href="http://www.rust-lang.org/favicon.ico">
+<link href='http://fonts.googleapis.com/css?family=Source+Code+Pro:400'
+        rel='stylesheet' type='text/css'>
\ No newline at end of file
diff --git a/src/doc/rust.css b/src/doc/rust.css
index b581dc2cce8..d60dd54a67d 100644
--- a/src/doc/rust.css
+++ b/src/doc/rust.css
@@ -14,34 +14,41 @@
     font-family: 'Fira Sans';
     font-style: normal;
     font-weight: 400;
-    src: local('Fira Sans'), url("http://www.rust-lang.org/fonts/FiraSans-Regular.woff") format('woff');
+    src: local('Fira Sans'), url("FiraSans-Regular.woff") format('woff');
 }
 @font-face {
     font-family: 'Fira Sans';
     font-style: normal;
     font-weight: 500;
-    src: local('Fira Sans Medium'), url("http://www.rust-lang.org/fonts/FiraSans-Medium.woff") format('woff');
+    src: local('Fira Sans Medium'), url("FiraSans-Medium.woff") format('woff');
 }
 @font-face {
     font-family: 'Heuristica';
     font-style: normal;
     font-weight: 400;
-    src: local('Heuristica Regular'), url("http://www.rust-lang.org/fonts/Heuristica-Regular.woff") format('woff');
+    src: local('Heuristica Regular'), url("Heuristica-Regular.woff") format('woff');
 }
 @font-face {
     font-family: 'Heuristica';
     font-style: italic;
     font-weight: 400;
-    src: local('Heuristica Italic'), url("http://www.rust-lang.org/fonts/Heuristica-Italic.woff") format('woff');
+    src: local('Heuristica Italic'), url("Heuristica-Italic.woff") format('woff');
 }
 @font-face {
     font-family: 'Heuristica';
     font-style: normal;
     font-weight: 700;
-    src: local('Heuristica Bold'), url("http://www.rust-lang.org/fonts/Heuristica-Bold.woff") format('woff');
+    src: local('Heuristica Bold'), url("Heuristica-Bold.woff") format('woff');
 }
-/* Global page semantics
-   ========================================================================== */
+
+*:not(body) {
+  -webkit-box-sizing: border-box;
+     -moz-box-sizing: border-box;
+          box-sizing: border-box;
+}
+
+/* General structure */
+
 body {
     margin: 0 auto;
     padding: 0 15px;
@@ -71,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;
@@ -157,8 +154,8 @@ footer {
     margin-bottom: 1em;
 }
 
-/* Links layout
-   ========================================================================== */
+/* Links layout */
+
 a {
     text-decoration: none;
     color: #428BCA;
@@ -183,18 +180,16 @@ h5 a:link, h5 a:visited {color: black;}
 h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover,
 h5 a:hover {text-decoration: none;}
 
-/* Code
-   ========================================================================== */
+/* Code */
+
 pre, code {
-    font-family: Menlo, Monaco, Consolas, "DejaVu Sans Mono", monospace;
-    border-radius: 4px;
+    font-family: "Source Code Pro", Menlo, Monaco, Consolas, "DejaVu Sans Mono", monospace;
 }
 pre {
-    background-color: #FDFDFD;
-    border: 1px solid #CCC;
-    border-radius: 0.5em;
+    border-left: 2px solid #eee;
     white-space: pre-wrap;
-    padding: 9.5px;
+    padding: 14px;
+    padding-right: 0;
     margin: 20px 0;
     font-size: 13px;
     word-break: break-all;
@@ -203,15 +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;
-    border-radius: 0;
 }
 
 /* Code highlighting */
@@ -225,16 +217,16 @@ pre.rust .doccomment { color: #4D4D4C; }
 pre.rust .macro, pre.rust .macro-nonterminal { color: #3E999F; }
 pre.rust .lifetime { color: #B76514; }
 
+/* The rest */
 
-/* The rest
-   ========================================================================== */
 #versioninfo {
     text-align: center;
     margin: 0.5em;
     font-size: 1.1em;
 }
-@media only screen and (min-width: 768px) {
+@media (min-width: 992px) {
     #versioninfo {
+        font-size: 0.8em;
         position: fixed;
         bottom: 0px;
         right: 0px;
@@ -243,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 {
@@ -252,10 +244,12 @@ pre.rust .lifetime { color: #B76514; }
 }
 
 blockquote {
-    color: black;
-    border-left: 5px solid #eee;
-    margin: 0 0 20px;
-    padding: 10px 20px;
+    color: #000;
+    margin: 20px 0;
+    padding: 15px 20px;
+    background-color: #f2f7f9;
+    border-top: .1em solid #e5eef2;
+    border-bottom: .1em solid #e5eef2;
 }
 blockquote p {
     font-size: 17px;
@@ -319,6 +313,12 @@ table th {
     padding: 5px;
 }
 
+@media (min-width: 1170px) {
+    pre {
+        font-size: 15px;
+    }
+}
+
 @media print {
     * {
         text-shadow: none !important;
diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs
index d0cfabc8c11..7cfc307debe 100644
--- a/src/librustdoc/html/layout.rs
+++ b/src/librustdoc/html/layout.rs
@@ -38,11 +38,11 @@ r##"<!DOCTYPE html>
 
     <title>{title}</title>
 
-    <link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600'
+    <link href='http://fonts.googleapis.com/css?family=Source+Code+Pro:400,600'
           rel='stylesheet' type='text/css'>
     <link rel="stylesheet" type="text/css" href="{root_path}main.css">
 
-    {favicon, select, none{} other{<link rel="shortcut icon" href="#" />}}
+    {favicon, select, none{} other{<link rel="shortcut icon" href="#">}}
 </head>
 <body>
     <!--[if lte IE 8]>
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 9a0b9912373..b5ce3919bdd 100644
--- a/src/librustdoc/html/static/main.css
+++ b/src/librustdoc/html/static/main.css
@@ -13,31 +13,31 @@
     font-family: 'Fira Sans';
     font-style: normal;
     font-weight: 400;
-    src: local('Fira Sans'), url("http://www.rust-lang.org/fonts/FiraSans-Regular.woff") format('woff');
+    src: local('Fira Sans'), url("FiraSans-Regular.woff") format('woff');
 }
 @font-face {
     font-family: 'Fira Sans';
     font-style: normal;
     font-weight: 500;
-    src: local('Fira Sans Medium'), url("http://www.rust-lang.org/fonts/FiraSans-Medium.woff") format('woff');
+    src: local('Fira Sans Medium'), url("FiraSans-Medium.woff") format('woff');
 }
 @font-face {
     font-family: 'Heuristica';
     font-style: normal;
     font-weight: 400;
-    src: local('Heuristica Regular'), url("http://www.rust-lang.org/fonts/Heuristica-Regular.woff") format('woff');
+    src: local('Heuristica Regular'), url("Heuristica-Regular.woff") format('woff');
 }
 @font-face {
     font-family: 'Heuristica';
     font-style: italic;
     font-weight: 400;
-    src: local('Heuristica Italic'), url("http://www.rust-lang.org/fonts/Heuristica-Italic.woff") format('woff');
+    src: local('Heuristica Italic'), url("Heuristica-Italic.woff") format('woff');
 }
 @font-face {
     font-family: 'Heuristica';
     font-style: normal;
     font-weight: 700;
-    src: local('Heuristica Bold'), url("http://www.rust-lang.org/fonts/Heuristica-Bold.woff") format('woff');
+    src: local('Heuristica Bold'), url("Heuristica-Bold.woff") format('woff');
 }
 
 @import "normalize.css";
@@ -63,7 +63,7 @@ body {
 h1, h2, h3:not(.impl), h4:not(.method) {
     color: black;
     font-weight: 500;
-    margin: 30px 0 20px 0;
+    margin: 30px 0 15px 0;
     padding-bottom: 6px;
 }
 h1.fqn {
@@ -81,7 +81,7 @@ h3.impl, h4.method {
 h3.impl {
     margin-top: 15px;
 }
-h1, h2, h3, h4, section.sidebar, a.source, .content a.mod, .search-input {
+h1, h2, h3, h4, section.sidebar, a.source, .search-input, .content table a {
     font-family: "Fira Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
 }
 
@@ -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: 20px; }
 .content.source pre.rust {
     white-space: pre;
     overflow: auto;
@@ -201,8 +209,7 @@ nav.sub {
 }
 
 .docblock h1, .docblock h2, .docblock h3, .docblock h4, .docblock h5 {
-    margin: 40px 0 10px 0;
-    padding: 10px 0;
+    margin: 30px 0 15px 0;
     border-bottom: 1px solid #DDD;
 }
 
@@ -356,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; }
@@ -371,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; }