aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnson Denen <johnson.denen@gmail.com>2017-05-15 09:49:09 -0400
committerGitHub <noreply@github.com>2017-05-15 09:49:09 -0400
commit20db7297acbd72403a1808968f100f039b019a3d (patch)
tree89dffcb39d186cb0dc786d4fac9454dfb46f4740
parent23c233d2bb2cbc9139087b53d95cd3b23e05e336 (diff)
parent3c4c7e70a236b309f192c55e289f5fe42141f4fb (diff)
Merge pull request #123 from alexjgriffith/image-nl-placement
closed #79
-rw-r--r--lisp/mastodon-tl.el20
1 files changed, 13 insertions, 7 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 42cb252..85e0519 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -184,12 +184,17 @@ also render the html"
(defun mastodon-tl--media (toot)
"Retrieve a media attachment link for TOOT if one exists."
- (let ((media-attachements (mastodon-tl--field 'media_attachments toot)))
- (mapconcat
- (lambda (media-attachement)
- (let ((preview-url (cdr (assoc 'preview_url media-attachement))))
- (mastodon-media--get-media-link-rendering preview-url)))
- media-attachements "")))
+ (let* ((media-attachements (mastodon-tl--field 'media_attachments toot))
+ (media-string (mapconcat
+ (lambda (media-attachement)
+ (let ((preview-url
+ (cdr (assoc 'preview_url media-attachement))))
+ (mastodon-media--get-media-link-rendering
+ preview-url)))
+ media-attachements "")))
+ (if (not (equal media-string ""))
+ (concat "\n" media-string ) "")))
+
(defun mastodon-tl--content (toot)
"Retrieve text content from TOOT."
@@ -206,8 +211,9 @@ also render the html"
(insert
(concat
(mastodon-tl--spoiler toot)
- (mastodon-tl--content toot)
+ (replace-regexp-in-string "\n*$" "" (mastodon-tl--content toot))
(mastodon-tl--media toot)
+ "\n\n"
(mastodon-tl--byline toot)
"\n\n")))