diff --git a/src/dhyan/connections/wallabag.clj b/src/dhyan/connections/wallabag.clj index d006868..d7fe65d 100644 --- a/src/dhyan/connections/wallabag.clj +++ b/src/dhyan/connections/wallabag.clj @@ -46,17 +46,24 @@ "&detail=" detail)] link))) +(defn flatten-tags + [entry] + (let [tags (get entry :tags) + labels (mapv #(get % :label) tags)] + (assoc entry :tags labels))) + (defn select-useful-keys "Given a list of *entries* filter out all the garbage keys" [entries] (let [useful-keys [:tags :title :url :annotations :id]] - (mapv #(select-keys % useful-keys) entries))) + (->> (mapv #(select-keys % useful-keys) entries) + (mapv #(flatten-tags %))))) (defn flatten-annotation [annotations] - (-> (mapv #(flatten (seq %)) annotations) - (flatten) - (->> (filter #(not (keyword? %)))) + (-> (mapv #(flatten (seq %)) annotations) ; flatten the nested maps into nested lists + (flatten) ; flatten the nested lists into one big list + (->> (filter #(not (keyword? %)))) ; we only want strings (vec))) (defn select-useful-annotation-keys