Add default rust logo for documentation

This commit is contained in:
Guillaume Gomez 2019-01-12 22:25:29 +01:00
parent ceb2512144
commit 2200fd3c7c
4 changed files with 11 additions and 1 deletions

View File

@ -177,7 +177,10 @@ pub fn render<T: fmt::Display, S: fmt::Display>(
root_path = page.root_path,
css_class = page.css_class,
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 {
format!("<a href='{}{}/index.html'>\
<img src='{}' alt='logo' width='100'></a>",

View File

@ -789,6 +789,10 @@ fn write_shared(
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)?;
}
write(cx.dst.join(&format!("brush{}.svg", cx.shared.resource_suffix)),
static_files::BRUSH_SVG)?;
write(cx.dst.join(&format!("wheel{}.svg", cx.shared.resource_suffix)),

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@ -51,6 +51,9 @@ pub static LICENSE_APACHE: &'static [u8] = include_bytes!("static/LICENSE-APACHE
/// The contents of `LICENSE-MIT.txt`, the text of the MIT License.
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 built-in themes given to every documentation site.
pub mod themes {
/// The "light" theme, selected by default when no setting is available. Used as the basis for