address review comments: reuse Escape etc.
This commit is contained in:
parent
17ebb6053e
commit
2b11a80a60
2 changed files with 4 additions and 21 deletions
|
@ -64,6 +64,7 @@ use html::item_type::ItemType;
|
|||
use html::layout;
|
||||
use html::markdown::Markdown;
|
||||
use html::markdown;
|
||||
use html::escape::Escape;
|
||||
use stability_summary;
|
||||
|
||||
/// A pair of name and its optional document.
|
||||
|
@ -2197,21 +2198,6 @@ fn item_typedef(w: &mut fmt::Formatter, it: &clean::Item,
|
|||
document(w, it)
|
||||
}
|
||||
|
||||
fn escape_title(title: &str) -> String {
|
||||
let title = markdown::plain_summary_line(title);
|
||||
let mut result = String::with_capacity(title.len());
|
||||
for c in title.chars() {
|
||||
match c {
|
||||
'<' => result.push_str("<"),
|
||||
'>' => result.push_str(">"),
|
||||
'"' => result.push_str("""),
|
||||
'\'' => result.push_str("'"),
|
||||
_ => result.push(c),
|
||||
}
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
impl<'a> fmt::String for Sidebar<'a> {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
let cx = self.cx;
|
||||
|
@ -2251,7 +2237,7 @@ impl<'a> fmt::String for Sidebar<'a> {
|
|||
} else {
|
||||
format!("{}.{}.html", short, name.as_slice())
|
||||
},
|
||||
title = escape_title(doc.as_ref().unwrap().as_slice()),
|
||||
title = Escape(doc.as_ref().unwrap().as_slice()),
|
||||
name = name.as_slice()));
|
||||
}
|
||||
try!(write!(w, "</div>"));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue