summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mumi/web/view/utils.scm17
1 files changed, 17 insertions, 0 deletions
diff --git a/mumi/web/view/utils.scm b/mumi/web/view/utils.scm
index f863528..0735bf5 100644
--- a/mumi/web/view/utils.scm
+++ b/mumi/web/view/utils.scm
@@ -31,6 +31,7 @@
#:use-module (email email)
#:use-module (mumi messages)
#:use-module (rnrs bytevectors)
+ #:use-module (web uri)
#:export (prettify
avatar-color
display-message-body
@@ -111,6 +112,22 @@ with the next context."
(else 'text)))
(formatted-line
(cond
+ ((or (string-contains line "https://")
+ (string-contains line "http://")) =>
+ (lambda (index)
+ (let* ((pre (string-take line index))
+ (post (string-drop line index))
+ (uri+ (string-split post (char-set #\< #\> #\space))))
+ (match uri+
+ ((uri-string . rest)
+ (or (and=> (string->uri uri-string)
+ (lambda (uri)
+ `(span (@ (class "line"))
+ ,(string-trim-right pre #\<)
+ (a (@ (href ,uri-string))
+ ,uri-string)
+ ,@rest)))
+ `(span (@ (class "line")) ,line)))))))
((or (string-prefix? "Signed-off-by" line)
(string-prefix? "Co-authored-by" line))
`(span (@ (class "line commit attribution")) ,line))