Improve attributes display and allow expansion
This commit is contained in:
parent
a96247bcac
commit
22dad4b044
@ -2513,15 +2513,16 @@ fn render_attribute(attr: &clean::Attribute, recurse: bool) -> Option<String> {
|
|||||||
Some(format!("{} = \"{}\"", k, v))
|
Some(format!("{} = \"{}\"", k, v))
|
||||||
}
|
}
|
||||||
clean::List(ref k, ref values) if attribute_with_values(&*k) => {
|
clean::List(ref k, ref values) if attribute_with_values(&*k) => {
|
||||||
let mut display = Vec::new();
|
let display: Vec<_> = values.iter()
|
||||||
|
.filter_map(|value| render_attribute(value, true))
|
||||||
|
.map(|entry| format!("{}", entry))
|
||||||
|
.collect();
|
||||||
|
|
||||||
for value in values {
|
if display.len() > 0 {
|
||||||
let s = render_attribute(value, true);
|
Some(format!("{}({})", k, display.join(", ")))
|
||||||
if s.len() > 0 {
|
} else {
|
||||||
display.push(format!("{}", s));
|
None
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Some(format!("{}({})", k, display.join(", ")))
|
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
None
|
None
|
||||||
@ -2538,7 +2539,7 @@ fn render_attributes(w: &mut fmt::Formatter, it: &clean::Item) -> fmt::Result {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if attrs.len() > 0 {
|
if attrs.len() > 0 {
|
||||||
write!(w, "<div class=\"docblock\">{}</div>", &attrs)?;
|
write!(w, "<div class=\"docblock attributes\">{}</div>", &attrs)?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -1005,6 +1005,8 @@
|
|||||||
.html(' Expand description'));
|
.html(' Expand description'));
|
||||||
var wrapper = $("<div class='toggle-wrapper'>").append(mainToggle);
|
var wrapper = $("<div class='toggle-wrapper'>").append(mainToggle);
|
||||||
$("#main > .docblock").before(wrapper);
|
$("#main > .docblock").before(wrapper);
|
||||||
|
var wrapper = $("<div class='toggle-wrapper toggle-attributes'>").append(mainToggle);
|
||||||
|
$("#main > pre > .docblock").before(wrapper);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('pre.line-numbers').on('click', 'span', function() {
|
$('pre.line-numbers').on('click', 'span', function() {
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user