aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus@riseup.net>2024-08-08 14:21:52 +0200
committermarty hiatt <martianhiatus@riseup.net>2024-08-08 14:21:52 +0200
commitf6a17c02f2a7655b38b8dcf41912f89a5d952368 (patch)
tree0c4c58ee1d2951b8f0acdeafd25db0a17b517520 /lisp
parent5cb54813a2c85403ded7afe45cf8e55d4dd277f4 (diff)
re-write hashtag-from-url
Diffstat (limited to 'lisp')
-rw-r--r--lisp/mastodon-tl.el14
1 files changed, 5 insertions, 9 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 8158073..e86cb84 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -973,15 +973,11 @@ this should be of the form <at-sign><user id>, e.g. \"@Gargon\"."
INSTANCE-URL is the url of the instance for the toot that the link
came from (tag links always point to a page on the instance publishing
the toot)."
- (cond
- ;; Mastodon type tag link:
- ((string-prefix-p (concat instance-url "/tags/") url)
- (substring url (length (concat instance-url "/tags/"))))
- ;; Link from some other ostatus site we've encountered:
- ((string-prefix-p (concat instance-url "/tag/") url)
- (substring url (length (concat instance-url "/tag/"))))
- ;; If nothing matches we assume it is not a hashtag link:
- (t nil)))
+ (let* ((parsed (url-generic-parse-url url))
+ (path (url-filename parsed))
+ (split (string-split path "/")))
+ (when (string-prefix-p "/tag" path) ;; "/tag/" or "/tags/"
+ (nth 2 split))))
;;; HYPERLINKS