rustdoc: bring it inline

This commit is contained in:
Adrien Tétar 2014-04-25 17:34:32 +09:00
parent c9d995d384
commit b3577a10f3
3 changed files with 30 additions and 36 deletions

View File

@ -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 {

View File

@ -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| {

View File

@ -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; }