infosite-data/generate-library.nu
2025-05-29 12:35:28 +02:00

22 lines
632 B
Text

cd snippet
rm -f library.html
let snippets = ls | each {
let title = (
cat $in.name |
grep "<h1>" |
str replace -r "<.*?>" "" |
str replace -r "\\[\\[[+!](.*)\\]\\]" "$1"
)
if ($title | str contains "Redirecting to") {
return {
str: ""
title: $title
}
}
{
str: ("<li><a href=https://eep.li/!" + ($in.name | str replace ".html" "") + ">" + $title + "</a></li>")
title: $title
}
} | sort-by title
("<<header>> <h1> Meta: Library </h1> This page provides a list of all snippets that are currently available: <p> <ul>" + ($snippets.str | str join) + "</ul>") | save library.html