removed code from tmpl/sitemap_gmi.awk
This commit is contained in:
parent
a2737b0de0
commit
5eced9dd47
2
Makefile
2
Makefile
|
@ -1,6 +1,6 @@
|
|||
SHELL = /bin/sh
|
||||
SOURCES = $(shell find src/ -type f)
|
||||
SITEMAP_INDEX_FILES = $(filter %/index.gmi, $(SOURCES))
|
||||
SITEMAP_INDEX_FILES = $(wildcard src/*/index.gmi)
|
||||
|
||||
all: subdirs $(SOURCES:src/%.gmi=html/%.html) $(SOURCES:src/%.gmi=gmi/%.gmi) gmi/sitemap.gmi gmi/feed.atom
|
||||
|
||||
|
|
|
@ -15,6 +15,11 @@ function relpath(base, path, resolvedPath) {
|
|||
return resolvedPath
|
||||
}
|
||||
|
||||
function absPath(base, path, resolvedPath) {
|
||||
sprintf("realpath %s", path) | getline resolvedPath
|
||||
return resolvedPath
|
||||
}
|
||||
|
||||
function convertToFilename(string, result) {
|
||||
result = tolower(string)
|
||||
gsub(" ", "_", result)
|
||||
|
|
|
@ -4,31 +4,18 @@ This document is automatically generated. See:\n\
|
|||
=> howto/website-generation.gmi\n"
|
||||
}
|
||||
|
||||
/^#[^#]/ {
|
||||
sub("^#([ ]*)", "")
|
||||
printf "## %s\n", $0
|
||||
}
|
||||
/^#[^#]/ { sub("^#", "## "); print }
|
||||
|
||||
/^=>/ {
|
||||
link = ""
|
||||
description = ""
|
||||
if (match($1, "^=>\S")) {
|
||||
if ($1 ~ "^=>\S") {
|
||||
link = $1
|
||||
sub("^=>", "", link)
|
||||
$1 = ""
|
||||
description = $0
|
||||
} else if (NF < 2) next
|
||||
else {
|
||||
link = $2
|
||||
$1 = ""
|
||||
$2 = ""
|
||||
description = $0
|
||||
}
|
||||
sub("^([ ]*)", "", description)
|
||||
sub("^([ ]*)", "", link)
|
||||
else link = $2
|
||||
|
||||
sprintf("realpath %s/%s", getDirname(FILENAME), link) | getline absolutePath
|
||||
sprintf("realpath --relative-to=\"%s\" \"%s\"", ENVIRON["PWD"] "/src", absolutePath) | getline link
|
||||
description = substr($0, length(link))
|
||||
tmp = relpath(ENVIRON["PWD"] "/src", absPath(getDirname(FILENAME), link))
|
||||
link = tmp
|
||||
|
||||
printf "=> %s %s\n", link, description
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue