From 161943541a4e5253eb8e45f000b83ddc556fa4c0 Mon Sep 17 00:00:00 2001 From: cynecx Date: Tue, 18 Aug 2020 18:05:00 +0200 Subject: [PATCH 1/2] Move rustdoc header out of rustdoc container (Fixes #935) --- src/utils/html.rs | 6 +- templates/rustdoc/body.html | 238 ---------------------------------- templates/rustdoc/header.html | 237 +++++++++++++++++++++++++++++++++ 3 files changed, 242 insertions(+), 239 deletions(-) create mode 100644 templates/rustdoc/header.html diff --git a/src/utils/html.rs b/src/utils/html.rs index 77d101002..fda4fe7b7 100644 --- a/src/utils/html.rs +++ b/src/utils/html.rs @@ -20,6 +20,7 @@ pub(crate) fn rewrite_lol( let templates = templates.templates.load(); let tera_head = templates.render("rustdoc/head.html", &ctx).unwrap(); let tera_body = templates.render("rustdoc/body.html", &ctx).unwrap(); + let tera_rustdoc_header = templates.render("rustdoc/header.html", &ctx).unwrap(); let head_handler = |head: &mut Element| { head.append(&tera_head, ContentType::Html); @@ -51,8 +52,11 @@ pub(crate) fn rewrite_lol( rustdoc_body_class.set_tag_name("div")?; // Prepend the tera content rustdoc_body_class.prepend(&tera_body, ContentType::Html); - // Now, make this a full tag + // Wrap the tranformed body and rustdoc header into a element rustdoc_body_class.before("", ContentType::Html); + // Insert rustdoc's header + rustdoc_body_class.before(&tera_rustdoc_header, ContentType::Html); + // Finalize body with rustdoc_body_class.after("", ContentType::Html); Ok(()) diff --git a/templates/rustdoc/body.html b/templates/rustdoc/body.html index df6af7910..f9a2beb8f 100644 --- a/templates/rustdoc/body.html +++ b/templates/rustdoc/body.html @@ -1,241 +1,3 @@ -{%- import "macros.html" as macros -%} - -{# The url of the current release, `/crate/:name/:version` #} -{%- set crate_url = "/crate/" ~ krate.name ~ "/" ~ krate.version -%} - - -