d-no-web-dependencies-in-doc
authorDebian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
Sun, 17 Mar 2019 23:40:05 +0000 (23:40 +0000)
committerXimin Luo <infinity0@debian.org>
Sun, 17 Mar 2019 23:40:05 +0000 (23:40 +0000)
Gbp-Pq: Name d-no-web-dependencies-in-doc.patch

src/tools/linkchecker/main.rs
vendor/mdbook/src/book/init.rs
vendor/mdbook/src/renderer/html_handlebars/hbs_renderer.rs
vendor/mdbook/src/renderer/html_handlebars/search.rs
vendor/mdbook/src/theme/index.hbs
vendor/mdbook/src/theme/mod.rs
vendor/mdbook/src/theme/searcher/mod.rs

index 11c83819eaa93527b6152d0fd7c061195c5c1dfa..9ca59c7753d79e162e86d5c44f5f9e0afe686cbc 100644 (file)
@@ -180,6 +180,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();
index 909b8cbf0bba0b0f9c312349e475d7b094e11e79..9f1388e3a9ec1f61818020c7cf20e9eca2a514d6 100644 (file)
@@ -136,12 +136,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(())
     }
 
index fbaad5239adfc6db23066ee59398cac822c8432c..7feb727f80762d1960f6ec54702fc4ec626a3290 100644 (file)
@@ -3,7 +3,7 @@ use config::{Config, HtmlConfig, Playpen};
 use errors::*;
 use renderer::{RenderContext, Renderer};
 use renderer::html_handlebars::helpers;
-use theme::{self, Theme, playpen_editor};
+use theme::{self, Theme};
 use utils;
 
 use std::collections::BTreeMap;
