Skip to content

Commit 98ab051

Browse files
fix: importing journals with tags
Fixes logseq/db-test#588
1 parent 4bca113 commit 98ab051

3 files changed

Lines changed: 11 additions & 7 deletions

File tree

deps/graph-parser/src/logseq/graph_parser/extract.cljc

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,14 @@
143143
(assoc :block/alias aliases')
144144

145145
(:tags properties)
146-
(assoc :block/tags (let [tags (:tags properties)
147-
tags (if (coll? tags) tags [(str tags)])
148-
tags (remove string/blank? tags)]
149-
(map (fn [tag] {:block/name (common-util/page-name-sanity-lc tag)
150-
:block/title tag})
151-
tags))))]
146+
(assoc :block/tags (concat
147+
(:block/tags page-m)
148+
(let [tags (:tags properties)
149+
tags (if (coll? tags) tags [(str tags)])
150+
tags (remove string/blank? tags)]
151+
(map (fn [tag] {:block/name (common-util/page-name-sanity-lc tag)
152+
:block/title tag})
153+
tags)))))]
152154
(update result :block/properties #(apply dissoc % gp-property/editable-linkable-built-in-properties))))
153155

154156
(defn- build-page-map

deps/graph-parser/test/logseq/graph_parser/exporter_test.cljs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@
231231
#_(map #(select-keys % [:block/title :block/tags]))
232232
count))
233233
"Correct number of pages with block content")
234-
(is (= 14 (->> @conn
234+
(is (= 15 (->> @conn
235235
(d/q '[:find [?ident ...]
236236
:where [?b :block/tags :logseq.class/Tag] [?b :db/ident ?ident] (not [?b :logseq.property/built-in?])])
237237
count))
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
tags:: #diary
2+
- This journal has a tag to test journals with tags
13
- Block tags #p1
24
tags:: ai, #block-tag

0 commit comments

Comments
 (0)