Assoc without conj
Otherwise the vector is wrapped into a list
This commit is contained in:
parent
644717d272
commit
19e602bf9c
1 changed files with 10 additions and 1 deletions
|
@ -89,6 +89,15 @@
|
||||||
(assoc-in item [:content] (conj content insertion-element)))
|
(assoc-in item [:content] (conj content insertion-element)))
|
||||||
item)))
|
item)))
|
||||||
|
|
||||||
|
(defn assoc-to-content [item class insertion-element]
|
||||||
|
(let [condition (every? true? [(map? item)
|
||||||
|
(= (:type item) :element)
|
||||||
|
(= class (:class (:attrs item)))])]
|
||||||
|
(if condition
|
||||||
|
(let [content (:content item)]
|
||||||
|
(assoc-in item [:content] insertion-element))
|
||||||
|
item)))
|
||||||
|
|
||||||
(defn masto-media->html [html media_attachments]
|
(defn masto-media->html [html media_attachments]
|
||||||
(if-let [preview-image-url (get-in media_attachments [0 :preview_url])]
|
(if-let [preview-image-url (get-in media_attachments [0 :preview_url])]
|
||||||
(let [class-name "mastodon-post-content"
|
(let [class-name "mastodon-post-content"
|
||||||
|
@ -100,7 +109,7 @@
|
||||||
;; Eventuell das Gleiche auch für masto->media->html
|
;; Eventuell das Gleiche auch für masto->media->html
|
||||||
(defn insert-link-prev [html]
|
(defn insert-link-prev [html]
|
||||||
(let [class-name "mastodon-post-link-preview"]
|
(let [class-name "mastodon-post-link-preview"]
|
||||||
(postwalk #(insert-into-class % class-name link_preview) html)))
|
(postwalk #(assoc-to-content % class-name link_preview) html)))
|
||||||
|
|
||||||
(defn masto-link-prev->html [html card]
|
(defn masto-link-prev->html [html card]
|
||||||
(let [{:keys [url image title description]} card]
|
(let [{:keys [url image title description]} card]
|
||||||
|
|
Loading…
Reference in a new issue