From 9e47e151e3fa5c23ebea56ab11a2a1df6a862f3d Mon Sep 17 00:00:00 2001 From: Ivan Nikolaenko Date: Mon, 27 Jan 2025 13:59:00 +0200 Subject: [PATCH] doc: Disable mdbook-pagetoc plugin mdBook is updated to 0.4.41 along with the nixpkgs' version bump, which has broken mdbook-pagetoc plugin. Let's disable the plugin for now to get the documentation up and running as soon as possible. Signed-off-by: Ivan Nikolaenko --- LICENSES/WTFPL.txt | 13 -- docs/book.toml | 2 - docs/theme/index.hbs | 478 ----------------------------------------- docs/theme/pagetoc.css | 107 --------- docs/theme/pagetoc.js | 120 ----------- 5 files changed, 720 deletions(-) delete mode 100644 LICENSES/WTFPL.txt delete mode 100644 docs/theme/index.hbs delete mode 100644 docs/theme/pagetoc.css delete mode 100644 docs/theme/pagetoc.js diff --git a/LICENSES/WTFPL.txt b/LICENSES/WTFPL.txt deleted file mode 100644 index 8b1a9d818..000000000 --- a/LICENSES/WTFPL.txt +++ /dev/null @@ -1,13 +0,0 @@ - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - Version 2, December 2004 - -Copyright (C) 2004 Sam Hocevar - -Everyone is permitted to copy and distribute verbatim or modified -copies of this license document, and changing it is allowed as long -as the name is changed. - - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. You just DO WHAT THE FUCK YOU WANT TO. diff --git a/docs/book.toml b/docs/book.toml index 8bf28bf3d..8267be246 100644 --- a/docs/book.toml +++ b/docs/book.toml @@ -14,8 +14,6 @@ src = "src" default-theme = "light" git-repository-url = "https://github.com/tiiuae/ghaf" git-repository-icon = "fa-github" -additional-css = ["theme/pagetoc.css"] -additional-js = ["theme/pagetoc.js"] [preprocessor.alerts] diff --git a/docs/theme/index.hbs b/docs/theme/index.hbs deleted file mode 100644 index 420e89c83..000000000 --- a/docs/theme/index.hbs +++ /dev/null @@ -1,478 +0,0 @@ - - - - - - - {{ title }} - {{#if is_print }} - - {{/if}} {{#if base_url}} - - {{/if}} - - - {{> head}} - - - - - - {{#if favicon_svg}} - - {{/if}} {{#if favicon_png}} - - {{/if}} - - - - {{#if print_enable}} - - {{/if}} - - - - {{#if copy_fonts}} - - {{/if}} - - - - - - - - {{#each additional_css}} - - {{/each}} {{#if mathjax_support}} - - - {{/if}} - - -
- - - - - - - - - - - - - - - - - - - -
-
- {{> header}} - - - - {{#if search_enabled}} - - {{/if}} - - - - -
-
-
{{{ content }}}
-
- -
-
- - -
-
- - -
- - {{#if live_reload_endpoint}} - - - {{/if}} {{#if google_analytics}} - - - {{/if}} {{#if playground_line_numbers}} - - {{/if}} {{#if playground_copyable}} - - {{/if}} {{#if playground_js}} - - - - - - {{/if}} {{#if search_js}} - - - - {{/if}} - - - - - - - {{#each additional_js}} - - {{/each}} {{#if is_print}} {{#if mathjax_support}} - - {{else}} - - {{/if}} {{/if}} -
- - diff --git a/docs/theme/pagetoc.css b/docs/theme/pagetoc.css deleted file mode 100644 index c36315058..000000000 --- a/docs/theme/pagetoc.css +++ /dev/null @@ -1,107 +0,0 @@ -/* -Copyright 2020 Jorel Ali -Copyright 2022-2024 TII (SSRC) and the Ghaf contributors -SPDX-License-Identifier: WTFPL -*/ - -:root { - --toc-width: 270px; - --center-content-toc-shift: calc(-1 * var(--toc-width) / 2); -} - -.nav-chapters { - /* adjust width of buttons that bring to the previous or the next page */ - min-width: 50px; -} - -.previous { - /* - adjust the space between the left sidebar or the left side of the screen - and the button that leads to the previous page - */ - margin-left: var(--page-padding); -} - -@media only screen { - main { - display: flex; - } - - @media (max-width: 1179px) { - .sidebar-hidden .sidetoc { - display: none; - } - } - - @media (max-width: 1439px) { - .sidebar-visible .sidetoc { - display: none; - } - } - - @media (1180px <= width <= 1439px) { - .sidebar-hidden main { - position: relative; - left: var(--center-content-toc-shift); - } - } - - @media (1440px <= width <= 1700px) { - .sidebar-visible main { - position: relative; - left: var(--center-content-toc-shift); - } - } - - .content-wrap { - overflow-y: auto; - width: 100%; - } - - .sidetoc { - margin-top: 20px; - margin-left: 10px; - margin-right: auto; - } - .pagetoc { - position: fixed; - /* adjust TOC width */ - width: var(--toc-width); - height: calc(100vh - var(--menu-bar-height) - 0.67em * 4); - overflow: auto; - } - .pagetoc a { - border-left: 1px solid var(--sidebar-bg); - color: var(--fg) !important; - display: block; - padding-bottom: 5px; - padding-top: 5px; - padding-left: 10px; - text-align: left; - text-decoration: none; - } - .pagetoc a:hover, - .pagetoc a.active { - background: var(--sidebar-bg); - color: var(--sidebar-fg) !important; - } - .pagetoc .active { - background: var(--sidebar-bg); - color: var(--sidebar-fg); - } - .pagetoc .pagetoc-H2 { - padding-left: 20px; - } - .pagetoc .pagetoc-H3 { - padding-left: 40px; - } - .pagetoc .pagetoc-H4 { - padding-left: 60px; - } -} - -@media print { - .sidetoc { - display: none; - } -} diff --git a/docs/theme/pagetoc.js b/docs/theme/pagetoc.js deleted file mode 100644 index 9fdd878b2..000000000 --- a/docs/theme/pagetoc.js +++ /dev/null @@ -1,120 +0,0 @@ -/* -Copyright 2020 Jorel Ali -Copyright 2022-2024 TII (SSRC) and the Ghaf contributors -SPDX-License-Identifier: WTFPL -*/ - -function forEach(elems, fun) { - Array.prototype.forEach.call(elems, fun); -} - -function getPagetoc() { - return document.getElementsByClassName("pagetoc")[0]; -} - -function getPagetocElems() { - return getPagetoc().children; -} - -function getHeaders() { - return document.getElementsByClassName("header"); -} - -// Un-active everything when you click it -function forPagetocElem(fun) { - forEach(getPagetocElems(), fun); -} - -function getRect(element) { - return element.getBoundingClientRect(); -} - -function overflowTop(container, element) { - return getRect(container).top - getRect(element).top; -} - -function overflowBottom(container, element) { - return getRect(container).bottom - getRect(element).bottom; -} - -var activeHref = location.href; - -var updateFunction = function (elem = undefined) { - var id = elem; - - if (!id && location.href != activeHref) { - activeHref = location.href; - forPagetocElem(function (el) { - if (el.href === activeHref) { - id = el; - } - }); - } - - if (!id) { - var elements = getHeaders(); - let margin = window.innerHeight / 3; - - forEach(elements, function (el, i, arr) { - if (!id && getRect(el).top >= 0) { - if (getRect(el).top < margin) { - id = el; - } else { - id = arr[Math.max(0, i - 1)]; - } - } - // a very long last section - // its heading is over the screen - if (!id && i == arr.length - 1) { - id = el; - } - }); - } - - forPagetocElem(function (el) { - el.classList.remove("active"); - }); - - if (!id) return; - - forPagetocElem(function (el) { - if (id.href.localeCompare(el.href) == 0) { - el.classList.add("active"); - let pagetoc = getPagetoc(); - if (overflowTop(pagetoc, el) > 0) { - pagetoc.scrollTop = el.offsetTop; - } - if (overflowBottom(pagetoc, el) < 0) { - pagetoc.scrollTop -= overflowBottom(pagetoc, el); - } - } - }); -}; - -let elements = getHeaders(); - -if (elements.length > 1) { - // Populate sidebar on load - window.addEventListener("load", function () { - var pagetoc = getPagetoc(); - var elements = getHeaders(); - forEach(elements, function (el) { - var link = document.createElement("a"); - link.appendChild(document.createTextNode(el.text)); - link.href = el.hash; - link.classList.add("pagetoc-" + el.parentElement.tagName); - pagetoc.appendChild(link); - link.onclick = function () { - updateFunction(link); - }; - }); - updateFunction(); - }); - - // Handle active elements on scroll - window.addEventListener("scroll", function () { - updateFunction(); - }); -} else { - document.getElementsByClassName("sidetoc")[0].remove(); -}