#21 Use mkdocs for wiki #22

Merged
silver merged 7 commits from esy/wiki:main into main 2024-08-19 22:08:48 +00:00
29 changed files with 23 additions and 322 deletions

3
.gitignore vendored
View file

@ -30,3 +30,6 @@ test.*
# Nix
result
/result
# Mkdocs
/site

View file

@ -1,23 +0,0 @@
html_void = ["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"]
dont_copy_paths = [
# "./src/templates"
]
src = "./src"
dest = "./build"
[template]
enable = true
order = [
{ type = "Powerpoint", path = "./src/templates/powerpoint.html" },
{ type = "Adjacent" },
{ type = "AdjacentFolder" },
{ type = "RootFolder", path = "./src/templates/folder.html" },
# path to the templates' folder,
{ type = "Root", path = "./src/templates" },
{ type = "General", path = "./src/templates/general.html" },
{ type = "Default" },
]
[indexing]
roots = ["wiki"]
render_drafts = false

View file

@ -1,72 +1,6 @@
{
"nodes": {
"bfom": {
"inputs": {
"naersk": "naersk",
"nixpkgs": "nixpkgs_2",
"utils": "utils"
},
"locked": {
"lastModified": 1723500950,
"narHash": "sha256-t1eApFGI+JzLIW2YToLlDV20n+Nevk1q4fZBYU1m93I=",
"owner": "silver_rust",
"repo": "bfom",
"rev": "7f339f28442758ecc3f1697e3f70d441973664b9",
"type": "gitlab"
},
"original": {
"owner": "silver_rust",
"repo": "bfom",
"type": "gitlab"
}
},
"naersk": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1713520724,
"narHash": "sha256-CO8MmVDmqZX2FovL75pu5BvwhW+Vugc7Q6ze7Hj8heI=",
"owner": "nix-community",
"repo": "naersk",
"rev": "c5037590290c6c7dae2e42e7da1e247e54ed2d49",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "naersk",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1714091391,
"narHash": "sha256-68n3GBvlm1MIeJXadPzQ3v8Y9sIW3zmv8gI5w5sliC8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4c86138ce486d601d956a165e2f7a0fc029a03c1",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1714091391,
"narHash": "sha256-68n3GBvlm1MIeJXadPzQ3v8Y9sIW3zmv8gI5w5sliC8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4c86138ce486d601d956a165e2f7a0fc029a03c1",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1695837737,
"narHash": "sha256-KcqmJ5hNacLuE7fkz5586kp/vt4NLo6+Prq3DMgrxpQ=",
@ -82,9 +16,8 @@
},
"root": {
"inputs": {
"bfom": "bfom",
"nixpkgs": "nixpkgs_3",
"utils": "utils_2"
"nixpkgs": "nixpkgs",
"utils": "utils"
}
},
"systems": {
@ -102,43 +35,10 @@
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1694529238,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",

View file

@ -3,25 +3,28 @@
inputs = {
utils.url = "github:numtide/flake-utils";
bfom.url = "gitlab:silver_rust/bfom";
};
outputs = { self, nixpkgs, utils, bfom }: utils.lib.eachDefaultSystem (system:
outputs = { self, nixpkgs, utils, }: utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages."${system}";
in rec {
# `nix build`
in {
defaultPackage = pkgs.stdenv.mkDerivation {
name = "skynet-website-renew";
name = "skynet-wiki";
src = self;
buildPhase = "${bfom.defaultPackage."${system}"}/bin/cargo-bfom";
installPhase = "mkdir -p $out; cp -R build/* $out";
buildInputs = [
pkgs.python3Packages.mkdocs
pkgs.python3Packages.mkdocs-material
];
buildPhase = "mkdocs build";
installPhase = "mkdir -p $out; cp -R site/* $out;";
};
devShells.default = pkgs.mkShell {
name = "Skynet Wiki env";
packages = [
bfom.defaultPackage."${system}"
pkgs.python3Packages.mkdocs
pkgs.python3Packages.mkdocs-material
];
};
}

5
mkdocs.yml Normal file
View file

@ -0,0 +1,5 @@
site_name: Skynet Wiki
site_url: https://wiki.skynet.ie
docs_dir: ./src/
theme:
name: material

View file

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

1
src/index.md Normal file
View file

@ -0,0 +1 @@
# Skynet Wiki

View file

@ -1,27 +0,0 @@
<!DOCTYPE html>
<html lang="en-ie">
<head>
<title>{title}</title>
<link href="./assets/favicon/favicon-16x16.png" rel="icon" type="image/png"/>
<link href="./assets/index.css" rel="stylesheet" type="text/css"/>
<!-- for code formatting -->
<link rel="stylesheet" href="./assets/hybrid.min.css">
<script src="./assets/highlight.min.js"></script>
<script>hljs.highlightAll()</script>
</head>
<body>
<div class="wrapper">
<header class="page-header"></header>
<main class="page-body">
{body}
</main>
<footer class="page-footer">
UL Computer Society 2023-<span id="year">2023</span>
<script>
document.getElementById('year').textContent = new Date().getFullYear().toString()
</script>
</footer>
</div>
</body>
</html>

View file

@ -1,83 +0,0 @@
<!DOCTYPE html>
<html lang='en'>
<head>
<title>{title}</title>
<link href="./assets/favicon/favicon-16x16.png" rel="icon" type="image/png"/>
<!-- for code formatting -->
<link rel="stylesheet" href="./assets/hybrid.min.css">
<script src="./assets/highlight.min.js"></script>
<script>hljs.highlightAll()</script>
</head>
<body>
{body}
</body>
<style>
section.slide {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) scale(3);
}
ol, ul {
margin-top: 0;
margin-bottom: 0;
}
img{
display: block;
margin-left: auto;
margin-right: auto;
max-width: 40%;
max-height: 40%;
}
</style>
<script>
let slide_number = 0;
let slide_max = 0;
for (let section of document.querySelectorAll("section.slide")) {
let number = parseInt(section.id, 10);
if (number > slide_max) {
slide_max = number;
}
}
slide_next = (change) => {
// make old hidden
document.getElementById(`${slide_number}`).style.display = "none";
// make the change
let slide_number_new = slide_number + change;
if (slide_number_new >= 0 && slide_number_new <= slide_max) {
slide_number += change;
}
// make current visible
document.getElementById(`${slide_number}`).style.display = "block";
}
// add event listner
onkeydown = (event) => {
if (event.key === "ArrowRight" || event.key === "ArrowDown") {
slide_next(1);
}
if (event.key === "ArrowLeft" || event.key === "ArrowUp") {
slide_next(-1);
}
};
on_events = (clickTargetWidth, xCoordInClickTarget) => {
if (clickTargetWidth / 2 > xCoordInClickTarget) {
slide_next(-1);
} else {
slide_next(1);
}
}
ontouchstart = (event) => {
on_events(event.target.offsetWidth, event.touches[0].clientX - event.target.getBoundingClientRect().left);
};
// show the first slide
slide_next(0)
</script>
</html>

View file

@ -1,40 +0,0 @@
<!DOCTYPE html>
<html lang="en-ie">
<head>
<title>{title}</title>
<link href="./assets/favicon/favicon-16x16.png" rel="icon" type="image/png"/>
<link href="./assets/index.css" rel="stylesheet" type="text/css"/>
<!-- for code formatting -->
<link rel="stylesheet" href="./assets/hybrid.min.css">
<script src="./assets/highlight.min.js"></script>
<script>hljs.highlightAll()</script>
</head>
<body>
<div class="wrapper">
<header class="page-header">
<a href="./" >
<img alt="Sharky, our mascot" height="81.56" src="./assets/sharky.svg" width="145"/>
</a>
<h1>
<a href="./" >
<h1>Skynet Wiki</h1>
</a>
</h1>
</header>
<main class="page-body">
<h1>{title}</h1>
<h4>{date}</h4>
<!--indentation is managed by the converter-->
{body}
</main>
<footer class="page-footer">
UL Computer Society 2023-<span id="year">2023</span>
<script>
document.getElementById('year').textContent = new Date().getFullYear().toString()
</script>
</footer>
</div>
</body>
</html>

View file

@ -1,38 +0,0 @@
<!DOCTYPE html>
<html lang="en-ie">
<head>
<title>{title}</title>
<link href="./assets/favicon/favicon-16x16.png" rel="icon" type="image/png"/>
<link href="./assets/index.css" rel="stylesheet" type="text/css"/>
<!-- for code formatting -->
<link rel="stylesheet" href="./assets/hybrid.min.css">
<script src="./assets/highlight.min.js"></script>
<script>hljs.highlightAll()</script>
</head>
<body>
<div class="wrapper">
<header class="page-header">
<a href="./" >
<img alt="Sharky, our mascot" height="81.56" src="./assets/sharky.svg" width="145"/>
</a>
<h1>
<a href="./" >
<h1>Skynet Wiki</h1>
</a>
</h1>
</header>
<main class="page-body">
<!--indentation is managed by the converter-->
{body}
</main>
<footer class="page-footer">
UL Computer Society 2023-<span id="year">2023</span>
<script>
document.getElementById('year').textContent = new Date().getFullYear().toString()
</script>
</footer>
</div>
</body>
</html>