summaryrefslogtreecommitdiffstats
path: root/util.tl
diff options
context:
space:
mode:
Diffstat (limited to 'util.tl')
-rw-r--r--util.tl8
1 files changed, 8 insertions, 0 deletions
diff --git a/util.tl b/util.tl
index 71fc985..e987423 100644
--- a/util.tl
+++ b/util.tl
@@ -21,3 +21,11 @@
(defun move-tail (items keys)
(move-impl items keys (length items)))
+
+(defun html-encode-with-http (str)
+ (let* ((pairs (tuples 2 (tok-str str #/https?:\/\/\S+/ t))))
+ (cat-str
+ (mappend (tb ((text : link))
+ (list (html-encode text)
+ (if link `<sup>[<a href="@link">link</a>]</sup>`)))
+ pairs))))