tttml

tools for formatting a very basic markdown-like format
Log | Files | Refs | README

commit bd5225db743ed20a10451c667dcd8de42c6e1437
parent ebfcd529de383bd42ba47eddceb51dd830d17614
Author: Josuah Demangeon <mail@josuah.net>
Date:   Fri, 20 Apr 2018 14:19:23 +0200

fix all links being "h" entries

Diffstat:
Mmarkup-gopher | 14++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/markup-gopher b/markup-gopher @@ -30,25 +30,27 @@ match($0, "^\\[[^]]*\\]: ") { sub("^[ \t]*", "", path); if (match(uri, "^[01789aghI]/")) { - type = substr(path, 1, 1); path = uri; sub(".", "", path); + type = substr(path, 1, 1); } else if (sub("^gopher://", "", uri)) { - host = uri; sub("/.*", "", host); path = uri; sub(".*/", "/", path); + host = uri; sub("/.*", "", host); if (match(host, "[a-z.-]+:")) { port = substr(host, RLENGTH + 1); host = substr(host, RSTART, RLENGTH - 1); } - } else if (match(uri, "/$")) { - type = "1"; + } else if (match(uri, "^/")) { + path = uri; + type = match(uri, "/$") ? "1" : "0"; } else { - type = "h"; host = ""; port = ""; path = "URL:" uri; + type = "h"; host = ""; port = ""; } for (name = ""; match($0, /[^ \t]/); name = name " " $0) if (!getline) { end = 1; break; } - if (name == "" || name == " ") name = " " uri; + if (name == "" || name == " ") + name = " " uri; printf("%s%s:%s\t%s\t%s\t%s\n", type, tag, name, path, host, port);