1
Fork 0

auto merge of #13485 : adrientetar/rust/newrustdoc, r=brson

- Cherry-pick from #12996
- Use Fira Sans for headlines and sidebar (Light), Heuristica for the body (Adobe Utopia derivative). Both are licensed under the SIL OFL license.
- A few tweaks

Two examples: [modified `std`](http://adrientetar.legtux.org/cached/rust-docs/std.htm) and [modified `std::io`](http://adrientetar.legtux.org/cached/rust-docs/io.htm).

cc #13484
**Blocked on graydon/rust-www#25 (for hosting of the fonts), that's showcased [here](http://adrientetar.github.io/rust-www/).**

cc @brson, @TheHydroImpulse
This commit is contained in:
bors 2014-04-16 17:51:28 -07:00
commit 88805e1e00
3 changed files with 164 additions and 84 deletions

View file

@ -938,28 +938,8 @@ impl<'a> fmt::Show for Item<'a> {
None => {}
}
if self.cx.include_sources {
let mut path = Vec::new();
clean_srcpath(self.item.source.filename.as_bytes(), |component| {
path.push(component.to_owned());
});
let href = if self.item.source.loline == self.item.source.hiline {
format!("{}", self.item.source.loline)
} else {
format!("{}-{}", self.item.source.loline, self.item.source.hiline)
};
try!(write!(fmt.buf,
"<a class='source'
href='{root}src/{krate}/{path}.html\\#{href}'>\
[src]</a>",
root = self.cx.root_path,
krate = self.cx.layout.krate,
path = path.connect("/"),
href = href));
}
// Write the breadcrumb trail header for the top
try!(write!(fmt.buf, "<h1 class='fqn'>"));
try!(write!(fmt.buf, "\n<h1 class='fqn'>"));
match self.item.inner {
clean::ModuleItem(ref m) => if m.is_crate {
try!(write!(fmt.buf, "Crate "));
@ -982,9 +962,30 @@ impl<'a> fmt::Show for Item<'a> {
try!(write!(fmt.buf, "<a href='{}index.html'>{}</a>::",
trail, component.as_slice()));
}
try!(write!(fmt.buf, "<a class='{}' href=''>{}</a></h1>",
try!(write!(fmt.buf, "<a class='{}' href=''>{}</a>",
shortty(self.item), self.item.name.get_ref().as_slice()));
if self.cx.include_sources {
let mut path = Vec::new();
clean_srcpath(self.item.source.filename.as_bytes(), |component| {
path.push(component.to_owned());
});
let href = if self.item.source.loline == self.item.source.hiline {
format!("{}", self.item.source.loline)
} else {
format!("{}-{}", self.item.source.loline, self.item.source.hiline)
};
try!(write!(fmt.buf,
"<a class='source'\
href='{root}src/{krate}/{path}.html\\#{href}'>\
[src]</a>",
root = self.cx.root_path,
krate = self.cx.layout.krate,
path = path.connect("/"),
href = href));
}
try!(write!(fmt.buf, "</h1>\n"));
match self.item.inner {
clean::ModuleItem(ref m) => {
item_module(fmt.buf, self.cx, self.item, m.items.as_slice())