Rollup merge of #57552 - GuillaumeGomez:default-images, r=QuietMisdreavus
Default images Add default rust logo (the image at the top of the sidebar) and default favicon. No more missing image or inexistent icon on the documentation tabs! r? @QuietMisdreavus
This commit is contained in:
commit
e3d3cff019
5 changed files with 20 additions and 4 deletions
|
@ -177,7 +177,10 @@ pub fn render<T: fmt::Display, S: fmt::Display>(
|
||||||
root_path = page.root_path,
|
root_path = page.root_path,
|
||||||
css_class = page.css_class,
|
css_class = page.css_class,
|
||||||
logo = if layout.logo.is_empty() {
|
logo = if layout.logo.is_empty() {
|
||||||
String::new()
|
format!("<a href='{}{}/index.html'>\
|
||||||
|
<img src='{static_root_path}rust-logo{suffix}.png' alt='logo' width='100'></a>",
|
||||||
|
static_root_path=static_root_path,
|
||||||
|
suffix=page.resource_suffix)
|
||||||
} else {
|
} else {
|
||||||
format!("<a href='{}{}/index.html'>\
|
format!("<a href='{}{}/index.html'>\
|
||||||
<img src='{}' alt='logo' width='100'></a>",
|
<img src='{}' alt='logo' width='100'></a>",
|
||||||
|
@ -188,7 +191,9 @@ pub fn render<T: fmt::Display, S: fmt::Display>(
|
||||||
description = page.description,
|
description = page.description,
|
||||||
keywords = page.keywords,
|
keywords = page.keywords,
|
||||||
favicon = if layout.favicon.is_empty() {
|
favicon = if layout.favicon.is_empty() {
|
||||||
String::new()
|
format!(r#"<link rel="shortcut icon" href="{static_root_path}favicon{suffix}.ico">"#,
|
||||||
|
static_root_path=static_root_path,
|
||||||
|
suffix=page.resource_suffix)
|
||||||
} else {
|
} else {
|
||||||
format!(r#"<link rel="shortcut icon" href="{}">"#, layout.favicon)
|
format!(r#"<link rel="shortcut icon" href="{}">"#, layout.favicon)
|
||||||
},
|
},
|
||||||
|
|
|
@ -789,6 +789,14 @@ fn write_shared(
|
||||||
themes.insert(theme.to_owned());
|
themes.insert(theme.to_owned());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (*cx.shared).layout.logo.is_empty() {
|
||||||
|
write(cx.dst.join(&format!("rust-logo{}.png", cx.shared.resource_suffix)),
|
||||||
|
static_files::RUST_LOGO)?;
|
||||||
|
}
|
||||||
|
if (*cx.shared).layout.favicon.is_empty() {
|
||||||
|
write(cx.dst.join(&format!("favicon{}.ico", cx.shared.resource_suffix)),
|
||||||
|
static_files::RUST_FAVICON)?;
|
||||||
|
}
|
||||||
write(cx.dst.join(&format!("brush{}.svg", cx.shared.resource_suffix)),
|
write(cx.dst.join(&format!("brush{}.svg", cx.shared.resource_suffix)),
|
||||||
static_files::BRUSH_SVG)?;
|
static_files::BRUSH_SVG)?;
|
||||||
write(cx.dst.join(&format!("wheel{}.svg", cx.shared.resource_suffix)),
|
write(cx.dst.join(&format!("wheel{}.svg", cx.shared.resource_suffix)),
|
||||||
|
@ -2068,8 +2076,6 @@ impl Context {
|
||||||
themes.push(PathBuf::from("settings.css"));
|
themes.push(PathBuf::from("settings.css"));
|
||||||
let mut layout = self.shared.layout.clone();
|
let mut layout = self.shared.layout.clone();
|
||||||
layout.krate = String::new();
|
layout.krate = String::new();
|
||||||
layout.logo = String::new();
|
|
||||||
layout.favicon = String::new();
|
|
||||||
try_err!(layout::render(&mut w, &layout,
|
try_err!(layout::render(&mut w, &layout,
|
||||||
&page, &sidebar, &settings,
|
&page, &sidebar, &settings,
|
||||||
self.shared.css_file_extension.is_some(),
|
self.shared.css_file_extension.is_some(),
|
||||||
|
|
BIN
src/librustdoc/html/static/favicon.ico
Normal file
BIN
src/librustdoc/html/static/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 23 KiB |
BIN
src/librustdoc/html/static/rust-logo.png
Normal file
BIN
src/librustdoc/html/static/rust-logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.6 KiB |
|
@ -51,6 +51,11 @@ pub static LICENSE_APACHE: &'static [u8] = include_bytes!("static/LICENSE-APACHE
|
||||||
/// The contents of `LICENSE-MIT.txt`, the text of the MIT License.
|
/// The contents of `LICENSE-MIT.txt`, the text of the MIT License.
|
||||||
pub static LICENSE_MIT: &'static [u8] = include_bytes!("static/LICENSE-MIT.txt");
|
pub static LICENSE_MIT: &'static [u8] = include_bytes!("static/LICENSE-MIT.txt");
|
||||||
|
|
||||||
|
/// The contents of `rust-logo.png`, the default icon of the documentation.
|
||||||
|
pub static RUST_LOGO: &'static [u8] = include_bytes!("static/rust-logo.png");
|
||||||
|
/// The contents of `favicon.ico`, the default favicon of the documentation.
|
||||||
|
pub static RUST_FAVICON: &'static [u8] = include_bytes!("static/favicon.ico");
|
||||||
|
|
||||||
/// The built-in themes given to every documentation site.
|
/// The built-in themes given to every documentation site.
|
||||||
pub mod themes {
|
pub mod themes {
|
||||||
/// The "light" theme, selected by default when no setting is available. Used as the basis for
|
/// The "light" theme, selected by default when no setting is available. Used as the basis for
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue