summaryrefslogtreecommitdiffstats
path: root/debian/patches/d-0002-mdbook-strip-embedded-libs.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/d-0002-mdbook-strip-embedded-libs.patch')
-rw-r--r--debian/patches/d-0002-mdbook-strip-embedded-libs.patch119
1 files changed, 84 insertions, 35 deletions
diff --git a/debian/patches/d-0002-mdbook-strip-embedded-libs.patch b/debian/patches/d-0002-mdbook-strip-embedded-libs.patch
index cd17dc2e6..81a0e2792 100644
--- a/debian/patches/d-0002-mdbook-strip-embedded-libs.patch
+++ b/debian/patches/d-0002-mdbook-strip-embedded-libs.patch
@@ -4,14 +4,14 @@ Subject: d-0002-mdbook-strip-embedded-libs
Comment: 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
---
- src/tools/linkchecker/main.rs | 28 ++++++-
- vendor/mdbook/src/book/init.rs | 6 --
- .../src/renderer/html_handlebars/hbs_renderer.rs | 80 ++----------------
- .../mdbook/src/renderer/html_handlebars/search.rs | 2 -
- vendor/mdbook/src/theme/index.hbs | 97 +---------------------
- vendor/mdbook/src/theme/mod.rs | 27 ------
- vendor/mdbook/src/theme/searcher/mod.rs | 2 -
- 7 files changed, 37 insertions(+), 205 deletions(-)
+ src/tools/linkchecker/main.rs | 28 +++++-
+ vendor/mdbook/src/book/init.rs | 19 ----
+ .../src/renderer/html_handlebars/hbs_renderer.rs | 110 ++++-----------------
+ .../mdbook/src/renderer/html_handlebars/search.rs | 2 -
+ vendor/mdbook/src/theme/index.hbs | 99 +------------------
+ vendor/mdbook/src/theme/mod.rs | 27 -----
+ vendor/mdbook/src/theme/searcher/mod.rs | 2 -
+ 7 files changed, 47 insertions(+), 240 deletions(-)
diff --git a/src/tools/linkchecker/main.rs b/src/tools/linkchecker/main.rs
index 4170c32..d7dcda7 100644
@@ -67,10 +67,10 @@ index 4170c32..d7dcda7 100644
report.links_ignored_exception += 1;
} else {
diff --git a/vendor/mdbook/src/book/init.rs b/vendor/mdbook/src/book/init.rs
-index dd3fa8b..a088517 100644
+index ebcdd93..41dab42 100644
--- a/vendor/mdbook/src/book/init.rs
+++ b/vendor/mdbook/src/book/init.rs
-@@ -152,12 +152,6 @@ impl BookBuilder {
+@@ -153,25 +153,6 @@ impl BookBuilder {
let mut js = File::create(themedir.join("book.js"))?;
js.write_all(theme::JS)?;
@@ -80,14 +80,27 @@ index dd3fa8b..a088517 100644
- 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/src/renderer/html_handlebars/hbs_renderer.rs b/vendor/mdbook/src/renderer/html_handlebars/hbs_renderer.rs
-index 1b648da..5fe813c 100644
+index e170e2f..caa2eff 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 crate::config::{BookConfig, Config, HtmlConfig, Playground, RustEdition};
+@@ -3,13 +3,14 @@ use crate::config::{BookConfig, Config, HtmlConfig, Playground, RustEdition};
use crate::errors::*;
use crate::renderer::html_handlebars::helpers;
use crate::renderer::{RenderContext, Renderer};
@@ -96,15 +109,14 @@ index 1b648da..5fe813c 100644
use crate::utils;
use std::borrow::Cow;
-@@ -11,6 +11,7 @@ use std::collections::BTreeMap;
+ use std::collections::BTreeMap;
use std::collections::HashMap;
use std::fs::{self, File};
- use std::path::{Path, PathBuf};
+use std::os::unix::fs::symlink;
+ use std::path::{Path, PathBuf};
use crate::utils::fs::get_404_output_file;
- use handlebars::Handlebars;
-@@ -235,80 +236,13 @@ impl HtmlHandlebars {
+@@ -235,105 +236,28 @@ impl HtmlHandlebars {
if let Some(contents) = &theme.favicon_svg {
write_file(destination, "favicon.svg", contents)?;
}
@@ -127,27 +139,42 @@ index 1b648da..5fe813c 100644
- destination,
- "FontAwesome/fonts/fontawesome-webfont.svg",
- theme::FONT_AWESOME_SVG,
-- )?;
++ symlink(
++ "/usr/share/fonts-font-awesome/css/font-awesome.min.css",
++ destination.join("css/font-awesome.min.css"),
+ )?;
- write_file(
- destination,
- "FontAwesome/fonts/fontawesome-webfont.ttf",
- theme::FONT_AWESOME_TTF,
-- )?;
++ symlink(
++ "/usr/share/fonts-font-awesome/fonts",
++ destination.join("fonts"),
+ )?;
- write_file(
- destination,
- "FontAwesome/fonts/fontawesome-webfont.woff",
- theme::FONT_AWESOME_WOFF,
-- )?;
++ symlink(
++ "/usr/share/javascript/highlight.js/styles/atelier-dune-light.css",
++ destination.join("highlight.css"),
+ )?;
- write_file(
- destination,
- "FontAwesome/fonts/fontawesome-webfont.woff2",
- theme::FONT_AWESOME_WOFF2,
-- )?;
++ symlink(
++ "/usr/share/javascript/highlight.js/highlight.js",
++ destination.join("highlight.js"),
+ )?;
- write_file(
- destination,
- "FontAwesome/fonts/FontAwesome.ttf",
- theme::FONT_AWESOME_TTF,
-- )?;
++ symlink(
++ "/usr/share/javascript/mathjax/MathJax.js",
++ destination.join("MathJax.js"),
+ )?;
- if html_config.copy_fonts {
- write_file(destination, "fonts/fonts.css", theme::fonts::CSS)?;
- for (file_name, contents) in theme::fonts::LICENSES.iter() {
@@ -162,6 +189,31 @@ index 1b648da..5fe813c 100644
- theme::fonts::SOURCE_CODE_PRO.1,
- )?;
- }
+- if let Some(fonts_css) = &theme.fonts_css {
+- if !fonts_css.is_empty() {
+- if html_config.copy_fonts {
+- warn!(
+- "output.html.copy_fonts is deprecated.\n\
+- Set copy_fonts=false and ensure the fonts you want are in \
+- the `theme/fonts/` directory."
+- );
+- }
+- write_file(destination, "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 without a fonts.css file.\n\
+- Add an empty `theme/fonts/fonts.css` file to squelch this warning."
+- );
+- }
+- for font_file in &theme.font_files {
+- let contents = fs::read(font_file)?;
+- let filename = font_file.file_name().unwrap();
+- let filename = Path::new("fonts").join(filename);
+- write_file(destination, filename, &contents)?;
+- }
-
- let playground_config = &html_config.playground;
-
@@ -182,11 +234,6 @@ index 1b648da..5fe813c 100644
- playground_editor::THEME_TOMORROW_NIGHT_JS,
- )?;
- }
-+ 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/highlight.js/styles/atelier-dune-light.css", destination.join("highlight.css"))?;
-+ symlink("/usr/share/javascript/highlight.js/highlight.js", destination.join("highlight.js"))?;
-+ symlink("/usr/share/javascript/mathjax/MathJax.js", destination.join("MathJax.js"))?;
Ok(())
}
@@ -204,7 +251,7 @@ index a9e2f5c..3e3f69c 100644
}
diff --git a/vendor/mdbook/src/theme/index.hbs b/vendor/mdbook/src/theme/index.hbs
-index 147eb9a..27d358b 100644
+index 6f3948c..7e5c54c 100644
--- a/vendor/mdbook/src/theme/index.hbs
+++ b/vendor/mdbook/src/theme/index.hbs
@@ -33,10 +33,7 @@
@@ -228,7 +275,7 @@ index 147eb9a..27d358b 100644
{{/if}}
</head>
<body>
-@@ -60,46 +57,6 @@
+@@ -61,48 +58,6 @@
var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "{{ preferred_dark_theme }}" : "{{ default_theme }}";
</script>
@@ -263,10 +310,12 @@ index 147eb9a..27d358b 100644
- <!-- Hide / unhide sidebar before it is displayed -->
- <script>
- var html = document.querySelector('html');
-- var sidebar = 'hidden';
+- var sidebar = null;
- if (document.body.clientWidth >= 1080) {
- try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
- sidebar = sidebar || 'visible';
+- } else {
+- sidebar = 'hidden';
- }
- html.classList.remove('sidebar-visible');
- html.classList.add("sidebar-" + sidebar);
@@ -275,7 +324,7 @@ index 147eb9a..27d358b 100644
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
<div class="sidebar-scrollbox">
{{#toc}}{{/toc}}
-@@ -237,54 +194,8 @@
+@@ -240,54 +195,8 @@
</script>
{{/if}}
@@ -333,7 +382,7 @@ index 147eb9a..27d358b 100644
<!-- Custom JS scripts -->
{{#each additional_js}}
diff --git a/vendor/mdbook/src/theme/mod.rs b/vendor/mdbook/src/theme/mod.rs
-index 7af5e2b..3086fcf 100644
+index 6e6b509..ef8886b 100644
--- a/vendor/mdbook/src/theme/mod.rs
+++ b/vendor/mdbook/src/theme/mod.rs
@@ -1,9 +1,5 @@
@@ -366,7 +415,7 @@ index 7af5e2b..3086fcf 100644
/// 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
-@@ -57,11 +42,8 @@ pub struct Theme {
+@@ -59,11 +44,8 @@ pub struct Theme {
pub favicon_png: Option<Vec<u8>>,
pub favicon_svg: Option<Vec<u8>>,
pub js: Vec<u8>,
@@ -378,7 +427,7 @@ index 7af5e2b..3086fcf 100644
}
impl Theme {
-@@ -91,9 +73,6 @@ impl Theme {
+@@ -93,9 +75,6 @@ impl Theme {
theme_dir.join("css/variables.css"),
&mut theme.variables_css,
),
@@ -388,7 +437,7 @@ index 7af5e2b..3086fcf 100644
(
theme_dir.join("tomorrow-night.css"),
&mut theme.tomorrow_night_css,
-@@ -156,11 +135,8 @@ impl Default for Theme {
+@@ -183,11 +162,8 @@ impl Default for Theme {
favicon_png: Some(FAVICON_PNG.to_owned()),
favicon_svg: Some(FAVICON_SVG.to_owned()),
js: JS.to_owned(),
@@ -400,7 +449,7 @@ index 7af5e2b..3086fcf 100644
}
}
}
-@@ -243,11 +219,8 @@ mod tests {
+@@ -273,11 +249,8 @@ mod tests {
favicon_png: Some(Vec::new()),
favicon_svg: Some(Vec::new()),
js: Vec::new(),