site

My personal website.

Date: Tue, 13 Jul 2021 17:37:06 +0200

Fix generation of external gopher links

Diffstat:

M generate                            |      14 ++++++++++++--

1 file changed, 12 insertions(+), 2 deletions(-)

@@ -36,6 +36,16 @@ function wrap(text,   q, y, z) {
     }
     return z;
 }
+function join(array, start, end, sep,    result, i) {
+    if (sep == "")
+       sep = " ";
+    else if (sep == SUBSEP) # magic value
+       sep = "";
+    result = array[start];
+    for (i = start + 1; i <= end; i++)
+        result = result sep array[i];
+    return result;
+}
 /^=>/ && !preformatted {
     $0 = substr($0, 3, length($0));
     if (html && list) {
@@ -55,8 +65,8 @@ function wrap(text,   q, y, z) {
         split(url, segments, "/");
         host = segments[3];
         if (match(url, /^gopher:\/\//)) {
-            itemtype = "1";
-            path = $0;
+            itemtype = "h";
+            path = "/" join(segments, 4, length(segments), "/");
             port = "70";
         } else if (match(url, /^http:\/\//)) {
             itemtype = "h";