Add url to acc names
This commit is contained in:
parent
52c4574a3b
commit
a2265d6b42
2 changed files with 17 additions and 6 deletions
|
@ -50,13 +50,14 @@
|
|||
(mastocard->html card)]]]))
|
||||
statuses)])
|
||||
|
||||
(defn masto-header->html [html account created_at]
|
||||
(defn masto-header->html [html account created_at url]
|
||||
(let [{:keys [username display_name avatar_static]} account
|
||||
date (t/parse created_at)]
|
||||
(-> html
|
||||
(cm/replace-all-matching-values-by-new-value "AVATAR_URL" avatar_static)
|
||||
(cm/replace-all-matching-values-by-new-value "POST_URL" url)
|
||||
(cm/replace-all-matching-values-by-new-value "DISPLAY_NAME" display_name)
|
||||
(cm/replace-all-matching-values-by-new-value "ACCOUNT_NAME" username)
|
||||
(cm/replace-all-matching-values-by-new-value "ACCOUNT_NAME" (str "@" username))
|
||||
(cm/replace-all-matching-values-by-new-value "DATETIME" created_at)
|
||||
(cm/replace-all-matching-values-by-new-value "TIME" (t/unparse (t/formatter "EEEE, dd MMMM yyyy") date))
|
||||
)))
|
||||
|
@ -70,6 +71,15 @@
|
|||
(-> html
|
||||
(cm/replace-all-matching-values-by-new-value "POST_IMG_URL" media))))
|
||||
|
||||
(defn masto-link-prev->html [html card]
|
||||
(let [{:keys [url image title description]} card]
|
||||
(-> html
|
||||
(cm/replace-all-matching-values-by-new-value "LINK_PREVIEW_URL" url)
|
||||
(cm/replace-all-matching-values-by-new-value "LINK_PREVIEW_IMG_URL" image)
|
||||
(cm/replace-all-matching-values-by-new-value "LINK_PREVIEW_TITLE" title)
|
||||
(cm/replace-all-matching-values-by-new-value "LINK_PREVIEW_DESC" description)
|
||||
)))
|
||||
|
||||
(defn masto-footer->html [html replies_count reblogs_count favourites_count]
|
||||
(-> html
|
||||
(cm/replace-all-matching-values-by-new-value "REPLIES_COUNT" replies_count)
|
||||
|
@ -79,11 +89,12 @@
|
|||
(defn masto->html2 [statuses]
|
||||
(let [html (b/index-html-hiccup)]
|
||||
(map (fn [status]
|
||||
(let [{:keys [account created_at content media_attachments replies_count reblogs_count favourites_count]} status]
|
||||
(let [{:keys [account created_at content media_attachments replies_count reblogs_count favourites_count card url]} status]
|
||||
(-> html
|
||||
(masto-header->html account created_at)
|
||||
(masto-header->html account created_at url)
|
||||
(masto-content->html content)
|
||||
(masto-media->html media_attachments)
|
||||
(masto-link-prev->html card)
|
||||
(masto-footer->html replies_count reblogs_count favourites_count))))
|
||||
statuses)))
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
<header class="mastodon-post-header">
|
||||
<img class="mastodon-post-avatar" src="AVATAR_URL"></img>
|
||||
<div class="mastodon-post-names">
|
||||
<a class="display-name">DISPLAY_NAME</a>
|
||||
<a class="account-name">ACCOUNT_NAME</a>
|
||||
<a class="display-name" href="POST_URL">DISPLAY_NAME</a>
|
||||
<a class="account-name" href="POST_URL">ACCOUNT_NAME</a>
|
||||
</div>
|
||||
<time class="mastodon-post-date" datetime="DATETIME">TIME</time>
|
||||
</header>
|
||||
|
|
Loading…
Reference in a new issue