Truncate long titles
This commit is contained in:
parent
2a8171b9bb
commit
f79529e0ea
2 changed files with 4 additions and 2 deletions
|
@ -37,6 +37,8 @@
|
||||||
|
|
||||||
(defn insert [v i e] (vec (concat (subvec v 0 i) [e] (subvec v i))))
|
(defn insert [v i e] (vec (concat (subvec v 0 i) [e] (subvec v i))))
|
||||||
|
|
||||||
|
(defn truncate [s n] (subs s 0 (min (count s) n)))
|
||||||
|
|
||||||
(defn masto-header->html [html account created_at url]
|
(defn masto-header->html [html account created_at url]
|
||||||
(let [{:keys [username display_name avatar_static]} account
|
(let [{:keys [username display_name avatar_static]} account
|
||||||
date (t/parse created_at)]
|
date (t/parse created_at)]
|
||||||
|
@ -88,7 +90,7 @@
|
||||||
(insert-link-prev)
|
(insert-link-prev)
|
||||||
(cm/replace-all-matching-values-by-new-value "LINK_PREVIEW_URL" url)
|
(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_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_TITLE" (str (truncate title 47) "..."))
|
||||||
(cm/replace-all-matching-values-by-new-value "LINK_PREVIEW_DESC" description)))))
|
(cm/replace-all-matching-values-by-new-value "LINK_PREVIEW_DESC" description)))))
|
||||||
|
|
||||||
(defn masto-footer->html [html replies_count reblogs_count favourites_count]
|
(defn masto-footer->html [html replies_count reblogs_count favourites_count]
|
||||||
|
|
|
@ -288,7 +288,7 @@
|
||||||
[:img {:class "mastodon-post-link-image", :src "https://cdn.masto.host/socialmeissagmbhde/cache/preview_cards/images/000/545/643/original/199336f5aa5b9683.png"}]
|
[:img {:class "mastodon-post-link-image", :src "https://cdn.masto.host/socialmeissagmbhde/cache/preview_cards/images/000/545/643/original/199336f5aa5b9683.png"}]
|
||||||
[:div
|
[:div
|
||||||
{:class "mastodon-post-link-info"}
|
{:class "mastodon-post-link-info"}
|
||||||
[:h4 {:class "mastodon-post-link-title"} "forgejo/tests/integration/api_activitypub_repository_test.go at fe3473fc8b7b51e024b1a564fc7f01e385ebfb5e"]
|
[:h4 {:class "mastodon-post-link-title"} "forgejo/tests/integration/api_activitypub_repos..."]
|
||||||
[:div {:class "mastodon-post-link-description"} "forgejo - Beyond coding. We forge."]
|
[:div {:class "mastodon-post-link-description"} "forgejo - Beyond coding. We forge."]
|
||||||
[:div {:class "mastodon-post-link-url"} "https://codeberg.org//forgejo/forgejo/src/commit/fe3473fc8b7b51e024b1a564fc7f01e385ebfb5e/tests/integration/api_activitypub_repository_test.go"]]]
|
[:div {:class "mastodon-post-link-url"} "https://codeberg.org//forgejo/forgejo/src/commit/fe3473fc8b7b51e024b1a564fc7f01e385ebfb5e/tests/integration/api_activitypub_repository_test.go"]]]
|
||||||
[:footer
|
[:footer
|
||||||
|
|
Loading…
Reference in a new issue