From f6a17c02f2a7655b38b8dcf41912f89a5d952368 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Thu, 8 Aug 2024 14:21:52 +0200 Subject: re-write hashtag-from-url --- lisp/mastodon-tl.el | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'lisp') 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 , 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 -- cgit v1.2.3