aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-01-31 13:18:04 +0000
committerJohn Ankarström <john@ankarstrom.se>2021-01-31 13:18:04 +0000
commit75303cb47fead302ad02982a0fe6d09dcc78372d (patch)
tree0f166f9780939ccd72147a3fcd0aeb7c477c9812
parentf679e1bca1ef5b018115eaeacfd4c1e8e17cc007 (diff)
downloadem-75303cb47fead302ad02982a0fe6d09dcc78372d.tar.gz
Support literal hyperlinks starting with a hash
-rwxr-xr-xemcollect2
-rwxr-xr-xemparse8
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], "^&lt;(\\./.*|\\.\\./.*|.*/.*)&gt;$"))
+ if (match(w[i], "^&lt;(\\./.*|\\.\\./.*|#.*|.*/.*)&gt;$"))
w[i] = link(substr(w[i], 5, RLENGTH-8))
- else if (match(w[i], "^&lt;(\\./.*|\\.\\./.*|.*/.*)&gt;[.,:;?!)]$"))
+ else if (match(w[i], "^&lt;(\\./.*|\\.\\./.*|#.*|.*/.*)&gt;[.,:;?!)]$"))
w[i] = link(substr(w[i], 5, RLENGTH-9)) substr(w[i], RLENGTH)
- else if (match(w[i], "^&lt;(\\./.*|\\.\\./.*|.*/.*)&gt;\\)[.,:;?!]$"))
+ else if (match(w[i], "^&lt;(\\./.*|\\.\\./.*|#.*|.*/.*)&gt;\\)[.,:;?!]$"))
w[i] = link(substr(w[i], 5, RLENGTH-10)) substr(w[i], RLENGTH-1)
if (match(w[i], "^\\[[0-9]+\\]$"))