module-based literate programming

This commit is contained in:
りき萌 2024-02-17 14:56:17 +01:00
parent 9ef9d57f13
commit b9218c8ace
7 changed files with 183 additions and 106 deletions

View file

@ -163,15 +163,12 @@ function expandDetailsRecursively(element) {
}
function navigateToPage(page) {
console.log(page);
window.location.pathname = `${page}.html`
}
async function navigateToBranch(fragment) {
if (fragment.length == 0) return;
console.log(`nagivating to branch: ${fragment}`);
let element = document.getElementById(fragment);
if (element !== null) {
// If the element is already loaded on the page, we're good.
@ -179,7 +176,6 @@ async function navigateToBranch(fragment) {
rehash();
} else {
// The element is not loaded, we need to load the tree that has it.
console.log("element is not loaded");
let parts = fragment.split(':');
if (parts.length >= 2) {
let [page, _id] = parts;
@ -189,7 +185,6 @@ async function navigateToBranch(fragment) {
// navigation maps with roots other than index. Currently though only index is
// generated so that doesn't matter.
let [_root, ...path] = fullPath;
console.log(`_root: ${_root}, path: ${path}`)
if (path !== undefined) {
let isNotAtIndexHtml =
window.location.pathname != "" &&