fix all links being "h" entries - tttml - converters for a simpler syntax than markdown HTML git clone git://bitreich.org/tttml git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/tttml DIR Log DIR Files DIR Refs DIR Tags DIR README --- DIR commit bd5225db743ed20a10451c667dcd8de42c6e1437 DIR parent ebfcd529de383bd42ba47eddceb51dd830d17614 HTML Author: Josuah Demangeon <mail@josuah.net> Date: Fri, 20 Apr 2018 14:19:23 +0200 fix all links being "h" entries Diffstat: M markup-gopher | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) --- DIR 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);