fixed tmpl/sitemap_gmi.awk, originally realpath returned the wrong URL

This commit is contained in:
Abdullah Islam 2023-05-01 12:03:48 +06:00
parent d08244c07b
commit 4a9d79b769
2 changed files with 12 additions and 3 deletions

View File

@ -17,4 +17,10 @@ gmi/%.gmi: src/%.gmi tmpl/gemini.awk
mawk -f tmpl/gemini.awk -- $< > $@
gmi/sitemap.gmi: $(SITEMAP_INDEX_FILES) tmpl/sitemap_gmi.awk
mawk -f tmpl/sitemap_gmi.awk $(SITEMAP_INDEX_FILES) > $@
mawk -f tmpl/sitemap_gmi.awk -- $(SITEMAP_INDEX_FILES) > $@
gmi/feed.atom: src/feed.ass tmpl/feed.awk
mawk -f tmpl/feed.awk -- $< > $@
html/feed.atom: src/feed.ass tmpl/feed.awk
mawk -f tmpl/feed.awk -- $< > $@

View File

@ -22,7 +22,9 @@ function getDirname(path, pathComponents, npathComponents, dirname) {
}
/^=>/ {
if (match($1, "^=>([^ ]*)")) {
link = ""
description = ""
if (match($1, "^=>\S")) {
link = $1
sub("^=>", "", link)
$1 = ""
@ -35,9 +37,10 @@ function getDirname(path, pathComponents, npathComponents, dirname) {
description = $0
}
sub("^([ ]*)", "", description)
sub("^([ ]*)", "", link)
sprintf("realpath %s/%s", getDirname(FILENAME), link) | getline absolutePath
sprintf("realpath --relative-to=\"%s\" \"%s\"", ENVIRON["PWD"], absolutePath) | getline link
sprintf("realpath --relative-to=\"%s\" \"%s\"", ENVIRON["PWD"] "/src", absolutePath) | getline link
printf "=> %s %s\n", link, description
}