Skip to content

Commit

Permalink
Rollup merge of rust-lang#85972 - GuillaumeGomez:rustdoc-html-fixes, …
Browse files Browse the repository at this point in the history
…r=jsha

Rustdoc html fixes

rust-lang#84480 latest update allowed me to fix the remaining issues. The last one is coming from `pulldown-cmark` so I'll send them a fix soon.

r? `@jsha`
  • Loading branch information
GuillaumeGomez authored Jun 5, 2021
2 parents 678b012 + e078e56 commit 3ebc3e7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/librustdoc/html/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ crate fn render<T: Print, S: Print>(
placeholder=\"Click or press ‘S’ to search, ‘?’ for more options…\" \
type=\"search\">\
</div>\
<button type=\"button\" id=\"help-button\" title=\"help\">?</button>
<button type=\"button\" id=\"help-button\" title=\"help\">?</button>\
<a id=\"settings-menu\" href=\"{root_path}settings.html\" title=\"settings\">\
<img src=\"{static_root_path}wheel{suffix}.svg\" \
width=\"18\" height=\"18\" \
Expand Down Expand Up @@ -161,7 +161,7 @@ crate fn render<T: Print, S: Print>(
}
},
title = page.title,
description = page.description,
description = Escape(page.description),
keywords = page.keywords,
favicon = if layout.favicon.is_empty() {
format!(
Expand Down
10 changes: 8 additions & 2 deletions src/librustdoc/html/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,13 @@ impl AllTypes {
if !e.is_empty() {
let mut e: Vec<&ItemEntry> = e.iter().collect();
e.sort();
write!(f, "<h3 id=\"{}\">{}</h3><ul class=\"{} docblock\">", title, title, class);
write!(
f,
"<h3 id=\"{}\">{}</h3><ul class=\"{} docblock\">",
title.replace(' ', "-"), // IDs cannot contain whitespaces.
title,
class
);

for s in e.iter() {
write!(f, "<li>{}</li>", s.print());
Expand All @@ -346,7 +352,7 @@ impl AllTypes {
</h1>",
);
// Note: print_entries does not escape the title, because we know the current set of titles
// don't require escaping.
// doesn't require escaping.
print_entries(f, &self.structs, "Structs", "structs");
print_entries(f, &self.enums, "Enums", "enums");
print_entries(f, &self.unions, "Unions", "unions");
Expand Down

0 comments on commit 3ebc3e7

Please sign in to comment.