1
Fork 0
mirror of https://github.com/RGBCube/Site synced 2025-07-31 13:07:46 +00:00

dump: add dump

This commit is contained in:
RGBCube 2025-06-07 22:50:04 +03:00
parent fae392d3af
commit 1a27c2d337
Signed by: RGBCube
SSH key fingerprint: SHA256:CzqbPcfwt+GxFYNnFVCqoN5Itn4YFrshg1TrnACpA5M
13 changed files with 247 additions and 64 deletions

7
site/_includes/dump.vto Normal file
View file

@ -0,0 +1,7 @@
---
layout: text.vto
---
{{ content }}
{{ include "map.vto" { url } }}

70
site/_includes/map.vto Normal file
View file

@ -0,0 +1,70 @@
{{ function process(entry, toplevel = false) }}
<div class="relative p-4{{ if !toplevel }} my-4 md:mx-8{{ /if }} border-1 bg-white dark:bg-black">
{{ if entry.data.title }}
<a
class="
reset
absolute inset-0
p-4
bg-white hover:bg-[pink]
dark:bg-black dark:hover:bg-[olive]
{{ if entry.data.url == url }}
border-2 border-dashed border-black dark:border-white
{{ /if }}
"
style="margin:0" href="{{ entry.data.url }}"
>{{ entry.data.mapTitle ?? entry.data.title |> md }}</a>
<div class="invisible">{{ entry.data.mapTitle ?? entry.data.title |> md }}</div>
{{ else }}
{{> const content = entry.data.basename.replace(/-/g, " ").replace(/\b\w/g, (char) => char.toUpperCase()) }}
<p
class="
absolute inset-0
p-4
bg-[repeating-linear-gradient(-45deg,transparent_0rem,transparent_1rem,#ddd_1rem,#ddd_2rem)]
dark:bg-[repeating-linear-gradient(-45deg,transparent_0rem,transparent_1rem,#222_1rem,#222_2rem)]
"
style="
margin:0;
"
>{{ content }}</p>
<div class="invisible">{{ content }}</div>
{{ /if }}
{{ if entry.children && entry.children.length > 0 }}
<ul>
{{ for child of entry.children }}
<li class="reset">
{{ process(child) }}
</li>
{{ /for }}
</ul>
{{ /if }}
</div>
{{ /function }}
{{> const sharedPrefix = (x, y) => {
const length = Math.min(x.length, y.length);
let prefix = "";
for (let index = 0; index < length; index++) {
if (x[index] === y[index]) {
prefix += x[index];
} else {
break;
}
}
return prefix;
} }}
{{> const anchorUrls = search.pages("mapAnchor=true").map((page) => page.url) }}
{{> const shared = anchorUrls.map((anchorUrl) => sharedPrefix(anchorUrl, url)) }}
{{> const longest = shared.reduce((longest, current) => current.length > longest.length ? current : longest) }}
{{ process(nav.menu(longest), toplevel = true) }}

View file

@ -24,6 +24,7 @@ layout: default.vto
<a class="{{ style }}" href="/">home</a>
<a class="{{ style }}" href="/about/">about</a>
<a class="{{ style }}" href="/blog/">blog</a>
<a class="{{ style }}" href="/dump/">dump</a>
<a class="{{ style }}" href="/contact/">contact</a>
</div>
</nav>
@ -35,14 +36,15 @@ layout: default.vto
<ol id="footnotes"></ol>
</div>
<footer class="flex justify-center text-sm wrap-anywhere mt-auto p-1.5 pb-2 border-t-4 border-x-4">
<footer class="flex justify-center text-sm wrap-anywhere mt-auto p-1.5 pb-2 border-t-4 border-x-4 border-black dark:border-white">
Copyright © {{ Temporal.Now.plainDateISO().year }}
<a draggable="false" class="flex items-center pl-2" href="/" alt="RGBCube">
{{ set cube_size = "0.75rem" }}
{{ set cube_small = true }}
{{ set cube_last = true }}
{{ include "rgbcube.vto" }}
{{ include "rgbcube.vto" {
cube_size: "0.75rem",
cube_small: true,
cube_last: true,
} }}
</a>
</footer>