modified the Makefile, tmpl/gemini.awk, tmpl/html.awk, and tmpl/sitemap_gmi.awk
This commit is contained in:
parent
4a9d79b769
commit
edc137420d
20
Makefile
20
Makefile
|
@ -10,17 +10,17 @@ clean:
|
|||
subdirs:
|
||||
find src -mindepth 1 -type d -printf '%P\0' | xargs -0 -I{} mkdir -p gmi/{} html/{}
|
||||
|
||||
html/%.html: src/%.gmi tmpl/html.awk
|
||||
mawk -f tmpl/html.awk -- $< > $@
|
||||
html/%.html: src/%.gmi tmpl/html.awk tmpl/common_functions.awk
|
||||
mawk -f tmpl/common_functions.awk -f tmpl/html.awk -- $< > $@
|
||||
|
||||
gmi/%.gmi: src/%.gmi tmpl/gemini.awk
|
||||
mawk -f tmpl/gemini.awk -- $< > $@
|
||||
gmi/%.gmi: src/%.gmi tmpl/gemini.awk tmpl/common_functions.awk
|
||||
mawk -f tmpl/common_functions.awk -f tmpl/gemini.awk -- $< > $@
|
||||
|
||||
gmi/sitemap.gmi: $(SITEMAP_INDEX_FILES) tmpl/sitemap_gmi.awk
|
||||
mawk -f tmpl/sitemap_gmi.awk -- $(SITEMAP_INDEX_FILES) > $@
|
||||
gmi/sitemap.gmi: $(SITEMAP_INDEX_FILES) tmpl/sitemap_gmi.awk tmpl/common_functions.awk
|
||||
mawk -f tmpl/common_functions.awk -f tmpl/sitemap_gmi.awk -- $(SITEMAP_INDEX_FILES) > $@
|
||||
|
||||
gmi/feed.atom: src/feed.ass tmpl/feed.awk
|
||||
mawk -f tmpl/feed.awk -- $< > $@
|
||||
gmi/feed.atom: src/feed.ass tmpl/feed.awk tmpl/common_functions.awk
|
||||
mawk -f tmpl/common_functions.awk -f tmpl/feed.awk -- $< > $@
|
||||
|
||||
html/feed.atom: src/feed.ass tmpl/feed.awk
|
||||
mawk -f tmpl/feed.awk -- $< > $@
|
||||
html/feed.atom: src/feed.ass tmpl/feed.awk tmpl/common_functions.awk
|
||||
mawk -f tmpl/common_functions.awk -f tmpl/feed.awk -- $< > $@
|
||||
|
|
|
@ -1,24 +1,5 @@
|
|||
function getDirname(path, pathComponents, npathComponents, dirname) {
|
||||
pathComponents[1] = ""
|
||||
sub("/$", "", path)
|
||||
npathComponents = split(path, pathComponents, "/")
|
||||
dirname = ""
|
||||
|
||||
if (npathComponents < 1) return "."
|
||||
|
||||
for (i = 1; i < npathComponents; i++)
|
||||
dirname = dirname pathComponents[i] "/"
|
||||
|
||||
return dirname
|
||||
}
|
||||
|
||||
function relpath(base, path, resolvedPath) {
|
||||
sprintf("realpath --relative-to=\"%s\" \"%s\"", base, path) | getline resolvedPath
|
||||
return resolvedPath
|
||||
}
|
||||
|
||||
BEGIN {}
|
||||
BEGINFILE {
|
||||
BEGIN {
|
||||
getline
|
||||
dirname = getDirname(relpath(ENVIRON["PWD"], FILENAME))
|
||||
|
||||
printf "Navigation:\n\
|
||||
|
@ -33,4 +14,4 @@ BEGINFILE {
|
|||
relpath(dirname, ENVIRON["PWD"] "/src/howto/index.gmi"), \
|
||||
relpath(dirname, ENVIRON["PWD"] "/src/sitemap.gmi")
|
||||
}
|
||||
{ print }
|
||||
{ print }
|
||||
|
|
|
@ -1,20 +1,3 @@
|
|||
function getDirname(path, pathComponents, npathComponents, dirname) {
|
||||
pathComponents[1] = ""
|
||||
sub("/$", "", path)
|
||||
npathComponents = split(path, pathComponents, "/")
|
||||
dirname = ""
|
||||
|
||||
if (npathComponents < 2) return "."
|
||||
else for (i = 1; i < npathComponents; i++)
|
||||
dirname = dirname pathComponents[i] "/"
|
||||
return dirname
|
||||
}
|
||||
|
||||
function relpath(base, path, resolvedPath) {
|
||||
sprintf("realpath --relative-to=\"%s\" \"%s\"", base, path) | getline resolvedPath
|
||||
return resolvedPath
|
||||
}
|
||||
|
||||
BEGIN {
|
||||
FS = " "
|
||||
title = "techn0path - no title"
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
#!
|
||||
awk '/^#[^#]/ { sub("^#([ ]*)", ""); printf "%s", $0; exit } { print "techn0path" }' $1
|
||||
#!
|
||||
</title>
|
||||
|
||||
<meta name='referrer' content='no-referrer' />
|
||||
<meta name='author' content='techn0path' />
|
||||
<meta name='viewport' content='width=device-width,initial-scale=1.0' />
|
||||
|
||||
<style>
|
||||
body { background: black; color: white; margin: 40px; }
|
||||
#content { max-width: 100ch; }
|
||||
a { color: cadetblue; }
|
||||
a :visited { color: chartreuse; }
|
||||
h1, h2, h3 { color: burlywood; }
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav>
|
||||
<div id='navbar'>
|
||||
#!
|
||||
printf '<a href="%s">codeAI</a> |
|
||||
<a href="%s">notes</a> |
|
||||
<a href="%s">howto</a> |
|
||||
<a href="%s">useful</a> |
|
||||
<a href="%s">sitemap</a>' `realpath --relative-to="$(dirname $1)" "$PWD/src/index.html" "$PWD/src/notes/index.html" "$PWD/src/howto/index.html" "$PWD/src/useful/index.html" "$PWD/src/sitemap.html"`
|
||||
#!
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
<div id='content'>
|
||||
#!
|
||||
printf "<p>Last modified on %s.</p>" `date -u -r "$1" +%Y/%m/%d`
|
||||
|
||||
awk -F " " '/^=>/ {
|
||||
if (NF < 2) next
|
||||
sub("^([ ]*)", "", $2)
|
||||
if (!match($2, "^(.*):"))
|
||||
sub("\\.gmi$", ".html", $2)
|
||||
} { print $0 }' $1 | gemini2html
|
||||
#!
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
|
@ -1,53 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
#!
|
||||
awk '/^#[^#]/ { sub("^#([ ]*)", ""); printf "%s", $0; exit } { print "techn0path" }' $1
|
||||
#!
|
||||
</title>
|
||||
|
||||
<meta name='referrer' content='no-referrer' />
|
||||
<meta name='author' content='techn0path' />
|
||||
<meta name='viewport' content='width=device-width,initial-scale=1.0' />
|
||||
|
||||
<style>
|
||||
body { background: black; color: white; margin: 40px; }
|
||||
#content { max-width: 100ch; }
|
||||
a { color: cadetblue; }
|
||||
a :visited { color: chartreuse; }
|
||||
h1, h2, h3 { color: burlywood; }
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav>
|
||||
<div id='navbar'>
|
||||
#!
|
||||
printf '<a href="%s">codeAI</a> |
|
||||
<a href="%s">notes</a> |
|
||||
<a href="%s">howto</a> |
|
||||
<a href="%s">useful</a> |
|
||||
<a href="%s">sitemap</a>' `realpath --relative-to="$(dirname $1)" "$PWD/src/index.html" "$PWD/src/notes/index.html" "$PWD/src/howto/index.html" "$PWD/src/useful/index.html" "$PWD/src/sitemap.html"`
|
||||
#!
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
<div id='content'>
|
||||
#!
|
||||
printf "<p>Last modified on %s.</p>" `date -u -r "$1" +%Y/%m/%d`
|
||||
|
||||
awk -F " " '/^=>/ {
|
||||
if (NF < 2) next
|
||||
sub("^([ ]*)", "", $2)
|
||||
if (!match($2, "^(.*):"))
|
||||
sub("\\.gmi$", ".html", $2)
|
||||
} { print $0 }' $1 | gemini2html
|
||||
#!
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
|
@ -1,53 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
#!
|
||||
awk '/^#[^#]/ { sub("^#([ ]*)", ""); printf "%s", $0; exit } { print "techn0path" }' $1
|
||||
#!
|
||||
</title>
|
||||
|
||||
<meta name='referrer' content='no-referrer' />
|
||||
<meta name='author' content='techn0path' />
|
||||
<meta name='viewport' content='width=device-width,initial-scale=1.0' />
|
||||
|
||||
<style>
|
||||
body { background: black; color: white; margin: 40px; }
|
||||
#content { max-width: 100ch; }
|
||||
a { color: cadetblue; }
|
||||
a :visited { color: chartreuse; }
|
||||
h1, h2, h3 { color: burlywood; }
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav>
|
||||
<div id='navbar'>
|
||||
#!
|
||||
printf '<a href="%s">codeAI</a> |
|
||||
<a href="%s">notes</a> |
|
||||
<a href="%s">howto</a> |
|
||||
<a href="%s">useful</a> |
|
||||
<a href="%s">sitemap</a>' `realpath --relative-to="$(dirname $1)" "$PWD/src/index.html" "$PWD/src/notes/index.html" "$PWD/src/howto/index.html" "$PWD/src/useful/index.html" "$PWD/src/sitemap.html"`
|
||||
#!
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
<div id='content'>
|
||||
#!
|
||||
printf "<p>Last modified on %s.</p>" `date -u -r "$1" +%Y/%m/%d`
|
||||
|
||||
awk -F " " '/^=>/ {
|
||||
if (NF < 2) next
|
||||
sub("^([ ]*)", "", $2)
|
||||
if (!match($2, "^(.*):"))
|
||||
sub("\\.gmi$", ".html", $2)
|
||||
} { print $0 }' $1 | gemini2html
|
||||
#!
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
|
@ -1,50 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
#!
|
||||
awk '/^#[^#]/ { sub("^#([ ]*)", ""); printf "%s", $0; exit } { print "techn0path" }' $1
|
||||
#!
|
||||
</title>
|
||||
|
||||
<meta name='referrer' content='no-referrer' />
|
||||
<meta name='author' content='techn0path' />
|
||||
<meta name='viewport' content='width=device-width,initial-scale=1.0' />
|
||||
|
||||
<style>
|
||||
body { margin: 15px; }
|
||||
#content { max-width: 70ch; }
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav>
|
||||
<div id='navbar'>
|
||||
#!
|
||||
printf '<a href="%s">codeAI</a> |
|
||||
<a href="%s">notes</a> |
|
||||
<a href="%s">howto</a> |
|
||||
<a href="%s">useful</a> |
|
||||
<a href="%s">sitemap</a>' `realpath --relative-to="$(dirname $1)" "$PWD/src/index.html" "$PWD/src/notes/index.html" "$PWD/src/howto/index.html" "$PWD/src/useful/index.html" "$PWD/src/sitemap.html"`
|
||||
#!
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
<div id='content'>
|
||||
#!
|
||||
printf "<p>Last modified on %s.</p>" `date -u -r "$1" +%Y/%m/%d`
|
||||
|
||||
awk -F " " '/^=>/ {
|
||||
if (NF < 2) next
|
||||
sub("^([ ]*)", "", $2)
|
||||
if (!match($2, "^(.*):"))
|
||||
sub("\\.gmi$", ".html", $2)
|
||||
} { print $0 }' $1 | gemini2html
|
||||
#!
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
|
@ -1,50 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
#!
|
||||
awk '/^#[^#]/ { sub("^#([ ]*)", ""); printf "%s", $0; exit } { print "techn0path" }' $1
|
||||
#!
|
||||
</title>
|
||||
|
||||
<meta name='referrer' content='no-referrer' />
|
||||
<meta name='author' content='techn0path' />
|
||||
<meta name='viewport' content='width=device-width,initial-scale=1.0' />
|
||||
|
||||
<style>
|
||||
body { margin: 15px; }
|
||||
#content { max-width: 70ch; }
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav>
|
||||
<div id='navbar'>
|
||||
#!
|
||||
printf '<a href="%s">codeAI</a> |
|
||||
<a href="%s">notes</a> |
|
||||
<a href="%s">howto</a> |
|
||||
<a href="%s">useful</a> |
|
||||
<a href="%s">sitemap</a>' `realpath --relative-to="$(dirname $1)" "$PWD/src/index.html" "$PWD/src/notes/index.html" "$PWD/src/howto/index.html" "$PWD/src/useful/index.html" "$PWD/src/sitemap.html"`
|
||||
#!
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
<div id='content'>
|
||||
#!
|
||||
printf "<p>Last modified on %s.</p>" `date -u -r "$1" +%Y/%m/%d`
|
||||
|
||||
awk -F " " '/^=>/ {
|
||||
if (NF < 2) next
|
||||
sub("^([ ]*)", "", $2)
|
||||
if (!match($2, "^(.*):"))
|
||||
sub("\\.gmi$", ".html", $2)
|
||||
} { print $0 }' $1 | gemini2html
|
||||
#!
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
|
@ -1,50 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
#!
|
||||
awk '/^#[^#]/ { sub("^#([ ]*)", ""); printf "%s", $0; exit } { print "techn0path" }' $1
|
||||
#!
|
||||
</title>
|
||||
|
||||
<meta name='referrer' content='no-referrer' />
|
||||
<meta name='author' content='techn0path' />
|
||||
<meta name='viewport' content='width=device-width,initial-scale=1.0' />
|
||||
|
||||
<style>
|
||||
body { margin: 15px; }
|
||||
#content { max-width: 70ch; }
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav>
|
||||
<div id='navbar'>
|
||||
#!
|
||||
printf '<a href="%s">codeAI</a> |
|
||||
<a href="%s">notes</a> |
|
||||
<a href="%s">howto</a> |
|
||||
<a href="%s">useful</a> |
|
||||
<a href="%s">sitemap</a>' `realpath --relative-to="$(dirname $1)" "$PWD/src/index.html" "$PWD/src/notes/index.html" "$PWD/src/howto/index.html" "$PWD/src/useful/index.html" "$PWD/src/sitemap.html"`
|
||||
#!
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
<div id='content'>
|
||||
#!
|
||||
printf "<p>Last modified on %s.</p>" `date -u -r "$1" +%Y/%m/%d`
|
||||
|
||||
awk -F " " '/^=>/ {
|
||||
if (NF < 2) next
|
||||
sub("^([ ]*)", "", $2)
|
||||
if (!match($2, "^(.*):"))
|
||||
sub("\\.gmi$", ".html", $2)
|
||||
} { print $0 }' $1 | gemini2html
|
||||
#!
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
|
@ -1,69 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
#!
|
||||
gawk '/^#[^#]/ { sub("^#([ ]*)", ""); printf "<title>%s</title>", $0; exit } { print "<title>techn0path</title>" }' $1
|
||||
#!
|
||||
<meta name='referrer' content='no-referrer' />
|
||||
<meta name='author' content='techn0path' />
|
||||
<meta name='viewport' content='width=device-width,initial-scale=1.0' />
|
||||
|
||||
<style>
|
||||
#content { max-width: 100ch; margin: auto; }
|
||||
#navbar { max-width: 100ch; margin: auto; }
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header>
|
||||
<nav id='navbar'>
|
||||
#!
|
||||
printf '<a href="%s">codeAI</a> |
|
||||
<a href="%s">notes</a> |
|
||||
<a href="%s">howto</a> |
|
||||
<a href="%s">useful</a> |
|
||||
<a href="%s">sitemap</a>' `realpath --relative-to="$(dirname $1)" "$PWD/src/index.html" "$PWD/src/notes/index.html" "$PWD/src/howto/index.html" "$PWD/src/useful/index.html" "$PWD/src/sitemap.html"`
|
||||
#!
|
||||
</nav>
|
||||
</header><br>
|
||||
|
||||
<article id='content'>
|
||||
|
||||
#!
|
||||
gawk -F " " '
|
||||
BEGIN {
|
||||
subHeadings[0] = ""
|
||||
arrayLen = 0
|
||||
}
|
||||
/^##[^#]/ {
|
||||
sub("^##([ ]*)", "")
|
||||
subHeadings[arrayLen] = sprintf("%s", $0)
|
||||
arrLen += 1
|
||||
}
|
||||
END {
|
||||
if (arrLen == 0) exit
|
||||
|
||||
printf "<details> \n\
|
||||
<summary>Table of contents</summary>\n\
|
||||
<nav id=\"toc\">\n\
|
||||
<h1>Table of contents</h1>\n\
|
||||
<ol>"
|
||||
|
||||
|
||||
for (i = 0; i < arrLen; i += 1)
|
||||
printf "<li>%s</li>", subHeadings[i]
|
||||
|
||||
printf "</ol></nav></details>\n"
|
||||
}
|
||||
' $1
|
||||
|
||||
printf "<p>Last modified on %s.</p>" `date -u -r "$1" +%Y/%m/%d`
|
||||
|
||||
gawk -F " " '/^=>[ ][^ ]/ {
|
||||
sub("^([ ]*)", "", $2)
|
||||
if (!match($2, "^(.*):")) sub("\\.gmi$", ".html", $2)
|
||||
} { print $0 }' $1 | gemini2html
|
||||
#!
|
||||
</article>
|
||||
</body>
|
||||
</html>
|
|
@ -1,69 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
#!
|
||||
gawk '/^#[^#]/ { sub("^#([ ]*)", ""); printf "<title>%s</title>", $0; exit } { print "<title>techn0path</title>" }' $1
|
||||
#!
|
||||
<meta name='referrer' content='no-referrer' />
|
||||
<meta name='author' content='techn0path' />
|
||||
<meta name='viewport' content='width=device-width,initial-scale=1.0' />
|
||||
|
||||
<style>
|
||||
#content { max-width: 100ch; margin: auto; }
|
||||
#navbar { max-width: 100ch; margin: auto; }
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header>
|
||||
<nav id='navbar'>
|
||||
#!
|
||||
printf '<a href="%s">codeAI</a> |
|
||||
<a href="%s">notes</a> |
|
||||
<a href="%s">howto</a> |
|
||||
<a href="%s">useful</a> |
|
||||
<a href="%s">sitemap</a>' `realpath --relative-to="$(dirname $1)" "$PWD/src/index.html" "$PWD/src/notes/index.html" "$PWD/src/howto/index.html" "$PWD/src/useful/index.html" "$PWD/src/sitemap.html"`
|
||||
#!
|
||||
</nav>
|
||||
</header><br>
|
||||
|
||||
<article id='content'>
|
||||
|
||||
#!
|
||||
gawk -F " " '
|
||||
BEGIN {
|
||||
subHeadings[0] = ""
|
||||
arrayLen = 0
|
||||
}
|
||||
/^##[^#]/ {
|
||||
sub("^##([ ]*)", "")
|
||||
subHeadings[arrayLen] = sprintf("%s", $0)
|
||||
arrLen += 1
|
||||
}
|
||||
END {
|
||||
if (arrLen == 0) exit
|
||||
|
||||
printf "<details> \n\
|
||||
<summary>Table of contents</summary>\n\
|
||||
<nav id=\"toc\">\n\
|
||||
<h1>Table of contents</h1>\n\
|
||||
<ol>"
|
||||
|
||||
|
||||
for (i = 0; i < arrLen; i += 1)
|
||||
printf "<li>%s</li>", subHeadings[i]
|
||||
|
||||
printf "</ol></nav></details>\n"
|
||||
}
|
||||
' $1
|
||||
|
||||
printf "<p>Last modified on %s.</p>" `date -u -r "$1" +%Y/%m/%d`
|
||||
|
||||
gawk -F " " '/^=>[ ][^ ]/ {
|
||||
sub("^([ ]*)", "", $2)
|
||||
if (!match($2, "^(.*):")) sub("\\.gmi$", ".html", $2)
|
||||
} { print $0 }' $1 | gemini2html
|
||||
#!
|
||||
</article>
|
||||
</body>
|
||||
</html>
|
|
@ -1,69 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
#!
|
||||
gawk '/^#[^#]/ { sub("^#([ ]*)", ""); printf "<title>%s</title>", $0; exit } { print "<title>techn0path</title>" }' $1
|
||||
#!
|
||||
<meta name='referrer' content='no-referrer' />
|
||||
<meta name='author' content='techn0path' />
|
||||
<meta name='viewport' content='width=device-width,initial-scale=1.0' />
|
||||
|
||||
<style>
|
||||
#content { max-width: 100ch; margin: auto; }
|
||||
#navbar { max-width: 100ch; margin: auto; }
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header>
|
||||
<nav id='navbar'>
|
||||
#!
|
||||
printf '<a href="%s">codeAI</a> |
|
||||
<a href="%s">notes</a> |
|
||||
<a href="%s">howto</a> |
|
||||
<a href="%s">useful</a> |
|
||||
<a href="%s">sitemap</a>' `realpath --relative-to="$(dirname $1)" "$PWD/src/index.html" "$PWD/src/notes/index.html" "$PWD/src/howto/index.html" "$PWD/src/useful/index.html" "$PWD/src/sitemap.html"`
|
||||
#!
|
||||
</nav>
|
||||
</header><br>
|
||||
|
||||
<article id='content'>
|
||||
|
||||
#!
|
||||
gawk -F " " '
|
||||
BEGIN {
|
||||
subHeadings[0] = ""
|
||||
arrayLen = 0
|
||||
}
|
||||
/^##[^#]/ {
|
||||
sub("^##([ ]*)", "")
|
||||
subHeadings[arrayLen] = sprintf("%s", $0)
|
||||
arrLen += 1
|
||||
}
|
||||
END {
|
||||
if (arrLen == 0) exit
|
||||
|
||||
printf "<details> \n\
|
||||
<summary>Table of contents</summary>\n\
|
||||
<nav id=\"toc\">\n\
|
||||
<h1>Table of contents</h1>\n\
|
||||
<ol>"
|
||||
|
||||
|
||||
for (i = 0; i < arrLen; i += 1)
|
||||
printf "<li>%s</li>", subHeadings[i]
|
||||
|
||||
printf "</ol></nav></details>\n"
|
||||
}
|
||||
' $1
|
||||
|
||||
printf "<p>Last modified on %s.</p>" `date -u -r "$1" +%Y/%m/%d`
|
||||
|
||||
gawk -F " " '/^=>[ ][^ ]/ {
|
||||
sub("^([ ]*)", "", $2)
|
||||
if (!match($2, "^(.*):")) sub("\\.gmi$", ".html", $2)
|
||||
} { print $0 }' $1 | gemini2html
|
||||
#!
|
||||
</article>
|
||||
</body>
|
||||
</html>
|
|
@ -4,18 +4,6 @@ This document is automatically generated. See:\n\
|
|||
=> howto/website-generation.gmi\n"
|
||||
}
|
||||
|
||||
function getDirname(path, pathComponents, npathComponents, dirname) {
|
||||
pathComponents[1] = ""
|
||||
sub("/$", "", path)
|
||||
npathComponents = split(path, pathComponents, "/")
|
||||
dirname = ""
|
||||
|
||||
if (npathComponents < 1) return "."
|
||||
else for (i = 1; i < npathComponents; i++)
|
||||
dirname = dirname pathComponents[i] "/"
|
||||
return dirname
|
||||
}
|
||||
|
||||
/^#[^#]/ {
|
||||
sub("^#([ ]*)", "")
|
||||
printf "## %s\n", $0
|
||||
|
|
Loading…
Reference in New Issue