@@ -145,61 +145,8 @@ impl HtmlHandlebars {
         write_file(destination, "book.js", &theme.js)?;
         write_file(destination, "book.css", &theme.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(())
     }
index d49772f8b20c827d48a0aa4bb0bcbf40f7907044..5986392c7edfcd67a430b7448c54d405d06e5823 100644 (file)
@@ -29,8 +29,6 @@ pub fn create_files(search_config: &Search, destination: &Path, book: &Book) ->
     if search_config.copy_js {
         utils::fs::write_file(destination, "searchindex.js", 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 ✓");
     }
 
index 5a9180decd6159cda76b593a8c6c3134c5fbee1e..d1531dc1e37e4f40f1ad92cca76b1e4fb4e2cb5a 100644 (file)
         <base href="{{ path_to_root }}">
 
         <link rel="stylesheet" href="book.css">
-        <link href="https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800" rel="stylesheet" type="text/css">
-        <link href="https://fonts.googleapis.com/css?family=Source+Code+Pro:500" rel="stylesheet" type="text/css">
 
         <link rel="shortcut icon" href="{{ favicon }}">
 
         <!-- Font Awesome -->
-        <link rel="stylesheet" href="_FontAwesome/css/font-awesome.css">
+        <link rel="stylesheet" href="../font-awesome.min.css">
 
-        <link rel="stylesheet" href="highlight.css">
+        <link rel="stylesheet" href="../highlight.css">
         <link rel="stylesheet" href="tomorrow-night.css">
         <link rel="stylesheet" href="ayu-highlight.css">
 
 
         {{#if mathjax_support}}
         <!-- MathJax -->
-        <script async type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+        <script async type="text/javascript" src="../mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
         {{/if}}
 
     </head>
     <body class="light">
-        <!-- Work around some values being stored in localStorage wrapped in quotes -->
-        <script type="text/javascript">
-            try {
-                var theme = localStorage.getItem('mdbook-theme');
-                var sidebar = localStorage.getItem('mdbook-sidebar');
-
-                if (theme.startsWith('"') && theme.endsWith('"')) {
-                    localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
-                }
-
-                if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
-                    localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
-                }
-            } catch (e) { }
-        </script>
 
-        <!-- Set the theme before any content is loaded, prevents flash -->
-        <script type="text/javascript">
-            var theme;
-            try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { } 
-            if (theme === null || theme === undefined) { theme = 'light'; }
-            document.body.className = theme;
-            document.querySelector('html').className = theme + ' js';
-        </script>
-
-        <!-- Hide / unhide sidebar before it is displayed -->
-        <script type="text/javascript">
-            var html = document.querySelector('html');
-            var sidebar = 'hidden';
-            if (document.body.clientWidth >= 1080) {
-                try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
-                sidebar = sidebar || 'visible';
-            }
-            html.classList.remove('sidebar-visible');
-            html.classList.add("sidebar-" + sidebar);
-        </script>
 
         <nav id="sidebar" class="sidebar" aria-label="Table of contents">
             {{#toc}}{{/toc}}
         </script>
         {{/if}}
 
-        {{#if google_analytics}}
-        <!-- Google Analytics Tag -->
-        <script type="text/javascript">
-            var localAddrs = ["localhost", "127.0.0.1", ""];
-
-            // make sure we don't activate google analytics if the developer is
-            // inspecting the book locally...
-            if (localAddrs.indexOf(document.location.hostname) === -1) {
-                (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
-                (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
-                m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
-                })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
-
-                ga('create', '{{google_analytics}}', 'auto');
-                ga('send', 'pageview');
-            }
-        </script>
-        {{/if}}
+
 
         {{#if is_print}}
         <script type="text/javascript">
         </script>
         {{/if}}
 
-        {{#if playpen_js}}
-        <script src="ace.js" type="text/javascript" charset="utf-8"></script>
-        <script src="editor.js" type="text/javascript" charset="utf-8"></script>
-        <script src="mode-rust.js" type="text/javascript" charset="utf-8"></script>
-        <script src="theme-dawn.js" type="text/javascript" charset="utf-8"></script>
-        <script src="theme-tomorrow_night.js" type="text/javascript" charset="utf-8"></script>
-        {{/if}}
-
         {{#if search_enabled}}
         <script src="searchindex.js" type="text/javascript" charset="utf-8"></script>
         {{/if}}
-        {{#if search_js}}
-        <script src="elasticlunr.min.js" type="text/javascript" charset="utf-8"></script>
-        <script src="mark.min.js" type="text/javascript" charset="utf-8"></script>
-        <script src="searcher.js" type="text/javascript" charset="utf-8"></script>
-        {{/if}}
 
-        <script src="clipboard.min.js" type="text/javascript" charset="utf-8"></script>
-        <script src="highlight.js" type="text/javascript" charset="utf-8"></script>
+        <script src="../highlight.js" type="text/javascript" charset="utf-8"></script>
         <script src="book.js" type="text/javascript" charset="utf-8"></script>
 
         <!-- Custom JS scripts -->
index f80b8dccaa8d0a2cd814f1bb6df93a16b5d455ae..520c3f99c150059d2106877bffeec2cbbb683c23 100644 (file)
@@ -1,7 +1,5 @@
 #![allow(missing_docs)]
 
-pub mod playpen_editor;
-
 #[cfg(feature = "search")]
 pub mod searcher;
 
@@ -16,23 +14,8 @@ pub static HEADER: &'static [u8] = include_bytes!("header.hbs");
 pub static CSS: &'static [u8] = include_bytes!("book.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
@@ -48,11 +31,8 @@ pub struct Theme {
     pub css: Vec<u8>,
     pub favicon: Vec<u8>,
     pub js: Vec<u8>,
-    pub highlight_css: Vec<u8>,
     pub tomorrow_night_css: Vec<u8>,
     pub ayu_highlight_css: Vec<u8>,
-    pub highlight_js: Vec<u8>,
-    pub clipboard_js: Vec<u8>,
 }
 
 impl Theme {
@@ -75,9 +55,6 @@ impl Theme {
                 (theme_dir.join("book.js"), &mut theme.js),
                 (theme_dir.join("book.css"), &mut theme.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),
                 (theme_dir.join("ayu-highlight.css"), &mut theme.ayu_highlight_css),
             ];
@@ -105,11 +82,8 @@ impl Default for Theme {
             css: 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(),
         }
     }
 }
@@ -175,11 +149,8 @@ mod tests {
             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);
index c80441d0a8985913c89f5e4814cf74820cc776aa..41d7e3950683423e390c0ca076ca0cc4f98d97d0 100644 (file)
@@ -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");