From 40eec17e1a4b606ea79b76dd8063666d586bd3cb Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sat, 3 Sep 2022 13:15:37 +1000 Subject: [PATCH] wallabag annotations are now a flat vector --- src/dhyan/connections/wallabag.clj | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/dhyan/connections/wallabag.clj b/src/dhyan/connections/wallabag.clj index 7abde73..22edf6a 100644 --- a/src/dhyan/connections/wallabag.clj +++ b/src/dhyan/connections/wallabag.clj @@ -52,10 +52,17 @@ (let [useful-keys [:tags :title :url :annotations :id]] (mapv #(select-keys % useful-keys) entries))) +(defn flatten-annotation + [annotations] + (-> (mapv #(flatten (seq %)) annotations) + (flatten) + (->> (filter #(not (keyword? %)))))) + (defn select-useful-annotation-keys [entry] - (let [only-useful-annotations (mapv #(select-keys % [:quote]) (get entry :annotations))] - (assoc entry :annotations only-useful-annotations))) + (let [only-useful-annotations (mapv #(select-keys % [:quote]) (get entry :annotations)) + flattened-annotations (flatten-annotation only-useful-annotations)] + (assoc entry :annotations flattened-annotations))) (defn map-useful-annotation-keys [entries]