fixed a few things

This commit is contained in:
Abdullah Islam 2023-05-13 16:48:00 +06:00
parent 2bacc68d07
commit efdb49ffe7
5 changed files with 40 additions and 34 deletions

View File

@ -12,13 +12,10 @@ all: subdirs \
gmi/feed.atom \
html/feed.atom \
test:
mawk -f ~/projects/awk_functions/lib.awk -f scripts/html.awk -- testing/example.gmi > testing/script_output.html
diff testing/expected_output.html testing/script_output.html
htmlvalidator testing/script_output.html
mawk -f ~/projects/awk_functions/lib.awk -f scripts/html.awk -- testing/example.gmi > testing/script_output.gmi
diff testing/expected_output.gmi testing/script_output.gmi
# test: testing/example.gmi testing/example.ass
# mawk -f ~/projects/awk_functions/lib.awk -f scripts/html.awk -- testing/example.gmi > testing/output.html
# mawk -f ~/projects/awk_functions/lib.awk -f scripts/gemini.awk -- testing/example.gmi > testing/output.gmi
# mawk -f ~/projects/awk_functions/lib.awk -f scripts/feed.awk -- testing/example.ass > testing/output.atom
clean:
rm -rf html/* gmi/*
@ -48,4 +45,4 @@ gmi/feed.atom: src/feed.ass scripts/feed.awk
mawk -f ~/projects/awk_functions/lib.awk -f scripts/feed.awk -- $< > $@
html/feed.atom: src/feed.ass scripts/feed.awk
mawk -v 'willConvertLinks=1' -f ~/projects/awk_functions/lib.awk -f scripts/feed.awk -- $< > $@
mawk -v 'willConvertLinks=1' -f ~/projects/awk_functions/lib.awk -f scripts/feed.awk -- $< > $@

View File

@ -1,15 +1,19 @@
BEGIN {
getline
getline firstLine
if (FILENAME != "-")
printf "Navigation:\n\
=> %s home\n\
=> %s notes\n\
=> %s useful\n\
=> %s sitemap\n", \
relpath(getDirname(FILENAME), ENVIRON["PWD"] "/src/index.gmi"), \
relpath(getDirname(FILENAME), ENVIRON["PWD"] "/src/notes/index.gmi"), \
relpath(getDirname(FILENAME), ENVIRON["PWD"] "/src/useful/index.gmi"), \
relpath(getDirname(FILENAME), ENVIRON["PWD"] "/src/sitemap.gmi")
=> %s sitemap\n\
=> %s feed\n\n", \
relpath(getDirname(FILENAME), "src/index.gmi"), \
relpath(getDirname(FILENAME), "src/notes/index.gmi"), \
relpath(getDirname(FILENAME), "src/useful/index.gmi"), \
relpath(getDirname(FILENAME), "src/sitemap.gmi"), \
relpath(getDirname(FILENAME), "src/feed.atom")
printf "%s\n", firstLine
}
{ print }

View File

@ -131,12 +131,15 @@ END {
navbarText = sprintf("<nav id='navbar'>\n\
<a href='%s'>home</a> | \
<a href='%s'>notes</a> | \
<a href='%s'>useful</a> \
<a href='%s'>useful</a> | \
<a href='%s'>sitemap</a> | \
<a href='%s'>feed</a>\
</nav>\n", \
relpath(getDirname(FILENAME), ENVIRON["PWD"] "/src/index.html"), \
relpath(getDirname(FILENAME), ENVIRON["PWD"] "/src/notes/index.html"), \
relpath(getDirname(FILENAME), ENVIRON["PWD"] "/src/useful/index.html"), \
relpath(getDirname(FILENAME), ENVIRON["PWD"] "/src/useful/index.html")) \
relpath(getDirname(FILENAME), "src/index.html"), \
relpath(getDirname(FILENAME), "src/notes/index.html"), \
relpath(getDirname(FILENAME), "src/useful/index.html"), \
relpath(getDirname(FILENAME), "src/sitemap.html"), \
relpath(getDirname(FILENAME), "src/feed.atom")) \
printf "<!DOCTYPE html>\n\
<html>\n\

View File

@ -1,9 +1,15 @@
BEGIN {
filename = FILENAME
printf "# Sitemap\n\
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\
=> howto/website-generation.gmi\n"
=> notes/awk-make-sh.gmi\n"
}
FILENAME != filename {
@ -22,7 +28,7 @@ FILENAME != filename {
sub("^([ ]*)", "", link)
sub("^([ ]*)", "", description)
link = relpath(ENVIRON["PWD"] "/src", resolvePath(ENVIRON["PWD"] "/" getDirname(FILENAME) "/" link))
link = relpath("src", resolvePath(getDirname(FILENAME) "/" link))
printf "=> %s %s\n", link, description
}

View File

@ -25,7 +25,7 @@ BEGIN {
gsub("'", "&apos;", description)
gsub("\"", "&quot;", description)
link = relpath(ENVIRON["PWD"] "/src", resolvePath(ENVIRON["PWD"] "/" getDirname(FILENAME) "/" link))
link = relpath("src", resolvePath(getDirname(FILENAME) "/" link))
if (link !~ "^([a-zA-Z0-9_]):") sub("\.gmi$", ".html", link)
@ -50,17 +50,13 @@ body { margin: 15px; }\n\
</head>\n\
<body>\n\
<header>\n\
<nav id='navbar'>\n"
printf "\
<a href='%s'>home</a> | \
<a href='%s'>notes</a> | \
<a href='%s'>useful</a>\n", \
relpath(getDirname(FILENAME), ENVIRON["PWD"] "/src/index.html"), \
relpath(getDirname(FILENAME), ENVIRON["PWD"] "/src/notes/index.html"), \
relpath(getDirname(FILENAME), ENVIRON["PWD"] "/src/useful/index.html")
printf "</nav>\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\
<article id='content'>\n\
%s\n\