Improve rustdoc css of "source" and "since" elements

This commit is contained in:
ggomez 2016-05-06 18:47:12 +02:00 committed by Guillaume Gomez
parent 083c3952e0
commit cdca084377
3 changed files with 43 additions and 7 deletions

View File

@ -2144,7 +2144,7 @@ fn render_stability_since_raw<'a>(w: &mut fmt::Formatter,
containing_ver: Option<&'a str>) -> fmt::Result {
if let Some(v) = ver {
if containing_ver != ver && v.len() > 0 {
write!(w, "<span class=\"since\">{}</span>",
write!(w, "<div class=\"since\">{}</div>",
v)?
}
}
@ -2545,13 +2545,16 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi
render_header: bool, outer_version: Option<&str>) -> fmt::Result {
if render_header {
write!(w, "<h3 class='impl'><span class='in-band'><code>{}</code>", i.inner_impl())?;
let since = i.impl_item.stability.as_ref().map(|s| &s.since[..]);
render_stability_since_raw(w, since, outer_version)?;
write!(w, "</span><span class='out-of-band'>")?;
let since = i.impl_item.stability.as_ref().map(|s| &s.since[..]);
if let Some(l) = (Item { item: &i.impl_item, cx: cx }).href() {
write!(w, "<div class='ghost'></div>")?;
render_stability_since_raw(w, since, outer_version)?;
write!(w, "<a id='src-{}' class='srclink' \
href='{}' title='{}'>[src]</a>",
i.impl_item.def_id.index.as_usize(), l, "goto source code")?;
} else {
render_stability_since_raw(w, since, outer_version)?;
}
write!(w, "</span>")?;
write!(w, "</h3>\n")?;

View File

@ -97,6 +97,7 @@ h1, h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):no
h1.fqn {
border-bottom: 1px dashed;
margin-top: 0;
position: relative;
}
h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.type):not(.tymethod) {
border-bottom: 1px solid;
@ -105,6 +106,7 @@ h3.impl, h3.method, h4.method, h3.type, h4.type {
font-weight: 600;
margin-top: 10px;
margin-bottom: 10px;
position: relative;
}
h3.impl, h3.method, h3.type {
margin-top: 15px;
@ -265,25 +267,39 @@ nav.sub {
.content .out-of-band {
font-size: 23px;
width: 40%;
margin: 0px;
padding: 0px;
text-align: right;
display: inline-block;
font-weight: normal;
position: absolute;
right: 0;
}
h3.impl > .out-of-band {
font-size: 21px;
}
h4 > code, h3 > code {
position: inherit;
}
.in-band, code {
z-index: 5;
}
.content .in-band {
width: 60%;
margin: 0px;
padding: 0px;
display: inline-block;
}
#main { position: relative; }
#main > .since {
top: inherit;
font-family: "Fira Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.content table {
border-spacing: 0 5px;
border-collapse: separate;
@ -503,11 +519,13 @@ em.stab p {
opacity: 0.65;
}
span.since {
float: right;
.since {
font-weight: normal;
font-size: initial;
color: grey;
position: absolute;
right: 0;
top: 0;
}
.variants_table {
@ -602,7 +620,19 @@ a.test-arrow {
color: #999;
}
.ghost {
display: none;
}
.ghost + .since {
position: initial;
display: table-cell;
}
.since + .srclink {
display: table-cell;
padding-left: 10px;
}
/* Media Queries */

View File

@ -26,6 +26,9 @@ h1.fqn {
h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.type):not(.tymethod) {
border-bottom-color: #DDDDDD;
}
.in-band, code {
background-color: white;
}
.docblock code {
background-color: #F5F5F5;