branch: elpa/mastodon commit fe3a4b8e2c7690c089805d3756b877b3c347eeaf Author: marty hiatt <martianhia...@disroot.org> Commit: marty hiatt <martianhia...@disroot.org>
WIP tl: render post tags direct from tags data. WIP: we should only render like this if the same tags aren't already rendered in the item's body, to avoid doubling up. --- lisp/mastodon-tl.el | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index a04e06cfff..a69237f663 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1165,6 +1165,28 @@ the toot)." (string-prefix-p "/tag" path)) ;; "/tag/" or "/tags/" (nth 2 split)))) +(defun mastodon-tl--base-tags (tags) + "TAGS is a list of tag alists, from a post's JSON. +Return a string of all tags, linkified." + (cl-loop for tag in tags + concat (concat (mastodon-tl--render-base-tag tag) + " "))) + +(defun mastodon-tl--render-base-tag (tag) + "TAG." + (let ((name (alist-get 'name tag))) + (mastodon-tl--buttonify-link + (concat "#" name) + 'mastodon-tab-stop 'hashtag + 'mastodon-tag name + 'mouse-face '(highlight) + 'keymap mastodon-tl--link-keymap + 'face '(shr-text shr-link) + 'follow-link t + 'shr-tab-stop t + 'shr-url (alist-get 'url tag) + 'help-echo (concat "Browse tag #" name)))) + ;;; HYPERLINKS @@ -1846,6 +1868,11 @@ CW-EXPANDED means treat content warnings as unfolded." "LESS" cw-p (not cw-expanded)) "")) 'toot-body t) ;; includes newlines etc. for folding + ;; post tags: + (let ((tags (alist-get 'tags toot))) + ;; FIXME: we also need to test here for normal body tags, and if + ;; so, don't go ahead: + (if tags (concat "\n" (mastodon-tl--base-tags tags)) "")) ;; byline: "\n" (if no-byline