]>
Commit | Line | Data |
---|---|---|
983a9a39 XL |
1 | Description: Use local web resources instead of remote ones |
2 | Author: Matthijs van Otterdijk <matthijs@wirevirt.net> | |
315de376 | 3 | Author: Ximin Luo <infinity0@debian.org> |
983a9a39 | 4 | Bug: https://github.com/azerupi/mdBook/issues/271 |
f9f51dbf XL |
5 | Comment: |
6 | Use https://github.com/infinity0/mdBook/tree/debian to help you rebase the | |
7 | patch on top of a newer version. | |
45d026fb XL |
8 | . |
9 | Make sure the paths here match the ones in debian/rust-doc.links | |
983a9a39 XL |
10 | --- |
11 | This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ | |
f9f51dbf XL |
12 | --- a/src/tools/linkchecker/main.rs |
13 | +++ b/src/tools/linkchecker/main.rs | |
b6515096 | 14 | @@ -173,6 +173,11 @@ |
f9f51dbf XL |
15 | url.starts_with("irc:") || url.starts_with("data:") { |
16 | return; | |
17 | } | |
18 | + // Ignore parent URLs, so that the package installation process can | |
19 | + // provide a symbolic link later | |
20 | + if url.starts_with("../") { | |
21 | + return; | |
22 | + } | |
23 | let mut parts = url.splitn(2, "#"); | |
24 | let url = parts.next().unwrap(); | |
25 | let fragment = parts.next(); | |
f56f18fe XL |
26 | --- a/vendor/mdbook/src/book/init.rs |
27 | +++ b/vendor/mdbook/src/book/init.rs | |
b6515096 | 28 | @@ -149,12 +149,6 @@ |
11ae32e0 | 29 | let mut js = File::create(themedir.join("book.js"))?; |
f9f51dbf | 30 | js.write_all(theme::JS)?; |
983a9a39 | 31 | |
11ae32e0 | 32 | - let mut highlight_css = File::create(themedir.join("highlight.css"))?; |
f9f51dbf XL |
33 | - highlight_css.write_all(theme::HIGHLIGHT_CSS)?; |
34 | - | |
11ae32e0 | 35 | - let mut highlight_js = File::create(themedir.join("highlight.js"))?; |
f9f51dbf | 36 | - highlight_js.write_all(theme::HIGHLIGHT_JS)?; |
983a9a39 | 37 | - |
f9f51dbf XL |
38 | Ok(()) |
39 | } | |
40 | ||
f56f18fe XL |
41 | --- a/vendor/mdbook/src/renderer/html_handlebars/hbs_renderer.rs |
42 | +++ b/vendor/mdbook/src/renderer/html_handlebars/hbs_renderer.rs | |
11ae32e0 | 43 | @@ -3,7 +3,7 @@ |
f9f51dbf | 44 | use errors::*; |
08170615 | 45 | use renderer::html_handlebars::helpers; |
b6515096 XL |
46 | use renderer::{RenderContext, Renderer}; |
47 | -use theme::{self, playpen_editor, Theme}; | |
08170615 XL |
48 | +use theme::{self, Theme}; |
49 | use utils; | |
50 | ||
51 | use std::collections::BTreeMap; | |
b6515096 XL |
52 | @@ -107,7 +107,7 @@ |
53 | &self, | |
54 | destination: &Path, | |
55 | theme: &Theme, | |
56 | - html_config: &HtmlConfig, | |
57 | + _html_config: &HtmlConfig, | |
58 | ) -> Result<()> { | |
59 | use utils::fs::write_file; | |
60 | ||
61 | @@ -123,62 +123,8 @@ | |
62 | write_file(destination, "css/print.css", &theme.print_css)?; | |
63 | write_file(destination, "css/variables.css", &theme.variables_css)?; | |
08170615 XL |
64 | write_file(destination, "favicon.png", &theme.favicon)?; |
65 | - write_file(destination, "highlight.css", &theme.highlight_css)?; | |
66 | write_file(destination, "tomorrow-night.css", &theme.tomorrow_night_css)?; | |
67 | write_file(destination, "ayu-highlight.css", &theme.ayu_highlight_css)?; | |
68 | - write_file(destination, "highlight.js", &theme.highlight_js)?; | |
69 | - write_file(destination, "clipboard.min.js", &theme.clipboard_js)?; | |
70 | - write_file( | |
11ae32e0 | 71 | - destination, |
b6515096 | 72 | - "FontAwesome/css/font-awesome.css", |
f9f51dbf XL |
73 | - theme::FONT_AWESOME, |
74 | - )?; | |
08170615 | 75 | - write_file( |
11ae32e0 | 76 | - destination, |
b6515096 | 77 | - "FontAwesome/fonts/fontawesome-webfont.eot", |
f9f51dbf XL |
78 | - theme::FONT_AWESOME_EOT, |
79 | - )?; | |
08170615 | 80 | - write_file( |
11ae32e0 | 81 | - destination, |
b6515096 | 82 | - "FontAwesome/fonts/fontawesome-webfont.svg", |
f9f51dbf XL |
83 | - theme::FONT_AWESOME_SVG, |
84 | - )?; | |
08170615 | 85 | - write_file( |
11ae32e0 | 86 | - destination, |
b6515096 | 87 | - "FontAwesome/fonts/fontawesome-webfont.ttf", |
f9f51dbf XL |
88 | - theme::FONT_AWESOME_TTF, |
89 | - )?; | |
08170615 | 90 | - write_file( |
11ae32e0 | 91 | - destination, |
b6515096 | 92 | - "FontAwesome/fonts/fontawesome-webfont.woff", |
f9f51dbf XL |
93 | - theme::FONT_AWESOME_WOFF, |
94 | - )?; | |
08170615 | 95 | - write_file( |
11ae32e0 | 96 | - destination, |
b6515096 | 97 | - "FontAwesome/fonts/fontawesome-webfont.woff2", |
f9f51dbf XL |
98 | - theme::FONT_AWESOME_WOFF2, |
99 | - )?; | |
08170615 | 100 | - write_file( |
11ae32e0 | 101 | - destination, |
b6515096 | 102 | - "FontAwesome/fonts/FontAwesome.ttf", |
f9f51dbf XL |
103 | - theme::FONT_AWESOME_TTF, |
104 | - )?; | |
983a9a39 | 105 | - |
11ae32e0 | 106 | - let playpen_config = &html_config.playpen; |
983a9a39 | 107 | - |
f9f51dbf | 108 | - // Ace is a very large dependency, so only load it when requested |
08170615 | 109 | - if playpen_config.editable && playpen_config.copy_js { |
f9f51dbf | 110 | - // Load the editor |
08170615 XL |
111 | - write_file(destination, "editor.js", playpen_editor::JS)?; |
112 | - write_file(destination, "ace.js", playpen_editor::ACE_JS)?; | |
113 | - write_file(destination, "mode-rust.js", playpen_editor::MODE_RUST_JS)?; | |
114 | - write_file(destination, "theme-dawn.js", playpen_editor::THEME_DAWN_JS)?; | |
b6515096 XL |
115 | - write_file( |
116 | - destination, | |
11ae32e0 | 117 | - "theme-tomorrow_night.js", |
08170615 | 118 | - playpen_editor::THEME_TOMORROW_NIGHT_JS, |
11ae32e0 | 119 | - )?; |
f9f51dbf XL |
120 | - } |
121 | ||
983a9a39 XL |
122 | Ok(()) |
123 | } | |
b6515096 XL |
124 | --- a/vendor/mdbook/src/renderer/html_handlebars/search.rs |
125 | +++ b/vendor/mdbook/src/renderer/html_handlebars/search.rs | |
126 | @@ -38,8 +38,6 @@ | |
127 | format!("window.search = {};", index).as_bytes(), | |
128 | )?; | |
129 | utils::fs::write_file(destination, "searcher.js", searcher::JS)?; | |
130 | - utils::fs::write_file(destination, "mark.min.js", searcher::MARK_JS)?; | |
131 | - utils::fs::write_file(destination, "elasticlunr.min.js", searcher::ELASTICLUNR_JS)?; | |
132 | debug!("Copying search files ✓"); | |
133 | } | |
134 | ||
f56f18fe XL |
135 | --- a/vendor/mdbook/src/theme/index.hbs |
136 | +++ b/vendor/mdbook/src/theme/index.hbs | |
b6515096 XL |
137 | @@ -16,12 +16,10 @@ |
138 | <link rel="stylesheet" href="{{ path_to_root }}css/print.css" media="print"> | |
91546fe7 | 139 | |
b6515096 XL |
140 | <!-- Fonts --> |
141 | - <link rel="stylesheet" href="{{ path_to_root }}FontAwesome/css/font-awesome.css"> | |
f9f51dbf XL |
142 | - <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"> |
143 | - <link href="https://fonts.googleapis.com/css?family=Source+Code+Pro:500" rel="stylesheet" type="text/css"> | |
b6515096 | 144 | + <link rel="stylesheet" href="{{ path_to_root }}../font-awesome.min.css"> |
91546fe7 | 145 | |
b6515096 XL |
146 | <!-- Highlight.js Stylesheets --> |
147 | - <link rel="stylesheet" href="{{ path_to_root }}highlight.css"> | |
148 | + <link rel="stylesheet" href="{{ path_to_root }}../highlight.css"> | |
149 | <link rel="stylesheet" href="{{ path_to_root }}tomorrow-night.css"> | |
150 | <link rel="stylesheet" href="{{ path_to_root }}ayu-highlight.css"> | |
f9f51dbf | 151 | |
b6515096 | 152 | @@ -32,7 +30,7 @@ |
91546fe7 | 153 | |
f9f51dbf | 154 | {{#if mathjax_support}} |
91546fe7 | 155 | <!-- MathJax --> |
08170615 XL |
156 | - <script async type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> |
157 | + <script async type="text/javascript" src="../mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> | |
f9f51dbf | 158 | {{/if}} |
91546fe7 | 159 | </head> |
b6515096 XL |
160 | <body class="{{ default_theme }}"> |
161 | @@ -42,43 +40,6 @@ | |
162 | var default_theme = "{{ default_theme }}"; | |
163 | </script> | |
164 | ||
11ae32e0 XL |
165 | - <!-- Work around some values being stored in localStorage wrapped in quotes --> |
166 | - <script type="text/javascript"> | |
167 | - try { | |
168 | - var theme = localStorage.getItem('mdbook-theme'); | |
169 | - var sidebar = localStorage.getItem('mdbook-sidebar'); | |
170 | - | |
171 | - if (theme.startsWith('"') && theme.endsWith('"')) { | |
172 | - localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1)); | |
173 | - } | |
08170615 | 174 | - |
11ae32e0 XL |
175 | - if (sidebar.startsWith('"') && sidebar.endsWith('"')) { |
176 | - localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1)); | |
177 | - } | |
178 | - } catch (e) { } | |
179 | - </script> | |
b6515096 | 180 | - |
f9f51dbf XL |
181 | - <!-- Set the theme before any content is loaded, prevents flash --> |
182 | - <script type="text/javascript"> | |
11ae32e0 XL |
183 | - var theme; |
184 | - try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { } | |
b6515096 | 185 | - if (theme === null || theme === undefined) { theme = default_theme; } |
11ae32e0 | 186 | - document.body.className = theme; |
08170615 | 187 | - document.querySelector('html').className = theme + ' js'; |
f9f51dbf XL |
188 | - </script> |
189 | - | |
190 | - <!-- Hide / unhide sidebar before it is displayed --> | |
191 | - <script type="text/javascript"> | |
08170615 | 192 | - var html = document.querySelector('html'); |
11ae32e0 XL |
193 | - var sidebar = 'hidden'; |
194 | - if (document.body.clientWidth >= 1080) { | |
195 | - try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { } | |
196 | - sidebar = sidebar || 'visible'; | |
197 | - } | |
08170615 XL |
198 | - html.classList.remove('sidebar-visible'); |
199 | - html.classList.add("sidebar-" + sidebar); | |
f9f51dbf | 200 | - </script> |
b6515096 | 201 | - |
11ae32e0 | 202 | <nav id="sidebar" class="sidebar" aria-label="Table of contents"> |
f9f51dbf | 203 | {{#toc}}{{/toc}} |
b6515096 XL |
204 | </nav> |
205 | @@ -204,41 +165,7 @@ | |
11ae32e0 XL |
206 | </script> |
207 | {{/if}} | |
91546fe7 | 208 | |
f9f51dbf | 209 | - {{#if google_analytics}} |
11ae32e0 | 210 | - <!-- Google Analytics Tag --> |
08170615 | 211 | - <script type="text/javascript"> |
11ae32e0 | 212 | - var localAddrs = ["localhost", "127.0.0.1", ""]; |
b6515096 | 213 | - |
11ae32e0 XL |
214 | - // make sure we don't activate google analytics if the developer is |
215 | - // inspecting the book locally... | |
216 | - if (localAddrs.indexOf(document.location.hostname) === -1) { | |
217 | - (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ | |
218 | - (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), | |
219 | - m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) | |
220 | - })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); | |
f9f51dbf | 221 | - |
11ae32e0 XL |
222 | - ga('create', '{{google_analytics}}', 'auto'); |
223 | - ga('send', 'pageview'); | |
224 | - } | |
f9f51dbf | 225 | - </script> |
f9f51dbf | 226 | - {{/if}} |
b6515096 | 227 | - |
08170615 | 228 | - {{#if playpen_js}} |
b6515096 XL |
229 | - <script src="{{ path_to_root }}ace.js" type="text/javascript" charset="utf-8"></script> |
230 | - <script src="{{ path_to_root }}editor.js" type="text/javascript" charset="utf-8"></script> | |
231 | - <script src="{{ path_to_root }}mode-rust.js" type="text/javascript" charset="utf-8"></script> | |
232 | - <script src="{{ path_to_root }}theme-dawn.js" type="text/javascript" charset="utf-8"></script> | |
233 | - <script src="{{ path_to_root }}theme-tomorrow_night.js" type="text/javascript" charset="utf-8"></script> | |
08170615 XL |
234 | - {{/if}} |
235 | - | |
08170615 | 236 | - {{#if search_js}} |
b6515096 XL |
237 | - <script src="{{ path_to_root }}elasticlunr.min.js" type="text/javascript" charset="utf-8"></script> |
238 | - <script src="{{ path_to_root }}mark.min.js" type="text/javascript" charset="utf-8"></script> | |
239 | - <script src="{{ path_to_root }}searcher.js" type="text/javascript" charset="utf-8"></script> | |
08170615 | 240 | - {{/if}} |
b6515096 XL |
241 | - |
242 | - <script src="{{ path_to_root }}clipboard.min.js" type="text/javascript" charset="utf-8"></script> | |
243 | - <script src="{{ path_to_root }}highlight.js" type="text/javascript" charset="utf-8"></script> | |
244 | + <script src="{{ path_to_root }}../highlight.js" type="text/javascript" charset="utf-8"></script> | |
245 | <script src="{{ path_to_root }}book.js" type="text/javascript" charset="utf-8"></script> | |
08170615 XL |
246 | |
247 | <!-- Custom JS scripts --> | |
f56f18fe XL |
248 | --- a/vendor/mdbook/src/theme/mod.rs |
249 | +++ b/vendor/mdbook/src/theme/mod.rs | |
08170615 XL |
250 | @@ -1,7 +1,5 @@ |
251 | #![allow(missing_docs)] | |
252 | ||
f9f51dbf XL |
253 | -pub mod playpen_editor; |
254 | - | |
08170615 XL |
255 | #[cfg(feature = "search")] |
256 | pub mod searcher; | |
257 | ||
b6515096 XL |
258 | @@ -19,23 +17,8 @@ |
259 | pub static VARIABLES_CSS: &'static [u8] = include_bytes!("css/variables.css"); | |
f9f51dbf XL |
260 | pub static FAVICON: &'static [u8] = include_bytes!("favicon.png"); |
261 | pub static JS: &'static [u8] = include_bytes!("book.js"); | |
262 | -pub static HIGHLIGHT_JS: &'static [u8] = include_bytes!("highlight.js"); | |
263 | pub static TOMORROW_NIGHT_CSS: &'static [u8] = include_bytes!("tomorrow-night.css"); | |
264 | -pub static HIGHLIGHT_CSS: &'static [u8] = include_bytes!("highlight.css"); | |
265 | pub static AYU_HIGHLIGHT_CSS: &'static [u8] = include_bytes!("ayu-highlight.css"); | |
f9f51dbf | 266 | -pub static CLIPBOARD_JS: &'static [u8] = include_bytes!("clipboard.min.js"); |
b6515096 | 267 | -pub static FONT_AWESOME: &'static [u8] = include_bytes!("FontAwesome/css/font-awesome.min.css"); |
11ae32e0 | 268 | -pub static FONT_AWESOME_EOT: &'static [u8] = |
b6515096 | 269 | - include_bytes!("FontAwesome/fonts/fontawesome-webfont.eot"); |
11ae32e0 | 270 | -pub static FONT_AWESOME_SVG: &'static [u8] = |
b6515096 | 271 | - include_bytes!("FontAwesome/fonts/fontawesome-webfont.svg"); |
11ae32e0 | 272 | -pub static FONT_AWESOME_TTF: &'static [u8] = |
b6515096 | 273 | - include_bytes!("FontAwesome/fonts/fontawesome-webfont.ttf"); |
11ae32e0 | 274 | -pub static FONT_AWESOME_WOFF: &'static [u8] = |
b6515096 | 275 | - include_bytes!("FontAwesome/fonts/fontawesome-webfont.woff"); |
11ae32e0 | 276 | -pub static FONT_AWESOME_WOFF2: &'static [u8] = |
b6515096 XL |
277 | - include_bytes!("FontAwesome/fonts/fontawesome-webfont.woff2"); |
278 | -pub static FONT_AWESOME_OTF: &'static [u8] = include_bytes!("FontAwesome/fonts/FontAwesome.otf"); | |
f9f51dbf XL |
279 | |
280 | /// The `Theme` struct should be used instead of the static variables because | |
b6515096 XL |
281 | /// the `new()` method will look if the user has a theme directory in their |
282 | @@ -53,11 +36,8 @@ | |
283 | pub variables_css: Vec<u8>, | |
f9f51dbf XL |
284 | pub favicon: Vec<u8>, |
285 | pub js: Vec<u8>, | |
286 | - pub highlight_css: Vec<u8>, | |
287 | pub tomorrow_night_css: Vec<u8>, | |
288 | pub ayu_highlight_css: Vec<u8>, | |
289 | - pub highlight_js: Vec<u8>, | |
290 | - pub clipboard_js: Vec<u8>, | |
f9f51dbf XL |
291 | } |
292 | ||
293 | impl Theme { | |
b6515096 XL |
294 | @@ -86,9 +66,6 @@ |
295 | &mut theme.variables_css, | |
296 | ), | |
f9f51dbf XL |
297 | (theme_dir.join("favicon.png"), &mut theme.favicon), |
298 | - (theme_dir.join("highlight.js"), &mut theme.highlight_js), | |
299 | - (theme_dir.join("clipboard.min.js"), &mut theme.clipboard_js), | |
f9f51dbf | 300 | - (theme_dir.join("highlight.css"), &mut theme.highlight_css), |
b6515096 XL |
301 | ( |
302 | theme_dir.join("tomorrow-night.css"), | |
303 | &mut theme.tomorrow_night_css, | |
304 | @@ -125,11 +102,8 @@ | |
305 | variables_css: VARIABLES_CSS.to_owned(), | |
f9f51dbf XL |
306 | favicon: FAVICON.to_owned(), |
307 | js: JS.to_owned(), | |
308 | - highlight_css: HIGHLIGHT_CSS.to_owned(), | |
309 | tomorrow_night_css: TOMORROW_NIGHT_CSS.to_owned(), | |
310 | ayu_highlight_css: AYU_HIGHLIGHT_CSS.to_owned(), | |
311 | - highlight_js: HIGHLIGHT_JS.to_owned(), | |
312 | - clipboard_js: CLIPBOARD_JS.to_owned(), | |
f9f51dbf XL |
313 | } |
314 | } | |
315 | } | |
b6515096 XL |
316 | @@ -179,11 +153,8 @@ |
317 | "css/print.css", | |
318 | "css/variables.css", | |
319 | "book.js", | |
320 | - "highlight.js", | |
321 | "tomorrow-night.css", | |
322 | - "highlight.css", | |
323 | "ayu-highlight.css", | |
324 | - "clipboard.min.js", | |
325 | ]; | |
326 | ||
327 | let temp = TempFileBuilder::new().prefix("mdbook-").tempdir().unwrap(); | |
328 | @@ -205,11 +176,8 @@ | |
329 | variables_css: Vec::new(), | |
d5fa6b7e XL |
330 | favicon: Vec::new(), |
331 | js: Vec::new(), | |
332 | - highlight_css: Vec::new(), | |
f9f51dbf XL |
333 | tomorrow_night_css: Vec::new(), |
334 | ayu_highlight_css: Vec::new(), | |
d5fa6b7e | 335 | - highlight_js: Vec::new(), |
f9f51dbf | 336 | - clipboard_js: Vec::new(), |
f9f51dbf XL |
337 | }; |
338 | ||
339 | assert_eq!(got, empty); | |
f56f18fe XL |
340 | --- a/vendor/mdbook/src/theme/searcher/mod.rs |
341 | +++ b/vendor/mdbook/src/theme/searcher/mod.rs | |
08170615 XL |
342 | @@ -2,5 +2,3 @@ |
343 | //! the "search" cargo feature is disabled. | |
344 | ||
345 | pub static JS: &'static [u8] = include_bytes!("searcher.js"); | |
346 | -pub static MARK_JS: &'static [u8] = include_bytes!("mark.min.js"); | |
347 | -pub static ELASTICLUNR_JS: &'static [u8] = include_bytes!("elasticlunr.min.js"); |