ty: shortty(item),
name: item.name.clone().unwrap(),
path: fqp[..fqp.len() - 1].connect("::"),
- desc: shorter(item.doc_value()).to_string(),
+ desc: shorter(item.doc_value()),
parent: Some(did),
});
},
ty: shortty(&item),
name: s.to_string(),
path: path.connect("::").to_string(),
- desc: shorter(item.doc_value()).to_string(),
+ desc: shorter(item.doc_value()),
parent: parent,
});
}
return s
}
-fn shorter<'a>(s: Option<&'a str>) -> &'a str {
+fn shorter<'a>(s: Option<&'a str>) -> String {
match s {
- Some(s) => match s.find("\n\n") {
- Some(pos) => &s[..pos],
- None => s,
- },
- None => ""
+ Some(s) => s.lines().take_while(|line|{
+ (*line).chars().any(|chr|{
+ !chr.is_whitespace()
+ })
+ }).collect::<Vec<_>>().connect("\n"),
+ None => "".to_string()
}
}
</tr>
",
*myitem.name.as_ref().unwrap(),
- Markdown(shorter(myitem.doc_value())),
+ Markdown(&shorter(myitem.doc_value())[..]),
class = shortty(myitem),
href = item_path(myitem),
title = full_path(cx, myitem),