mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-05-23 19:00:13 +02:00
Update mdbook
to version 0.4.35 (#1302)
This also ports over the latest changes to `book.js` and `index.hbs`. We probably need to come up with a more systematic way of doing this, e.g., we could store our changes in a patch and automatically attempt to apply it onto the latest upstream files.
This commit is contained in:
parent
c2e9a45d49
commit
5fafa4842c
5
.github/workflows/install-mdbook/action.yml
vendored
5
.github/workflows/install-mdbook/action.yml
vendored
@ -8,10 +8,7 @@ runs:
|
|||||||
# The --locked flag is important for reproducible builds. It also
|
# The --locked flag is important for reproducible builds. It also
|
||||||
# avoids breakage due to skews between mdbook and mdbook-svgbob.
|
# avoids breakage due to skews between mdbook and mdbook-svgbob.
|
||||||
- name: Install mdbook
|
- name: Install mdbook
|
||||||
# See https://github.com/google/comprehensive-rust/issues/1164.
|
run: cargo install mdbook --locked --version 0.4.35
|
||||||
# We will revert to a released version of mdbook as soon as the
|
|
||||||
# commit referenced here is released.
|
|
||||||
run: cargo install --git https://github.com/rust-lang/mdbook/ --rev 09f222b mdbook
|
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Install mdbook-svgbob
|
- name: Install mdbook-svgbob
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>{{ title }}</title>
|
<title>{{ title }}</title>
|
||||||
{{#if is_print }}
|
{{#if is_print }}
|
||||||
<meta name="robots" content="noindex" />
|
<meta name="robots" content="noindex">
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if base_url}}
|
{{#if base_url}}
|
||||||
<base href="{{ base_url }}">
|
<base href="{{ base_url }}">
|
||||||
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
<meta name="description" content="{{ description }}">
|
<meta name="description" content="{{ description }}">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<meta name="theme-color" content="#ffffff" />
|
<meta name="theme-color" content="#ffffff">
|
||||||
|
|
||||||
{{#if favicon_svg}}
|
{{#if favicon_svg}}
|
||||||
<link rel="icon" href="{{ path_to_root }}favicon.svg">
|
<link rel="icon" href="{{ path_to_root }}favicon.svg">
|
||||||
@ -285,7 +285,7 @@
|
|||||||
{{/previous}}
|
{{/previous}}
|
||||||
|
|
||||||
{{#next}}
|
{{#next}}
|
||||||
<a rel="next" href="{{ path_to_root }}{{link}}" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
|
<a rel="next prefetch" href="{{ path_to_root }}{{link}}" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
|
||||||
<i class="fa fa-angle-right"></i>
|
<i class="fa fa-angle-right"></i>
|
||||||
</a>
|
</a>
|
||||||
{{/next}}
|
{{/next}}
|
||||||
@ -303,7 +303,7 @@
|
|||||||
{{/previous}}
|
{{/previous}}
|
||||||
|
|
||||||
{{#next}}
|
{{#next}}
|
||||||
<a rel="next" href="{{ path_to_root }}{{link}}" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
|
<a rel="next prefetch" href="{{ path_to_root }}{{link}}" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
|
||||||
<i class="fa fa-angle-right"></i>
|
<i class="fa fa-angle-right"></i>
|
||||||
</a>
|
</a>
|
||||||
{{/next}}
|
{{/next}}
|
||||||
|
47
third_party/mdbook/book.js
vendored
47
third_party/mdbook/book.js
vendored
@ -468,7 +468,7 @@ function playground_text(playground, hidden = true) {
|
|||||||
})();
|
})();
|
||||||
|
|
||||||
(function sidebar() {
|
(function sidebar() {
|
||||||
var html = document.querySelector("html");
|
var body = document.querySelector("body");
|
||||||
var sidebar = document.getElementById("sidebar");
|
var sidebar = document.getElementById("sidebar");
|
||||||
var sidebarLinks = document.querySelectorAll('#sidebar a');
|
var sidebarLinks = document.querySelectorAll('#sidebar a');
|
||||||
var sidebarToggleButton = document.getElementById("sidebar-toggle");
|
var sidebarToggleButton = document.getElementById("sidebar-toggle");
|
||||||
@ -476,8 +476,8 @@ function playground_text(playground, hidden = true) {
|
|||||||
var firstContact = null;
|
var firstContact = null;
|
||||||
|
|
||||||
function showSidebar() {
|
function showSidebar() {
|
||||||
html.classList.remove('sidebar-hidden')
|
body.classList.remove('sidebar-hidden')
|
||||||
html.classList.add('sidebar-visible');
|
body.classList.add('sidebar-visible');
|
||||||
Array.from(sidebarLinks).forEach(function (link) {
|
Array.from(sidebarLinks).forEach(function (link) {
|
||||||
link.setAttribute('tabIndex', 0);
|
link.setAttribute('tabIndex', 0);
|
||||||
});
|
});
|
||||||
@ -498,8 +498,8 @@ function playground_text(playground, hidden = true) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function hideSidebar() {
|
function hideSidebar() {
|
||||||
html.classList.remove('sidebar-visible')
|
body.classList.remove('sidebar-visible')
|
||||||
html.classList.add('sidebar-hidden');
|
body.classList.add('sidebar-hidden');
|
||||||
Array.from(sidebarLinks).forEach(function (link) {
|
Array.from(sidebarLinks).forEach(function (link) {
|
||||||
link.setAttribute('tabIndex', -1);
|
link.setAttribute('tabIndex', -1);
|
||||||
});
|
});
|
||||||
@ -510,14 +510,14 @@ function playground_text(playground, hidden = true) {
|
|||||||
|
|
||||||
// Toggle sidebar
|
// Toggle sidebar
|
||||||
sidebarToggleButton.addEventListener('click', function sidebarToggle() {
|
sidebarToggleButton.addEventListener('click', function sidebarToggle() {
|
||||||
if (html.classList.contains("sidebar-hidden")) {
|
if (body.classList.contains("sidebar-hidden")) {
|
||||||
var current_width = parseInt(
|
var current_width = parseInt(
|
||||||
document.documentElement.style.getPropertyValue('--sidebar-width'), 10);
|
document.documentElement.style.getPropertyValue('--sidebar-width'), 10);
|
||||||
if (current_width < 150) {
|
if (current_width < 150) {
|
||||||
document.documentElement.style.setProperty('--sidebar-width', '150px');
|
document.documentElement.style.setProperty('--sidebar-width', '150px');
|
||||||
}
|
}
|
||||||
showSidebar();
|
showSidebar();
|
||||||
} else if (html.classList.contains("sidebar-visible")) {
|
} else if (body.classList.contains("sidebar-visible")) {
|
||||||
hideSidebar();
|
hideSidebar();
|
||||||
} else {
|
} else {
|
||||||
if (getComputedStyle(sidebar)['transform'] === 'none') {
|
if (getComputedStyle(sidebar)['transform'] === 'none') {
|
||||||
@ -533,14 +533,14 @@ function playground_text(playground, hidden = true) {
|
|||||||
function initResize(e) {
|
function initResize(e) {
|
||||||
window.addEventListener('mousemove', resize, false);
|
window.addEventListener('mousemove', resize, false);
|
||||||
window.addEventListener('mouseup', stopResize, false);
|
window.addEventListener('mouseup', stopResize, false);
|
||||||
html.classList.add('sidebar-resizing');
|
body.classList.add('sidebar-resizing');
|
||||||
}
|
}
|
||||||
function resize(e) {
|
function resize(e) {
|
||||||
var pos = (e.clientX - sidebar.offsetLeft);
|
var pos = (e.clientX - sidebar.offsetLeft);
|
||||||
if (pos < 20) {
|
if (pos < 20) {
|
||||||
hideSidebar();
|
hideSidebar();
|
||||||
} else {
|
} else {
|
||||||
if (html.classList.contains("sidebar-hidden")) {
|
if (body.classList.contains("sidebar-hidden")) {
|
||||||
showSidebar();
|
showSidebar();
|
||||||
}
|
}
|
||||||
pos = Math.min(pos, window.innerWidth - 100);
|
pos = Math.min(pos, window.innerWidth - 100);
|
||||||
@ -549,7 +549,7 @@ function playground_text(playground, hidden = true) {
|
|||||||
}
|
}
|
||||||
//on mouseup remove windows functions mousemove & mouseup
|
//on mouseup remove windows functions mousemove & mouseup
|
||||||
function stopResize(e) {
|
function stopResize(e) {
|
||||||
html.classList.remove('sidebar-resizing');
|
body.classList.remove('sidebar-resizing');
|
||||||
window.removeEventListener('mousemove', resize, false);
|
window.removeEventListener('mousemove', resize, false);
|
||||||
window.removeEventListener('mouseup', stopResize, false);
|
window.removeEventListener('mouseup', stopResize, false);
|
||||||
}
|
}
|
||||||
@ -584,21 +584,36 @@ function playground_text(playground, hidden = true) {
|
|||||||
document.addEventListener('keydown', function (e) {
|
document.addEventListener('keydown', function (e) {
|
||||||
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) { return; }
|
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) { return; }
|
||||||
if (window.search && window.search.hasFocus()) { return; }
|
if (window.search && window.search.hasFocus()) { return; }
|
||||||
|
var html = document.querySelector('html');
|
||||||
|
|
||||||
switch (e.key) {
|
function next() {
|
||||||
case 'ArrowRight':
|
|
||||||
e.preventDefault();
|
|
||||||
var nextButton = document.querySelector('.nav-chapters.next');
|
var nextButton = document.querySelector('.nav-chapters.next');
|
||||||
if (nextButton) {
|
if (nextButton) {
|
||||||
window.location.href = nextButton.href;
|
window.location.href = nextButton.href;
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
case 'ArrowLeft':
|
function prev() {
|
||||||
e.preventDefault();
|
|
||||||
var previousButton = document.querySelector('.nav-chapters.previous');
|
var previousButton = document.querySelector('.nav-chapters.previous');
|
||||||
if (previousButton) {
|
if (previousButton) {
|
||||||
window.location.href = previousButton.href;
|
window.location.href = previousButton.href;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
switch (e.key) {
|
||||||
|
case 'ArrowRight':
|
||||||
|
e.preventDefault();
|
||||||
|
if (html.dir == 'rtl') {
|
||||||
|
prev();
|
||||||
|
} else {
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'ArrowLeft':
|
||||||
|
e.preventDefault();
|
||||||
|
if (html.dir == 'rtl') {
|
||||||
|
next();
|
||||||
|
} else {
|
||||||
|
prev();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user