index.gmi files for website sections removed, and sitemap generation has been improved
This commit is contained in:
parent
1f5e287f9b
commit
4bd53d1a8d
|
@ -14,7 +14,7 @@ function genNavbarHTML(filename, sourcePath, outputPath) {
|
|||
<a href='%s'>sitemap</a> | \n\
|
||||
<a href='%s'>feed</a> | \n\
|
||||
<a href='http://git.vern.cc/techn0path/'>git</a>\n\
|
||||
</nav>\n", \
|
||||
</nav><br>\n", \
|
||||
relpath(dirname, outputPath "/index.html"), \
|
||||
relpath(dirname, outputPath "/notes/index.html"), \
|
||||
relpath(dirname, outputPath "/useful/index.html"), \
|
||||
|
@ -37,7 +37,7 @@ function genNavbarGMI(filename, sourcePath, outputPath) {
|
|||
=> %s useful \n\
|
||||
=> %s sitemap\n\
|
||||
=> %s feed\n\
|
||||
=> https://git.vern.cc/techn0path/ git\n", \
|
||||
=> https://git.vern.cc/techn0path/ git\n\n", \
|
||||
relpath(dirname, outputPath "/index.gmi"), \
|
||||
relpath(dirname, outputPath "/notes/index.gmi"), \
|
||||
relpath(dirname, outputPath "/useful/index.gmi"), \
|
||||
|
|
|
@ -1,33 +1,30 @@
|
|||
# external variables
|
||||
# - sourcePath
|
||||
|
||||
BEGIN {
|
||||
filename = FILENAME
|
||||
|
||||
printf "Navigation:\n\
|
||||
=> index.gmi home\n\
|
||||
=> notes/index.gmi notes\n\
|
||||
=> useful/index.gmi useful\n\
|
||||
=> sitemap.gmi sitemap\n\
|
||||
=> feed.atom feed\n\n\
|
||||
# Sitemap\n\
|
||||
This document is automatically generated. See:\n\
|
||||
=> notes/awk-make-sh.gmi\n"
|
||||
printf "%s", genNavbarGMI(FILENAME, "src/", "gmi/")
|
||||
}
|
||||
|
||||
FILENAME != filename {
|
||||
filename = FILENAME
|
||||
printf "\n"
|
||||
{
|
||||
gsub("^" sourcePath, "", FILENAME)
|
||||
|
||||
pathComponents[1] = ""
|
||||
split(FILENAME, pathComponents, "/")
|
||||
|
||||
oldFolderName = folderName
|
||||
folderName = pathComponents[1]
|
||||
|
||||
if (oldFolderName != folderName) {
|
||||
printf "\n# %s\n", folderName
|
||||
}
|
||||
}
|
||||
|
||||
/^#[^#]/ { sub("^#[ ]*", "## "); print }
|
||||
|
||||
/^=>/ {
|
||||
match($0, "^=>[ ]*[^ ]*")
|
||||
link = substr($0, 3, RSTART + RLENGTH - 3)
|
||||
description = substr($0, RSTART + RLENGTH, length($0))
|
||||
|
||||
sub("^[ ]*", "", link)
|
||||
sub("^[ ]*", "", description)
|
||||
|
||||
link = relpath("src", resolvePath(getDirname(FILENAME) "/" link))
|
||||
|
||||
printf "=> %s %s\n", link, description
|
||||
/^#[^#]/ {
|
||||
match($0, "^#[ ]*")
|
||||
title = substr($0, RSTART + RLENGTH)
|
||||
}
|
||||
|
||||
{
|
||||
printf "=> %s %s\n", FILENAME, title
|
||||
nextfile
|
||||
}
|
||||
|
|
|
@ -2,32 +2,28 @@ BEGIN {
|
|||
body = ""
|
||||
}
|
||||
|
||||
/^#[^#]/ {
|
||||
sub("^#[ ]*", "")
|
||||
body = body sprintf("<h2>%s</h2>", $0)
|
||||
{
|
||||
gsub("^" sourcePath, "", FILENAME)
|
||||
|
||||
pathComponents[1] = ""
|
||||
split(FILENAME, pathComponents, "/")
|
||||
|
||||
oldFolderName = folderName
|
||||
folderName = pathComponents[1]
|
||||
|
||||
if (oldFolderName != folderName) {
|
||||
body = body sprintf("<h2>%s</h2>\n", folderName)
|
||||
}
|
||||
}
|
||||
|
||||
/^=>/ {
|
||||
match($0, "^=>[ ]*[^ ]*")
|
||||
descriptionStart = RSTART + RLENGTH
|
||||
/^#[^#]/ {
|
||||
match($0, "^#[ ]*")
|
||||
title = substr($0, RSTART + RLENGTH)
|
||||
}
|
||||
|
||||
link = substr($0, 3, descriptionStart - 3)
|
||||
description = substr($0, descriptionStart, length($0))
|
||||
|
||||
sub("^[ ]*", "", link)
|
||||
sub("^[ ]*", "", description)
|
||||
|
||||
gsub("&", "&", description)
|
||||
gsub("<", "<", description)
|
||||
gsub(">", ">", description)
|
||||
gsub("'", "'", description)
|
||||
gsub("\"", """, description)
|
||||
|
||||
link = relpath("src", resolvePath(getDirname(FILENAME) "/" link))
|
||||
|
||||
if (link !~ "^[a-zA-Z0-9_]:") sub("\.gmi$", ".html", link)
|
||||
|
||||
body = body sprintf("<a href='%s'>%s</a><br>\n", link, description)
|
||||
{
|
||||
body = body sprintf("<a href='%s'>%s</a><br>\n", FILENAME, title)
|
||||
nextfile
|
||||
}
|
||||
|
||||
END {
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
# Notes
|
||||
An ever-growing collection of information.
|
||||
|
||||
=> on-personal-websites.gmi On personal websites
|
||||
=> software-freedom.gmi On software freedom
|
||||
=> how-i-generate-this-website.gmi How I generate this website
|
|
@ -1,5 +0,0 @@
|
|||
# Useful Things
|
||||
Welcome to this page! Here I'll list things that I've found worth sharing with others.
|
||||
|
||||
=> ./links.gmi Useful Web Links
|
||||
=> ./addons.gmi Useful Addons for Pale Moon
|
Loading…
Reference in New Issue