From 2391317878a4f91f4ae68cef122c160f3eda9ed3 Mon Sep 17 00:00:00 2001 From: Debian Rust Maintainers Date: Sat, 13 Jul 2019 18:30:35 +0100 Subject: [PATCH] d-0003-mdbook-strip-embedded-libs Gbp-Pq: Name d-0003-mdbook-strip-embedded-libs.patch --- src/tools/linkchecker/main.rs | 5 ++ vendor/mdbook/src/book/init.rs | 6 -- .../renderer/html_handlebars/hbs_renderer.rs | 58 +------------ .../src/renderer/html_handlebars/search.rs | 2 - vendor/mdbook/src/theme/index.hbs | 81 +------------------ vendor/mdbook/src/theme/mod.rs | 32 -------- vendor/mdbook/src/theme/searcher/mod.rs | 2 - 7 files changed, 11 insertions(+), 175 deletions(-) diff --git a/src/tools/linkchecker/main.rs b/src/tools/linkchecker/main.rs index 9a6c97dbca..ae81b425aa 100644 --- a/src/tools/linkchecker/main.rs +++ b/src/tools/linkchecker/main.rs @@ -173,6 +173,11 @@ fn check(cache: &mut Cache, url.starts_with("irc:") || url.starts_with("data:") { return; } + // Ignore parent URLs, so that the package installation process can + // provide a symbolic link later + if url.starts_with("../") { + return; + } let mut parts = url.splitn(2, "#"); let url = parts.next().unwrap(); let fragment = parts.next(); diff --git a/vendor/mdbook/src/book/init.rs b/vendor/mdbook/src/book/init.rs index 4acf4b5256..e82db31e6c 100644 --- a/vendor/mdbook/src/book/init.rs +++ b/vendor/mdbook/src/book/init.rs @@ -149,12 +149,6 @@ impl BookBuilder { let mut js = File::create(themedir.join("book.js"))?; js.write_all(theme::JS)?; - let mut highlight_css = File::create(themedir.join("highlight.css"))?; - highlight_css.write_all(theme::HIGHLIGHT_CSS)?; - - let mut highlight_js = File::create(themedir.join("highlight.js"))?; - highlight_js.write_all(theme::HIGHLIGHT_JS)?; - Ok(()) } diff --git a/vendor/mdbook/src/renderer/html_handlebars/hbs_renderer.rs b/vendor/mdbook/src/renderer/html_handlebars/hbs_renderer.rs index b5ef228d34..1354a6f8f7 100644 --- a/vendor/mdbook/src/renderer/html_handlebars/hbs_renderer.rs +++ b/vendor/mdbook/src/renderer/html_handlebars/hbs_renderer.rs @@ -3,7 +3,7 @@ use config::{Config, HtmlConfig, Playpen}; use errors::*; use renderer::html_handlebars::helpers; use renderer::{RenderContext, Renderer}; -use theme::{self, playpen_editor, Theme}; +use theme::{self, Theme}; use utils; use std::collections::BTreeMap; @@ -107,7 +107,7 @@ impl HtmlHandlebars { &self, destination: &Path, theme: &Theme, - html_config: &HtmlConfig, + _html_config: &HtmlConfig, ) -> Result<()> { use utils::fs::write_file; @@ -123,62 +123,8 @@ impl HtmlHandlebars { write_file(destination, "css/print.css", &theme.print_css)?; write_file(destination, "css/variables.css", &theme.variables_css)?; write_file(destination, "favicon.png", &theme.favicon)?; - write_file(destination, "highlight.css", &theme.highlight_css)?; write_file(destination, "tomorrow-night.css", &theme.tomorrow_night_css)?; write_file(destination, "ayu-highlight.css", &theme.ayu_highlight_css)?; - write_file(destination, "highlight.js", &theme.highlight_js)?; - write_file(destination, "clipboard.min.js", &theme.clipboard_js)?; - write_file( - destination, - "FontAwesome/css/font-awesome.css", - theme::FONT_AWESOME, - )?; - write_file( - destination, - "FontAwesome/fonts/fontawesome-webfont.eot", - theme::FONT_AWESOME_EOT, - )?; - write_file( - destination, - "FontAwesome/fonts/fontawesome-webfont.svg", - theme::FONT_AWESOME_SVG, - )?; - write_file( - destination, - "FontAwesome/fonts/fontawesome-webfont.ttf", - theme::FONT_AWESOME_TTF, - )?; - write_file( - destination, - "FontAwesome/fonts/fontawesome-webfont.woff", - theme::FONT_AWESOME_WOFF, - )?; - write_file( - destination, - "FontAwesome/fonts/fontawesome-webfont.woff2", - theme::FONT_AWESOME_WOFF2, - )?; - write_file( - destination, - "FontAwesome/fonts/FontAwesome.ttf", - theme::FONT_AWESOME_TTF, - )?; - - let playpen_config = &html_config.playpen; - - // Ace is a very large dependency, so only load it when requested - if playpen_config.editable && playpen_config.copy_js { - // Load the editor - write_file(destination, "editor.js", playpen_editor::JS)?; - write_file(destination, "ace.js", playpen_editor::ACE_JS)?; - write_file(destination, "mode-rust.js", playpen_editor::MODE_RUST_JS)?; - write_file(destination, "theme-dawn.js", playpen_editor::THEME_DAWN_JS)?; - write_file( - destination, - "theme-tomorrow_night.js", - playpen_editor::THEME_TOMORROW_NIGHT_JS, - )?; - } Ok(()) } diff --git a/vendor/mdbook/src/renderer/html_handlebars/search.rs b/vendor/mdbook/src/renderer/html_handlebars/search.rs index c27977e198..1c73de06ba 100644 --- a/vendor/mdbook/src/renderer/html_handlebars/search.rs +++ b/vendor/mdbook/src/renderer/html_handlebars/search.rs @@ -38,8 +38,6 @@ pub fn create_files(search_config: &Search, destination: &Path, book: &Book) -> format!("window.search = {};", index).as_bytes(), )?; utils::fs::write_file(destination, "searcher.js", searcher::JS)?; - utils::fs::write_file(destination, "mark.min.js", searcher::MARK_JS)?; - utils::fs::write_file(destination, "elasticlunr.min.js", searcher::ELASTICLUNR_JS)?; debug!("Copying search files ✓"); } diff --git a/vendor/mdbook/src/theme/index.hbs b/vendor/mdbook/src/theme/index.hbs index bfe4283a9d..28d9f62d8d 100644 --- a/vendor/mdbook/src/theme/index.hbs +++ b/vendor/mdbook/src/theme/index.hbs @@ -16,12 +16,10 @@ - - - + - + @@ -32,7 +30,7 @@ {{#if mathjax_support}} - + {{/if}} @@ -42,43 +40,6 @@ var default_theme = "{{ default_theme }}"; - - - - - - - - - @@ -204,41 +165,7 @@ {{/if}} - {{#if google_analytics}} - - - {{/if}} - - {{#if playpen_js}} - - - - - - {{/if}} - - {{#if search_js}} - - - - {{/if}} - - - + diff --git a/vendor/mdbook/src/theme/mod.rs b/vendor/mdbook/src/theme/mod.rs index 37d373eff3..d9feda7d09 100644 --- a/vendor/mdbook/src/theme/mod.rs +++ b/vendor/mdbook/src/theme/mod.rs @@ -1,7 +1,5 @@ #![allow(missing_docs)] -pub mod playpen_editor; - #[cfg(feature = "search")] pub mod searcher; @@ -19,23 +17,8 @@ pub static PRINT_CSS: &'static [u8] = include_bytes!("css/print.css"); pub static VARIABLES_CSS: &'static [u8] = include_bytes!("css/variables.css"); pub static FAVICON: &'static [u8] = include_bytes!("favicon.png"); pub static JS: &'static [u8] = include_bytes!("book.js"); -pub static HIGHLIGHT_JS: &'static [u8] = include_bytes!("highlight.js"); pub static TOMORROW_NIGHT_CSS: &'static [u8] = include_bytes!("tomorrow-night.css"); -pub static HIGHLIGHT_CSS: &'static [u8] = include_bytes!("highlight.css"); pub static AYU_HIGHLIGHT_CSS: &'static [u8] = include_bytes!("ayu-highlight.css"); -pub static CLIPBOARD_JS: &'static [u8] = include_bytes!("clipboard.min.js"); -pub static FONT_AWESOME: &'static [u8] = include_bytes!("FontAwesome/css/font-awesome.min.css"); -pub static FONT_AWESOME_EOT: &'static [u8] = - include_bytes!("FontAwesome/fonts/fontawesome-webfont.eot"); -pub static FONT_AWESOME_SVG: &'static [u8] = - include_bytes!("FontAwesome/fonts/fontawesome-webfont.svg"); -pub static FONT_AWESOME_TTF: &'static [u8] = - include_bytes!("FontAwesome/fonts/fontawesome-webfont.ttf"); -pub static FONT_AWESOME_WOFF: &'static [u8] = - include_bytes!("FontAwesome/fonts/fontawesome-webfont.woff"); -pub static FONT_AWESOME_WOFF2: &'static [u8] = - include_bytes!("FontAwesome/fonts/fontawesome-webfont.woff2"); -pub static FONT_AWESOME_OTF: &'static [u8] = include_bytes!("FontAwesome/fonts/FontAwesome.otf"); /// The `Theme` struct should be used instead of the static variables because /// the `new()` method will look if the user has a theme directory in their @@ -53,11 +36,8 @@ pub struct Theme { pub variables_css: Vec, pub favicon: Vec, pub js: Vec, - pub highlight_css: Vec, pub tomorrow_night_css: Vec, pub ayu_highlight_css: Vec, - pub highlight_js: Vec, - pub clipboard_js: Vec, } impl Theme { @@ -86,9 +66,6 @@ impl Theme { &mut theme.variables_css, ), (theme_dir.join("favicon.png"), &mut theme.favicon), - (theme_dir.join("highlight.js"), &mut theme.highlight_js), - (theme_dir.join("clipboard.min.js"), &mut theme.clipboard_js), - (theme_dir.join("highlight.css"), &mut theme.highlight_css), ( theme_dir.join("tomorrow-night.css"), &mut theme.tomorrow_night_css, @@ -125,11 +102,8 @@ impl Default for Theme { variables_css: VARIABLES_CSS.to_owned(), favicon: FAVICON.to_owned(), js: JS.to_owned(), - highlight_css: HIGHLIGHT_CSS.to_owned(), tomorrow_night_css: TOMORROW_NIGHT_CSS.to_owned(), ayu_highlight_css: AYU_HIGHLIGHT_CSS.to_owned(), - highlight_js: HIGHLIGHT_JS.to_owned(), - clipboard_js: CLIPBOARD_JS.to_owned(), } } } @@ -179,11 +153,8 @@ mod tests { "css/print.css", "css/variables.css", "book.js", - "highlight.js", "tomorrow-night.css", - "highlight.css", "ayu-highlight.css", - "clipboard.min.js", ]; let temp = TempFileBuilder::new().prefix("mdbook-").tempdir().unwrap(); @@ -205,11 +176,8 @@ mod tests { variables_css: Vec::new(), favicon: Vec::new(), js: Vec::new(), - highlight_css: Vec::new(), tomorrow_night_css: Vec::new(), ayu_highlight_css: Vec::new(), - highlight_js: Vec::new(), - clipboard_js: Vec::new(), }; assert_eq!(got, empty); diff --git a/vendor/mdbook/src/theme/searcher/mod.rs b/vendor/mdbook/src/theme/searcher/mod.rs index c80441d0a8..41d7e39506 100644 --- a/vendor/mdbook/src/theme/searcher/mod.rs +++ b/vendor/mdbook/src/theme/searcher/mod.rs @@ -2,5 +2,3 @@ //! the "search" cargo feature is disabled. pub static JS: &'static [u8] = include_bytes!("searcher.js"); -pub static MARK_JS: &'static [u8] = include_bytes!("mark.min.js"); -pub static ELASTICLUNR_JS: &'static [u8] = include_bytes!("elasticlunr.min.js"); -- 2.30.2