From 75303cb47fead302ad02982a0fe6d09dcc78372d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sun, 31 Jan 2021 13:18:04 +0000 Subject: Support literal hyperlinks starting with a hash --- emcollect | 2 +- emparse | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/emcollect b/emcollect index 30cb7c0..c0f7759 100755 --- a/emcollect +++ b/emcollect @@ -16,4 +16,4 @@ BEGIN { expectblock = 1 } /^$/ { expectblock = 1; getline } expectblock && /^ \[[0-9]+\] / { block = "nl"; expectblock = 0 } -block = "nl" && /^ \[[0-9]+\] <[^ ]+>$/ { collect($0); next } +block = "nl" && /^ \[[0-9]+\] <(\.\/.*|\.\.\/.*|#.*|.*\/.*)>$/ { collect($0); next } diff --git a/emparse b/emparse index 7423bb2..3985a86 100755 --- a/emparse +++ b/emparse @@ -27,7 +27,7 @@ openblock == "pre" { sub("^ ", ""); $0 = escape($0); printf "%s\n", $0; next } openblock == "blockquote" && /^ > / { item(1, "blockquote", line) } openblock == "ul" && /^ - / { item(1, "ul", line) } openblock == "ol" && /^ [0-9]+\. / { item(1, "ol", line) } -openblock == "nl" && /^ \[[0-9]+\] / { item(1, "nl", line) } # text reference +openblock == "nl" && /^ \[[0-9]+\] / { item(1, "nl", line) } openblock == "dl" && /^ .*: / { term(line) } (openblock == "ul" || openblock == "ol") && /^ -/ { item(2, "ul", line) } @@ -49,11 +49,11 @@ function format(line) { for (i = 0; i <= n; i++) { if (w[i] == "") continue; - if (match(w[i], "^<(\\./.*|\\.\\./.*|.*/.*)>$")) + if (match(w[i], "^<(\\./.*|\\.\\./.*|#.*|.*/.*)>$")) w[i] = link(substr(w[i], 5, RLENGTH-8)) - else if (match(w[i], "^<(\\./.*|\\.\\./.*|.*/.*)>[.,:;?!)]$")) + else if (match(w[i], "^<(\\./.*|\\.\\./.*|#.*|.*/.*)>[.,:;?!)]$")) w[i] = link(substr(w[i], 5, RLENGTH-9)) substr(w[i], RLENGTH) - else if (match(w[i], "^<(\\./.*|\\.\\./.*|.*/.*)>\\)[.,:;?!]$")) + else if (match(w[i], "^<(\\./.*|\\.\\./.*|#.*|.*/.*)>\\)[.,:;?!]$")) w[i] = link(substr(w[i], 5, RLENGTH-10)) substr(w[i], RLENGTH-1) if (match(w[i], "^\\[[0-9]+\\]$")) -- cgit v1.2.3