Skip to content

Commit

Permalink
Add default rust logo for documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Jan 20, 2019
1 parent ceb2512 commit 2200fd3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/librustdoc/html/layout.rs
Expand Up @@ -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>",
Expand Down
4 changes: 4 additions & 0 deletions src/librustdoc/html/render.rs
Expand Up @@ -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)),
Expand Down
Binary file added src/librustdoc/html/static/rust-logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/librustdoc/html/static_files.rs
Expand Up @@ -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
Expand Down

0 comments on commit 2200fd3

Please sign in to comment.