Improve headers linking
This commit is contained in:
parent
6d84a355c3
commit
8ac4336692
2 changed files with 32 additions and 22 deletions
|
@ -2141,8 +2141,8 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
|
||||||
|
|
||||||
if !types.is_empty() {
|
if !types.is_empty() {
|
||||||
write!(w, "
|
write!(w, "
|
||||||
<h2 id='associated-types' class='section-header'>
|
<h2 id='associated-types' class='small-section-header'>
|
||||||
<a href='#associated-types'>Associated Types</a>
|
Associated Types<a href='#associated-types' class='anchor'></a>
|
||||||
</h2>
|
</h2>
|
||||||
<div class='methods'>
|
<div class='methods'>
|
||||||
")?;
|
")?;
|
||||||
|
@ -2154,8 +2154,8 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
|
||||||
|
|
||||||
if !consts.is_empty() {
|
if !consts.is_empty() {
|
||||||
write!(w, "
|
write!(w, "
|
||||||
<h2 id='associated-const' class='section-header'>
|
<h2 id='associated-const' class='small-section-header'>
|
||||||
<a href='#associated-const'>Associated Constants</a>
|
Associated Constants<a href='#associated-const' class='anchor'></a>
|
||||||
</h2>
|
</h2>
|
||||||
<div class='methods'>
|
<div class='methods'>
|
||||||
")?;
|
")?;
|
||||||
|
@ -2168,8 +2168,8 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
|
||||||
// Output the documentation for each function individually
|
// Output the documentation for each function individually
|
||||||
if !required.is_empty() {
|
if !required.is_empty() {
|
||||||
write!(w, "
|
write!(w, "
|
||||||
<h2 id='required-methods' class='section-header'>
|
<h2 id='required-methods' class='small-section-header'>
|
||||||
<a href='#required-methods'>Required Methods</a>
|
Required Methods<a href='#required-methods' class='anchor'></a>
|
||||||
</h2>
|
</h2>
|
||||||
<div class='methods'>
|
<div class='methods'>
|
||||||
")?;
|
")?;
|
||||||
|
@ -2180,8 +2180,8 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
|
||||||
}
|
}
|
||||||
if !provided.is_empty() {
|
if !provided.is_empty() {
|
||||||
write!(w, "
|
write!(w, "
|
||||||
<h2 id='provided-methods' class='section-header'>
|
<h2 id='provided-methods' class='small-section-header'>
|
||||||
<a href='#provided-methods'>Provided Methods</a>
|
Provided Methods<a href='#provided-methods' class='anchor'></a>
|
||||||
</h2>
|
</h2>
|
||||||
<div class='methods'>
|
<div class='methods'>
|
||||||
")?;
|
")?;
|
||||||
|
@ -2196,8 +2196,8 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
|
||||||
|
|
||||||
let cache = cache();
|
let cache = cache();
|
||||||
write!(w, "
|
write!(w, "
|
||||||
<h2 id='implementors' class='section-header'>
|
<h2 id='implementors' class='small-section-header'>
|
||||||
<a href='#implementors'>Implementors</a>
|
Implementors<a href='#implementors' class='anchor'></a>
|
||||||
</h2>
|
</h2>
|
||||||
<ul class='item-list' id='implementors-list'>
|
<ul class='item-list' id='implementors-list'>
|
||||||
")?;
|
")?;
|
||||||
|
@ -2436,8 +2436,8 @@ fn item_struct(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
|
||||||
}).peekable();
|
}).peekable();
|
||||||
if let doctree::Plain = s.struct_type {
|
if let doctree::Plain = s.struct_type {
|
||||||
if fields.peek().is_some() {
|
if fields.peek().is_some() {
|
||||||
write!(w, "<h2 id='fields' class='fields section-header'>
|
write!(w, "<h2 id='fields' class='fields small-section-header'>
|
||||||
<a href='#fields'>Fields</a></h2>")?;
|
Fields<a href='#fields' class='anchor'></a></h2>")?;
|
||||||
for (field, ty) in fields {
|
for (field, ty) in fields {
|
||||||
let id = derive_id(format!("{}.{}",
|
let id = derive_id(format!("{}.{}",
|
||||||
ItemType::StructField,
|
ItemType::StructField,
|
||||||
|
@ -2485,8 +2485,8 @@ fn item_union(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
|
||||||
}
|
}
|
||||||
}).peekable();
|
}).peekable();
|
||||||
if fields.peek().is_some() {
|
if fields.peek().is_some() {
|
||||||
write!(w, "<h2 id='fields' class='fields section-header'>
|
write!(w, "<h2 id='fields' class='fields small-section-header'>
|
||||||
<a href='#fields'>Fields</a></h2>")?;
|
Fields<a href='#fields' class='anchor'></a></h2>")?;
|
||||||
for (field, ty) in fields {
|
for (field, ty) in fields {
|
||||||
write!(w, "<span id='{shortty}.{name}' class=\"{shortty}\"><code>{name}: {ty}</code>
|
write!(w, "<span id='{shortty}.{name}' class=\"{shortty}\"><code>{name}: {ty}</code>
|
||||||
</span>",
|
</span>",
|
||||||
|
@ -2558,8 +2558,8 @@ fn item_enum(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
|
||||||
|
|
||||||
document(w, cx, it)?;
|
document(w, cx, it)?;
|
||||||
if !e.variants.is_empty() {
|
if !e.variants.is_empty() {
|
||||||
write!(w, "<h2 id='variants' class='variants section-header'>
|
write!(w, "<h2 id='variants' class='variants small-section-header'>
|
||||||
<a href='#variants'>Variants</a></h2>\n")?;
|
Variants<a href='#variants' class='anchor'></a></h2>\n")?;
|
||||||
for variant in &e.variants {
|
for variant in &e.variants {
|
||||||
let id = derive_id(format!("{}.{}",
|
let id = derive_id(format!("{}.{}",
|
||||||
ItemType::Variant,
|
ItemType::Variant,
|
||||||
|
@ -2831,16 +2831,16 @@ fn render_assoc_items(w: &mut fmt::Formatter,
|
||||||
let render_mode = match what {
|
let render_mode = match what {
|
||||||
AssocItemRender::All => {
|
AssocItemRender::All => {
|
||||||
write!(w, "
|
write!(w, "
|
||||||
<h2 id='methods' class='section-header'>
|
<h2 id='methods' class='small-section-header'>
|
||||||
<a href='#methods'>Methods</a>
|
Methods<a href='#methods' class='anchor'></a>
|
||||||
</h2>
|
</h2>
|
||||||
")?;
|
")?;
|
||||||
RenderMode::Normal
|
RenderMode::Normal
|
||||||
}
|
}
|
||||||
AssocItemRender::DerefFor { trait_, type_, deref_mut_ } => {
|
AssocItemRender::DerefFor { trait_, type_, deref_mut_ } => {
|
||||||
write!(w, "
|
write!(w, "
|
||||||
<h2 id='deref-methods' class='section-header'>
|
<h2 id='deref-methods' class='small-section-header'>
|
||||||
<a href='#deref-methods'>Methods from {}<Target = {}></a>
|
Methods from {}<Target = {}><a href='#deref-methods' class='anchor'></a>
|
||||||
</h2>
|
</h2>
|
||||||
", trait_, type_)?;
|
", trait_, type_)?;
|
||||||
RenderMode::ForDeref { mut_: deref_mut_ }
|
RenderMode::ForDeref { mut_: deref_mut_ }
|
||||||
|
@ -2865,8 +2865,8 @@ fn render_assoc_items(w: &mut fmt::Formatter,
|
||||||
render_deref_methods(w, cx, impl_, containing_item, has_deref_mut)?;
|
render_deref_methods(w, cx, impl_, containing_item, has_deref_mut)?;
|
||||||
}
|
}
|
||||||
write!(w, "
|
write!(w, "
|
||||||
<h2 id='implementations' class='section-header'>
|
<h2 id='implementations' class='small-section-header'>
|
||||||
<a href='#implementations'>Trait Implementations</a>
|
Trait Implementations<a href='#implementations' class='anchor'></a>
|
||||||
</h2>
|
</h2>
|
||||||
")?;
|
")?;
|
||||||
for i in &traits {
|
for i in &traits {
|
||||||
|
|
|
@ -438,6 +438,16 @@ a {
|
||||||
background: transparent;
|
background: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.small-section-header:hover > .anchor {
|
||||||
|
display: initial;
|
||||||
|
}
|
||||||
|
.anchor {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.anchor:after {
|
||||||
|
content: '\2002\00a7\2002';
|
||||||
|
}
|
||||||
|
|
||||||
.docblock a:hover, .docblock-short a:hover, .stability a {
|
.docblock a:hover, .docblock-short a:hover, .stability a {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue