diff options
author | marty hiatt <martianhiatus@riseup.net> | 2024-10-13 17:01:32 +0200 |
---|---|---|
committer | marty hiatt <martianhiatus@riseup.net> | 2024-10-13 17:02:42 +0200 |
commit | 11fc4f01c4934e5d687382f3ccb301cb8343a6d9 (patch) | |
tree | c1f579eb6a4eab80197ba3b929041ec1022e7e05 /lisp | |
parent | 353afcad0f2a6802719eb987be6de861de3e2e8e (diff) |
re-do display of card (link) author. #596
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/mastodon-tl.el | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 3f06756..c4abbf0 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -886,6 +886,7 @@ links in the text. If TOOT is nil no parsing occurs." (car region) (cdr region) (get-text-property (car region) 'shr-url)) (when (proper-list-p toot) ;; not on profile fields cons cells + ;; render card author maybe: (let* ((card (alist-get 'card toot)) (card-url (alist-get 'url card)) (authors (alist-get 'authors card)) @@ -894,7 +895,7 @@ links in the text. If TOOT is nil no parsing occurs." (when (and (string= url-no-query card-url) ;; only if we have an account's data: (alist-get 'account (car authors))) - (goto-char (point-max)) ;;(cdr region)) + (goto-char (point-max)) (mastodon-tl--insert-card-authors authors))))))) (buffer-string)))) @@ -903,17 +904,30 @@ links in the text. If TOOT is nil no parsing occurs." (insert (concat "\n(Authors: " - (cl-loop for x in authors - concat - (mastodon-tl--format-card-author x)) + (mapconcat #'mastodon-tl--format-card-author authors "\n") ")\n"))) (defun mastodon-tl--format-card-author (data) "Render card author DATA." ;; FIXME: update as needed, data contains "name" "url" and "account" - (let-alist data - (when .account - (mastodon-search--propertize-user .account)))) + (when (alist-get 'account data) ;.account + (let-alist (alist-get 'account data) ;.account + ;; FIXME: replace with refactored handle render fun + ;; in byline refactor branch: + (concat + (propertize .username + 'face 'mastodon-display-name-face + 'byline t + 'item-type 'user + 'item-id .id) + " " + (propertize (concat "@" .acct) + 'face 'mastodon-handle-face + 'mouse-face 'highlight + 'mastodon-tab-stop 'user-handle + 'keymap mastodon-tl--link-keymap + 'mastodon-handle (concat "@" .acct) + 'help-echo (concat "Browse user profile of @" .acct)))))) (defun mastodon-tl--process-link (toot start end url) "Process link URL in TOOT as hashtag, userhandle, or normal link. |