site

My personal website.

Date: Thu, 15 Jul 2021 23:54:40 +0200

Preserve spaces when generating links

Diffstat:

M generate                            |      11 ++++++-----

1 file changed, 6 insertions(+), 5 deletions(-)

@@ -47,20 +47,21 @@ function join(array, start, end, sep,    result, i) {
     return result;
 }
 /^=>/ && !preformatted {
-    $0 = substr($0, 3, length($0));
     if (html && list) {
         print "</ul>";
         list = 0;
     }
+    $0 = substr($0, 3, length($0));
+    sub(/^ */, "");
     url = $1;
-    $1 = "";
-    sub(/^ /, "", $0);
-    text = $0;
+    text = substr($0, length($1) + 1, length($0));
+    sub(/^ */, "", text);
     if (text == "")
         text = url;
     if (html) {
         sub(/\.gmi$/, ".html", url);
-        print "<p><a href=\"" url "\">" $0 "</a></p>";
+        print "TEXT: " $0;
+        print "<p><a href=\"" url "\">" text "</a></p>";
     } else {
         split(url, segments, "/");
         host = segments[3];