fix markup-gopher special links - tttml - converters for a simpler syntax than markdown
(HTM) git clone git://bitreich.org/tttml git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/tttml
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) README
---
(DIR) commit 61a2462794d4f5804122646f524c7913bc809529
(DIR) parent 332be10e3e3139840a4f021f6f6108fcfb32d064
(HTM) Author: Josuah Demangeon <mail@josuah.net>
Date: Sat, 5 May 2018 18:43:13 +0200
fix markup-gopher special links
Diffstat:
M markup-gopher | 8 ++++----
M markup-gopher.1 | 6 +++---
2 files changed, 7 insertions(+), 7 deletions(-)
---
(DIR) diff --git a/markup-gopher b/markup-gopher
@@ -8,8 +8,8 @@
# [tag]: proto://host/path
# [tag]: gopher://host:port/t/path
# [tag]: gopher://host/t/path
-# [tag]: //host/t/path
-# [tag]: /t/path
+# [tag]: t/path
+
BEGIN {
if (ARGC < 3 || 4 < ARGC) {
@@ -30,8 +30,8 @@ match($0, "^\\[[^]]*\\]: ") {
sub("^[ \t]*", "", uri);
if (match(uri, "^[01789aghI]/")) {
- path = uri; sub(".", "", path);
type = substr(uri, 1, 1);
+ path = uri; sub(".", "", path);
} else if (sub("^gopher://", "", uri)) {
path = uri; sub(".*/", "/", path);
host = uri; sub("/.*", "", host);
@@ -41,7 +41,7 @@ match($0, "^\\[[^]]*\\]: ") {
}
} else if (match(uri, "^/")) {
path = uri;
- type = match(uri, "/$") ? "1" : "0";
+ type = sub("/$", "", uri) ? "1" : "0";
} else {
path = "URL:" uri;
type = "h"; host = ""; port = "";
(DIR) diff --git a/markup-gopher.1 b/markup-gopher.1
@@ -11,7 +11,7 @@
.
.Sh SYNOPSIS
.
-.Nm markup-opher
+.Nm
.Ar host
.Ar port
.Op Ar file...
@@ -30,7 +30,7 @@ converting tabs into spaces and printing the rest.
and
.Ar port
is used to set the host in links that do not have a host, such as
-.Dl /path/to/file.txt
+.Pa /path/to/file.txt
.
.Bl -bullet -width 6n
.
@@ -66,7 +66,7 @@ or
followed by a
.Sq Li /
and all
-.Dq li gopher://
+.Dq Li gopher://
URI are printed using the corresponding entry type.
.
.It