tttml

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

commit 7b9791b74ab0b32f728884b0416ac55c9825f0d0
parent e5f695470b3ce7553e2e1609b9341e957f5fceae
Author: Josuah Demangeon <mail@josuah.net>
Date:   Thu, 19 Apr 2018 03:57:29 +0200

add latest changes from ~/bin and remove it from ~/bin

Diffstat:
Mmarkup-gopher | 12+++++-------
1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/markup-gopher b/markup-gopher @@ -28,21 +28,19 @@ match($0, "^\\[[^]]*\\]: ") { path = uri; type = "0"; sub("^[ \t]*", "", path); - if (match(path, "/$")) + if (match(uri, "/$")) type = "1"; - else if (match(path, "^[01789aghI]/")) { + else if (match(uri, "^[01789aghI]/")) { type = substr(path, 1, 1); - sub(".", "", path); - } - - if (sub("^gopher://", "", uri)) { + path = uri; sub(".", "", path); + } else if (sub("^gopher://", "", uri)) { host = uri; sub("/.*", "", host); path = uri; sub(".*/", "/", path); if (match(host, "[a-z.-]+:")) { port = substr(host, RLENGTH + 1); host = substr(host, RSTART, RLENGTH - 1); } - } else if (match(uri, "^[a-z0-9-]+:")) { + } else { type = "h"; host = ""; port = ""; path = "URL:" uri; }