summaryrefslogtreecommitdiffstats
path: root/vendor/mdbook/src/theme
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:58 +0000
commita4b7ed7a42c716ab9f05e351f003d589124fd55d (patch)
treeb620cd3f223850b28716e474e80c58059dca5dd4 /vendor/mdbook/src/theme
parentAdding upstream version 1.67.1+dfsg1. (diff)
downloadrustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.tar.xz
rustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.zip
Adding upstream version 1.68.2+dfsg1.upstream/1.68.2+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/mdbook/src/theme')
-rw-r--r--vendor/mdbook/src/theme/book.js17
-rw-r--r--vendor/mdbook/src/theme/css/chrome.css14
-rw-r--r--vendor/mdbook/src/theme/css/general.css16
-rw-r--r--vendor/mdbook/src/theme/css/variables.css2
-rw-r--r--vendor/mdbook/src/theme/index.hbs59
-rw-r--r--vendor/mdbook/src/theme/mod.rs2
-rw-r--r--vendor/mdbook/src/theme/redirect.hbs4
7 files changed, 70 insertions, 44 deletions
diff --git a/vendor/mdbook/src/theme/book.js b/vendor/mdbook/src/theme/book.js
index d40440c72..e303ebb45 100644
--- a/vendor/mdbook/src/theme/book.js
+++ b/vendor/mdbook/src/theme/book.js
@@ -4,14 +4,16 @@
window.onunload = function () { };
// Global variable, shared between modules
-function playground_text(playground) {
+function playground_text(playground, hidden = true) {
let code_block = playground.querySelector("code");
if (window.ace && code_block.classList.contains("editable")) {
let editor = window.ace.edit(code_block);
return editor.getValue();
- } else {
+ } else if (hidden) {
return code_block.textContent;
+ } else {
+ return code_block.innerText;
}
}
@@ -166,7 +168,6 @@ function playground_text(playground) {
.filter(function (node) {return node.classList.contains("editable"); })
.forEach(function (block) { block.classList.remove('language-rust'); });
- Array
code_nodes
.filter(function (node) {return !node.classList.contains("editable"); })
.forEach(function (block) { hljs.highlightBlock(block); });
@@ -300,6 +301,13 @@ function playground_text(playground) {
themePopup.querySelector("button#" + get_theme()).focus();
}
+ function updateThemeSelected() {
+ themePopup.querySelectorAll('.theme-selected').forEach(function (el) {
+ el.classList.remove('theme-selected');
+ });
+ themePopup.querySelector("button#" + get_theme()).classList.add('theme-selected');
+ }
+
function hideThemes() {
themePopup.style.display = 'none';
themeToggleButton.setAttribute('aria-expanded', false);
@@ -355,6 +363,7 @@ function playground_text(playground) {
html.classList.remove(previousTheme);
html.classList.add(theme);
+ updateThemeSelected();
}
// Set theme
@@ -592,7 +601,7 @@ function playground_text(playground) {
text: function (trigger) {
hideTooltip(trigger);
let playground = trigger.closest("pre");
- return playground_text(playground);
+ return playground_text(playground, false);
}
});
diff --git a/vendor/mdbook/src/theme/css/chrome.css b/vendor/mdbook/src/theme/css/chrome.css
index 10fa4b365..59eae11fd 100644
--- a/vendor/mdbook/src/theme/css/chrome.css
+++ b/vendor/mdbook/src/theme/css/chrome.css
@@ -507,6 +507,8 @@ ul#searchresults span.teaser em {
padding: 0;
list-style: none;
display: none;
+ /* Don't let the children's background extend past the rounded corners. */
+ overflow: hidden;
}
.theme-popup .default {
color: var(--icons);
@@ -515,7 +517,7 @@ ul#searchresults span.teaser em {
width: 100%;
border: 0;
margin: 0;
- padding: 2px 10px;
+ padding: 2px 20px;
line-height: 25px;
white-space: nowrap;
text-align: left;
@@ -527,8 +529,10 @@ ul#searchresults span.teaser em {
.theme-popup .theme:hover {
background-color: var(--theme-hover);
}
-.theme-popup .theme:hover:first-child,
-.theme-popup .theme:hover:last-child {
- border-top-left-radius: inherit;
- border-top-right-radius: inherit;
+
+.theme-selected::before {
+ display: inline-block;
+ content: "✓";
+ margin-left: -14px;
+ width: 14px;
}
diff --git a/vendor/mdbook/src/theme/css/general.css b/vendor/mdbook/src/theme/css/general.css
index 0e4f07a50..344b53eb7 100644
--- a/vendor/mdbook/src/theme/css/general.css
+++ b/vendor/mdbook/src/theme/css/general.css
@@ -22,8 +22,8 @@ body {
}
code {
- font-family: "Source Code Pro", Consolas, "Ubuntu Mono", Menlo, "DejaVu Sans Mono", monospace, monospace !important;
- font-size: 0.875em; /* please adjust the ace font size accordingly in editor.js */
+ font-family: var(--mono-font) !important;
+ font-size: var(--code-font-size);
}
/* make long words/inline code not x overflow */
@@ -148,6 +148,18 @@ blockquote {
border-bottom: .1em solid var(--quote-border);
}
+kbd {
+ background-color: var(--table-border-color);
+ border-radius: 4px;
+ border: solid 1px var(--theme-popup-border);
+ box-shadow: inset 0 -1px 0 var(--theme-hover);
+ display: inline-block;
+ font-size: var(--code-font-size);
+ font-family: var(--mono-font);
+ line-height: 10px;
+ padding: 4px 5px;
+ vertical-align: middle;
+}
:not(.footnote-definition) + .footnote-definition,
.footnote-definition + :not(.footnote-definition) {
diff --git a/vendor/mdbook/src/theme/css/variables.css b/vendor/mdbook/src/theme/css/variables.css
index 56b634bc3..21bf8e55e 100644
--- a/vendor/mdbook/src/theme/css/variables.css
+++ b/vendor/mdbook/src/theme/css/variables.css
@@ -6,6 +6,8 @@
--page-padding: 15px;
--content-max-width: 750px;
--menu-bar-height: 50px;
+ --mono-font: "Source Code Pro", Consolas, "Ubuntu Mono", Menlo, "DejaVu Sans Mono", monospace, monospace;
+ --code-font-size: 0.875em /* please adjust the ace font size accordingly in editor.js */
}
/* Themes */
diff --git a/vendor/mdbook/src/theme/index.hbs b/vendor/mdbook/src/theme/index.hbs
index 18d984a2b..147eb9af2 100644
--- a/vendor/mdbook/src/theme/index.hbs
+++ b/vendor/mdbook/src/theme/index.hbs
@@ -15,7 +15,6 @@
<!-- Custom HTML head -->
{{> head}}
- <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta name="description" content="{{ description }}">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#ffffff" />
@@ -51,18 +50,18 @@
{{#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 src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
{{/if}}
</head>
<body>
<!-- Provide site root to javascript -->
- <script type="text/javascript">
+ <script>
var path_to_root = "{{ path_to_root }}";
var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "{{ preferred_dark_theme }}" : "{{ default_theme }}";
</script>
<!-- Work around some values being stored in localStorage wrapped in quotes -->
- <script type="text/javascript">
+ <script>
try {
var theme = localStorage.getItem('mdbook-theme');
var sidebar = localStorage.getItem('mdbook-sidebar');
@@ -78,7 +77,7 @@
</script>
<!-- Set the theme before any content is loaded, prevents flash -->
- <script type="text/javascript">
+ <script>
var theme;
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
if (theme === null || theme === undefined) { theme = default_theme; }
@@ -90,7 +89,7 @@
</script>
<!-- Hide / unhide sidebar before it is displayed -->
- <script type="text/javascript">
+ <script>
var html = document.querySelector('html');
var sidebar = 'hidden';
if (document.body.clientWidth >= 1080) {
@@ -122,11 +121,11 @@
<i class="fa fa-paint-brush"></i>
</button>
<ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
- <li role="none"><button role="menuitem" class="theme" id="light">{{ theme_option "Light" }}</button></li>
- <li role="none"><button role="menuitem" class="theme" id="rust">{{ theme_option "Rust" }}</button></li>
- <li role="none"><button role="menuitem" class="theme" id="coal">{{ theme_option "Coal" }}</button></li>
- <li role="none"><button role="menuitem" class="theme" id="navy">{{ theme_option "Navy" }}</button></li>
- <li role="none"><button role="menuitem" class="theme" id="ayu">{{ theme_option "Ayu" }}</button></li>
+ <li role="none"><button role="menuitem" class="theme" id="light">Light</button></li>
+ <li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
+ <li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
+ <li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
+ <li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
</ul>
{{#if search_enabled}}
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
@@ -171,7 +170,7 @@
{{/if}}
<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
- <script type="text/javascript">
+ <script>
document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
@@ -221,7 +220,7 @@
{{#if live_reload_endpoint}}
<!-- Livereload script (if served using the cli tool) -->
- <script type="text/javascript">
+ <script>
const wsProtocol = location.protocol === 'https:' ? 'wss:' : 'ws:';
const wsAddress = wsProtocol + "//" + location.host + "/" + "{{{live_reload_endpoint}}}";
const socket = new WebSocket(wsAddress);
@@ -240,7 +239,7 @@
{{#if google_analytics}}
<!-- Google Analytics Tag -->
- <script type="text/javascript">
+ <script>
var localAddrs = ["localhost", "127.0.0.1", ""];
// make sure we don't activate google analytics if the developer is
@@ -258,43 +257,43 @@
{{/if}}
{{#if playground_line_numbers}}
- <script type="text/javascript">
+ <script>
window.playground_line_numbers = true;
</script>
{{/if}}
{{#if playground_copyable}}
- <script type="text/javascript">
+ <script>
window.playground_copyable = true;
</script>
{{/if}}
{{#if playground_js}}
- <script src="{{ path_to_root }}ace.js" type="text/javascript" charset="utf-8"></script>
- <script src="{{ path_to_root }}editor.js" type="text/javascript" charset="utf-8"></script>
- <script src="{{ path_to_root }}mode-rust.js" type="text/javascript" charset="utf-8"></script>
- <script src="{{ path_to_root }}theme-dawn.js" type="text/javascript" charset="utf-8"></script>
- <script src="{{ path_to_root }}theme-tomorrow_night.js" type="text/javascript" charset="utf-8"></script>
+ <script src="{{ path_to_root }}ace.js"></script>
+ <script src="{{ path_to_root }}editor.js"></script>
+ <script src="{{ path_to_root }}mode-rust.js"></script>
+ <script src="{{ path_to_root }}theme-dawn.js"></script>
+ <script src="{{ path_to_root }}theme-tomorrow_night.js"></script>
{{/if}}
{{#if search_js}}
- <script src="{{ path_to_root }}elasticlunr.min.js" type="text/javascript" charset="utf-8"></script>
- <script src="{{ path_to_root }}mark.min.js" type="text/javascript" charset="utf-8"></script>
- <script src="{{ path_to_root }}searcher.js" type="text/javascript" charset="utf-8"></script>
+ <script src="{{ path_to_root }}elasticlunr.min.js"></script>
+ <script src="{{ path_to_root }}mark.min.js"></script>
+ <script src="{{ path_to_root }}searcher.js"></script>
{{/if}}
- <script src="{{ path_to_root }}clipboard.min.js" type="text/javascript" charset="utf-8"></script>
- <script src="{{ path_to_root }}highlight.js" type="text/javascript" charset="utf-8"></script>
- <script src="{{ path_to_root }}book.js" type="text/javascript" charset="utf-8"></script>
+ <script src="{{ path_to_root }}clipboard.min.js"></script>
+ <script src="{{ path_to_root }}highlight.js"></script>
+ <script src="{{ path_to_root }}book.js"></script>
<!-- Custom JS scripts -->
{{#each additional_js}}
- <script type="text/javascript" src="{{ ../path_to_root }}{{this}}"></script>
+ <script src="{{ ../path_to_root }}{{this}}"></script>
{{/each}}
{{#if is_print}}
{{#if mathjax_support}}
- <script type="text/javascript">
+ <script>
window.addEventListener('load', function() {
MathJax.Hub.Register.StartupHook('End', function() {
window.setTimeout(window.print, 100);
@@ -302,7 +301,7 @@
});
</script>
{{else}}
- <script type="text/javascript">
+ <script>
window.addEventListener('load', function() {
window.setTimeout(window.print, 100);
});
diff --git a/vendor/mdbook/src/theme/mod.rs b/vendor/mdbook/src/theme/mod.rs
index a1ee18aff..7af5e2b70 100644
--- a/vendor/mdbook/src/theme/mod.rs
+++ b/vendor/mdbook/src/theme/mod.rs
@@ -12,7 +12,7 @@ use std::io::Read;
use std::path::Path;
use crate::errors::*;
-
+use log::warn;
pub static INDEX: &[u8] = include_bytes!("index.hbs");
pub static HEAD: &[u8] = include_bytes!("head.hbs");
pub static REDIRECT: &[u8] = include_bytes!("redirect.hbs");
diff --git a/vendor/mdbook/src/theme/redirect.hbs b/vendor/mdbook/src/theme/redirect.hbs
index 9f49e6d09..d0532a504 100644
--- a/vendor/mdbook/src/theme/redirect.hbs
+++ b/vendor/mdbook/src/theme/redirect.hbs
@@ -3,8 +3,8 @@
<head>
<meta charset="utf-8">
<title>Redirecting...</title>
- <meta http-equiv="refresh" content="0;URL='{{url}}'">
- <meta rel="canonical" href="{{url}}">
+ <meta http-equiv="refresh" content="0; URL={{url}}">
+ <link rel="canonical" href="{{url}}">
</head>
<body>
<p>Redirecting to... <a href="{{url}}">{{url}}</a>.</p>