From e1180f521f8f2d01745b50b228f7b426cb4565dc Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 3 Jun 2021 20:07:25 +0200 Subject: [PATCH 1/3] Escape content attribute value --- src/librustdoc/html/layout.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs index 7309a1da23038..c3843e7213560 100644 --- a/src/librustdoc/html/layout.rs +++ b/src/librustdoc/html/layout.rs @@ -161,7 +161,7 @@ crate fn render( } }, title = page.title, - description = page.description, + description = Escape(page.description), keywords = page.keywords, favicon = if layout.favicon.is_empty() { format!( From 8c9200d045c0d7b41a02a1c67ffb0ec7be379c65 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 3 Jun 2021 20:07:54 +0200 Subject: [PATCH 2/3] Add missing backslash in HTML layout string --- src/librustdoc/html/layout.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs index c3843e7213560..d2d1757b9009a 100644 --- a/src/librustdoc/html/layout.rs +++ b/src/librustdoc/html/layout.rs @@ -105,7 +105,7 @@ crate fn render( placeholder=\"Click or press ‘S’ to search, ‘?’ for more options…\" \ type=\"search\">\ \ - + \ \ Date: Thu, 3 Jun 2021 20:16:47 +0200 Subject: [PATCH 3/3] Fix invalid ID value in all.html file --- src/librustdoc/html/render/mod.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 10f5184e39a67..4b6faefc2fb07 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -322,7 +322,13 @@ impl AllTypes { if !e.is_empty() { let mut e: Vec<&ItemEntry> = e.iter().collect(); e.sort(); - write!(f, "

{}

    ", title, title, class); + write!( + f, + "

    {}

      ", + title.replace(' ', "-"), // IDs cannot contain whitespaces. + title, + class + ); for s in e.iter() { write!(f, "
    • {}
    • ", s.print()); @@ -346,7 +352,7 @@ impl AllTypes { ", ); // 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");