made scripts/sitemap_html.awk convert .gmi links to .html, add a <h1> at the top of the page, fixed a few other things :)

This commit is contained in:
Abdullah Islam 2023-06-21 15:29:42 +06:00
parent ab5bad2f6c
commit ea95073ac4
1 changed files with 11 additions and 11 deletions

View File

@ -1,9 +1,12 @@
BEGIN {
body = ""
body = "<h1>Sitemap</h1>"
}
{
gsub("^" sourcePath, "", FILENAME)
sub("^" sourcePath, "", FILENAME)
if (link !~ "^[a-zA-Z0-9_]*:")
sub("\.gmi$", ".html", FILENAME)
pathComponents[1] = ""
split(FILENAME, pathComponents, "/")
@ -22,6 +25,7 @@ BEGIN {
}
{
body = body sprintf("<a href='%s'>%s</a><br>\n", FILENAME, title)
nextfile
}
@ -44,17 +48,13 @@ body { margin: 20px; }\n\
</head>\n\
<body>\n\
<header>\n\
<nav id='navbar'>\n\
<a href='index.html'>home</a> | \
<a href='notes/index.html'>notes</a> | \
<a href='useful/index.html'>useful</a> | \
<a href='sitemap.html'>sitemap</a> | \
<a href='feed.atom'>feed</a>\n\
</nav>\n\
</header><hr>\n\
%s\n\
</header>\n\
<article id='content'>\n\
%s\n\
</article>\n\
</body>\n\
</html>", body
</html>", \
genNavbarHTML(FILENAME, "src/", "html/"), \
body
}