1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410
|
From: Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
Date: Sat, 2 Oct 2021 01:08:00 +0100
Subject: d-0002-mdbook-strip-embedded-libs
Description: Use https://github.com/infinity0/mdBook/tree/debian to help you rebase
the patch on top of a newer version. . Make sure the paths here match the ones
in debian/rust-doc.links
Forwarded: not-needed
---
src/tools/linkchecker/main.rs | 28 +++++++-
vendor/mdbook-0.4.52/src/book/init.rs | 19 -----
vendor/mdbook-0.4.52/src/front-end/mod.rs | 26 -------
vendor/mdbook-0.4.52/src/front-end/searcher/mod.rs | 2 -
.../src/front-end/templates/index.hbs | 48 +------------
.../src/front-end/templates/toc.html.hbs | 3 +-
.../src/renderer/html_handlebars/search.rs | 2 -
.../src/renderer/html_handlebars/static_files.rs | 84 +++++-----------------
8 files changed, 48 insertions(+), 164 deletions(-)
diff --git a/src/tools/linkchecker/main.rs b/src/tools/linkchecker/main.rs
index 1dc4572..8b2b73a1 100644
--- a/src/tools/linkchecker/main.rs
+++ b/src/tools/linkchecker/main.rs
@@ -252,7 +252,17 @@ impl Checker {
for entry in t!(dir.read_dir()).map(|e| t!(e)) {
let path = entry.path();
// Goes through symlinks
- let metadata = t!(fs::metadata(&path));
+ let metadata = fs::metadata(&path);
+ if let Err(err) = metadata {
+ if let Ok(target) = fs::read_link(&path) {
+ if target.starts_with("/usr/share") {
+ // broken symlink to /usr/share, ok for our Debian build
+ return;
+ }
+ }
+ panic!("error at file {:?} while walking - {:?}", path, err)
+ }
+ let metadata = t!(metadata);
if metadata.is_dir() {
self.walk(&path, report);
} else {
@@ -265,7 +275,15 @@ impl Checker {
fn check(&mut self, file: &Path, report: &mut Report) {
let (pretty_path, entry) = self.load_file(file, report);
let source = match entry {
- FileEntry::Missing => panic!("missing file {:?} while walking", file),
+ FileEntry::Missing => {
+ if let Ok(target) = fs::read_link(&file) {
+ if target.starts_with("/usr/share") {
+ // broken symlink to /usr/share, ok for our Debian build
+ return;
+ }
+ }
+ panic!("missing file {:?} while walking", file)
+ }
FileEntry::Dir => unreachable!("never with `check` path"),
FileEntry::OtherFile => return,
FileEntry::Redirect { .. } => return,
@@ -354,6 +372,12 @@ impl Checker {
let (target_pretty_path, target_entry) = self.load_file(&path, report);
let (target_source, target_ids) = match target_entry {
FileEntry::Missing => {
+ if let Ok(target) = fs::read_link(&path) {
+ if target.starts_with("/usr/share") {
+ // broken symlink to /usr/share, ok for our Debian build
+ return;
+ }
+ }
if is_exception(file, &target_pretty_path) {
report.links_ignored_exception += 1;
} else {
diff --git a/vendor/mdbook-0.4.52/src/book/init.rs b/vendor/mdbook-0.4.52/src/book/init.rs
index faca1d0..c1a82a3 100644
--- a/vendor/mdbook-0.4.52/src/book/init.rs
+++ b/vendor/mdbook-0.4.52/src/book/init.rs
@@ -153,25 +153,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)?;
-
- write_file(&themedir.join("fonts"), "fonts.css", theme::fonts::CSS)?;
- for (file_name, contents) in theme::fonts::LICENSES {
- write_file(&themedir, file_name, contents)?;
- }
- for (file_name, contents) in theme::fonts::OPEN_SANS.iter() {
- write_file(&themedir, file_name, contents)?;
- }
- write_file(
- &themedir,
- theme::fonts::SOURCE_CODE_PRO.0,
- theme::fonts::SOURCE_CODE_PRO.1,
- )?;
-
Ok(())
}
diff --git a/vendor/mdbook-0.4.52/src/front-end/mod.rs b/vendor/mdbook-0.4.52/src/front-end/mod.rs
index 8fd09fc..566f745 100644
--- a/vendor/mdbook-0.4.52/src/front-end/mod.rs
+++ b/vendor/mdbook-0.4.52/src/front-end/mod.rs
@@ -1,9 +1,5 @@
#![allow(missing_docs)]
-pub mod playground_editor;
-
-pub mod fonts;
-
#[cfg(feature = "search")]
pub mod searcher;
@@ -26,18 +22,8 @@ pub static VARIABLES_CSS: &[u8] = include_bytes!("css/variables.css");
pub static FAVICON_PNG: &[u8] = include_bytes!("images/favicon.png");
pub static FAVICON_SVG: &[u8] = include_bytes!("images/favicon.svg");
pub static JS: &[u8] = include_bytes!("js/book.js");
-pub static HIGHLIGHT_JS: &[u8] = include_bytes!("js/highlight.js");
pub static TOMORROW_NIGHT_CSS: &[u8] = include_bytes!("css/tomorrow-night.css");
-pub static HIGHLIGHT_CSS: &[u8] = include_bytes!("css/highlight.css");
pub static AYU_HIGHLIGHT_CSS: &[u8] = include_bytes!("css/ayu-highlight.css");
-pub static CLIPBOARD_JS: &[u8] = include_bytes!("js/clipboard.min.js");
-pub static FONT_AWESOME: &[u8] = include_bytes!("css/font-awesome.min.css");
-pub static FONT_AWESOME_EOT: &[u8] = include_bytes!("fonts/fontawesome-webfont.eot");
-pub static FONT_AWESOME_SVG: &[u8] = include_bytes!("fonts/fontawesome-webfont.svg");
-pub static FONT_AWESOME_TTF: &[u8] = include_bytes!("fonts/fontawesome-webfont.ttf");
-pub static FONT_AWESOME_WOFF: &[u8] = include_bytes!("fonts/fontawesome-webfont.woff");
-pub static FONT_AWESOME_WOFF2: &[u8] = include_bytes!("fonts/fontawesome-webfont.woff2");
-pub static FONT_AWESOME_OTF: &[u8] = include_bytes!("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
@@ -62,11 +48,8 @@ pub struct Theme {
pub favicon_png: Option<Vec<u8>>,
pub favicon_svg: Option<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 {
@@ -98,9 +81,6 @@ impl Theme {
theme_dir.join("css/variables.css"),
&mut theme.variables_css,
),
- (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,
@@ -190,11 +170,8 @@ impl Default for Theme {
favicon_png: Some(FAVICON_PNG.to_owned()),
favicon_svg: Some(FAVICON_SVG.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(),
}
}
}
@@ -283,11 +260,8 @@ mod tests {
favicon_png: Some(Vec::new()),
favicon_svg: Some(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-0.4.52/src/front-end/searcher/mod.rs b/vendor/mdbook-0.4.52/src/front-end/searcher/mod.rs
index d5029db..59eda8a 100644
--- a/vendor/mdbook-0.4.52/src/front-end/searcher/mod.rs
+++ b/vendor/mdbook-0.4.52/src/front-end/searcher/mod.rs
@@ -2,5 +2,3 @@
//! the "search" cargo feature is disabled.
pub static JS: &[u8] = include_bytes!("searcher.js");
-pub static MARK_JS: &[u8] = include_bytes!("mark.min.js");
-pub static ELASTICLUNR_JS: &[u8] = include_bytes!("elasticlunr.min.js");
diff --git a/vendor/mdbook-0.4.52/src/front-end/templates/index.hbs b/vendor/mdbook-0.4.52/src/front-end/templates/index.hbs
index 1be5bdb..57c53cb 100644
--- a/vendor/mdbook-0.4.52/src/front-end/templates/index.hbs
+++ b/vendor/mdbook-0.4.52/src/front-end/templates/index.hbs
@@ -33,10 +33,7 @@
{{/if}}
<!-- Fonts -->
- <link rel="stylesheet" href="{{ resource "FontAwesome/css/font-awesome.css" }}">
- {{#if copy_fonts}}
- <link rel="stylesheet" href="{{ resource "fonts/fonts.css" }}">
- {{/if}}
+ <link rel="stylesheet" href="{{ path_to_root }}css/font-awesome.min.css">
<!-- Highlight.js Stylesheets -->
<link rel="stylesheet" id="highlight-css" href="{{ resource "highlight.css" }}">
@@ -50,7 +47,7 @@
{{#if mathjax_support}}
<!-- MathJax -->
- <script async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+ <script async src="MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
{{/if}}
<!-- Provide site root and default themes to javascript -->
@@ -275,48 +272,7 @@
</script>
{{/if}}
- {{#if google_analytics}}
- <!-- Google Analytics Tag -->
- <script>
- const 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 playground_line_numbers}}
- <script>
- window.playground_line_numbers = true;
- </script>
- {{/if}}
-
- {{#if playground_copyable}}
- <script>
- window.playground_copyable = true;
- </script>
- {{/if}}
-
- {{#if playground_js}}
- <script src="{{ resource "ace.js" }}"></script>
- <script src="{{ resource "mode-rust.js" }}"></script>
- <script src="{{ resource "editor.js" }}"></script>
- <script src="{{ resource "theme-dawn.js" }}"></script>
- <script src="{{ resource "theme-tomorrow_night.js" }}"></script>
- {{/if}}
-
{{#if search_js}}
- <script src="{{ resource "elasticlunr.min.js" }}"></script>
- <script src="{{ resource "mark.min.js" }}"></script>
<script src="{{ resource "searcher.js" }}"></script>
{{/if}}
diff --git a/vendor/mdbook-0.4.52/src/front-end/templates/toc.html.hbs b/vendor/mdbook-0.4.52/src/front-end/templates/toc.html.hbs
index 93dea25..2853ec6 100644
--- a/vendor/mdbook-0.4.52/src/front-end/templates/toc.html.hbs
+++ b/vendor/mdbook-0.4.52/src/front-end/templates/toc.html.hbs
@@ -28,9 +28,8 @@
<link rel="stylesheet" href="{{ resource "css/print.css" }}" media="print">
{{/if}}
<!-- Fonts -->
- <link rel="stylesheet" href="{{ resource "FontAwesome/css/font-awesome.css" }}">
+ <link rel="stylesheet" href="{{ path_to_root }}css/font-awesome.min.css">
{{#if copy_fonts}}
- <link rel="stylesheet" href="{{ resource "fonts/fonts.css" }}">
{{/if}}
<!-- Custom theme stylesheets -->
{{#each additional_css}}
diff --git a/vendor/mdbook-0.4.52/src/renderer/html_handlebars/search.rs b/vendor/mdbook-0.4.52/src/renderer/html_handlebars/search.rs
index ea8ae42..867788c 100644
--- a/vendor/mdbook-0.4.52/src/renderer/html_handlebars/search.rs
+++ b/vendor/mdbook-0.4.52/src/renderer/html_handlebars/search.rs
@@ -75,8 +75,6 @@ pub fn create_files(
.as_bytes(),
);
static_files.add_builtin("searcher.js", searcher::JS);
- static_files.add_builtin("mark.min.js", searcher::MARK_JS);
- static_files.add_builtin("elasticlunr.min.js", searcher::ELASTICLUNR_JS);
debug!("Copying search files ✓");
}
diff --git a/vendor/mdbook-0.4.52/src/renderer/html_handlebars/static_files.rs b/vendor/mdbook-0.4.52/src/renderer/html_handlebars/static_files.rs
index e1531f4..9d19e4a 100644
--- a/vendor/mdbook-0.4.52/src/renderer/html_handlebars/static_files.rs
+++ b/vendor/mdbook-0.4.52/src/renderer/html_handlebars/static_files.rs
@@ -5,12 +5,13 @@ use log::{debug, warn};
use crate::config::HtmlConfig;
use crate::errors::*;
use crate::renderer::html_handlebars::helpers::resources::ResourceHelper;
-use crate::theme::{self, playground_editor, Theme};
+use crate::theme::{self, Theme};
use crate::utils;
use std::borrow::Cow;
use std::collections::HashMap;
use std::fs::{self, File};
+use std::os::unix::fs::symlink;
use std::path::{Path, PathBuf};
use std::sync::LazyLock;
@@ -59,72 +60,8 @@ impl StaticFiles {
if let Some(contents) = &theme.favicon_svg {
this.add_builtin("favicon.svg", contents);
}
- this.add_builtin("highlight.css", &theme.highlight_css);
this.add_builtin("tomorrow-night.css", &theme.tomorrow_night_css);
this.add_builtin("ayu-highlight.css", &theme.ayu_highlight_css);
- this.add_builtin("highlight.js", &theme.highlight_js);
- this.add_builtin("clipboard.min.js", &theme.clipboard_js);
- this.add_builtin("FontAwesome/css/font-awesome.css", theme::FONT_AWESOME);
- this.add_builtin(
- "FontAwesome/fonts/fontawesome-webfont.eot",
- theme::FONT_AWESOME_EOT,
- );
- this.add_builtin(
- "FontAwesome/fonts/fontawesome-webfont.svg",
- theme::FONT_AWESOME_SVG,
- );
- this.add_builtin(
- "FontAwesome/fonts/fontawesome-webfont.ttf",
- theme::FONT_AWESOME_TTF,
- );
- this.add_builtin(
- "FontAwesome/fonts/fontawesome-webfont.woff",
- theme::FONT_AWESOME_WOFF,
- );
- this.add_builtin(
- "FontAwesome/fonts/fontawesome-webfont.woff2",
- theme::FONT_AWESOME_WOFF2,
- );
- this.add_builtin("FontAwesome/fonts/FontAwesome.ttf", theme::FONT_AWESOME_TTF);
- if html_config.copy_fonts && theme.fonts_css.is_none() {
- this.add_builtin("fonts/fonts.css", theme::fonts::CSS);
- for (file_name, contents) in theme::fonts::LICENSES.iter() {
- this.add_builtin(file_name, contents);
- }
- for (file_name, contents) in theme::fonts::OPEN_SANS.iter() {
- this.add_builtin(file_name, contents);
- }
- this.add_builtin(
- theme::fonts::SOURCE_CODE_PRO.0,
- theme::fonts::SOURCE_CODE_PRO.1,
- );
- } else if let Some(fonts_css) = &theme.fonts_css {
- if !fonts_css.is_empty() {
- this.add_builtin("fonts/fonts.css", fonts_css);
- }
- }
- if !html_config.copy_fonts && theme.fonts_css.is_none() {
- warn!(
- "output.html.copy-fonts is deprecated.\n\
- This book appears to have copy-fonts=false in book.toml without a fonts.css file.\n\
- Add an empty `theme/fonts/fonts.css` file to squelch this warning."
- );
- }
-
- let playground_config = &html_config.playground;
-
- // Ace is a very large dependency, so only load it when requested
- if playground_config.editable && playground_config.copy_js {
- // Load the editor
- this.add_builtin("editor.js", playground_editor::JS);
- this.add_builtin("ace.js", playground_editor::ACE_JS);
- this.add_builtin("mode-rust.js", playground_editor::MODE_RUST_JS);
- this.add_builtin("theme-dawn.js", playground_editor::THEME_DAWN_JS);
- this.add_builtin(
- "theme-tomorrow_night.js",
- playground_editor::THEME_TOMORROW_NIGHT_JS,
- );
- }
let custom_files = html_config
.additional_css
@@ -292,6 +229,23 @@ impl StaticFiles {
}
}
}
+ symlink(
+ "/usr/share/javascript/highlight.js/styles/atelier-dune-light.css",
+ destination.join("highlight.css"),
+ )?;
+ symlink(
+ "/usr/share/fonts-font-awesome/css/font-awesome.min.css",
+ destination.join("css/font-awesome.min.css"),
+ )?;
+ symlink(
+ "/usr/share/fonts-font-awesome/fonts",
+ destination.join("fonts"),
+ )?;
+
+ symlink(
+ "/usr/share/javascript/mathjax/MathJax.js",
+ destination.join("MathJax.js"),
+ )?;
let hash_map = self.hash_map;
Ok(ResourceHelper { hash_map })
}
|