fix: block refs

This commit is contained in:
Tienson Qin
2021-03-22 12:55:33 +08:00
parent 89aff1abc0
commit 279f319bca
2 changed files with 77 additions and 69 deletions

View File

@@ -339,11 +339,19 @@
[path-refs (conj parents block)]))
path-ref-pages (->> path-refs
(concat (:block/refs block))
(map (fn [ref]
(cond
(map? ref)
(:block/name ref)
:else
ref)))
(remove string/blank?)
(map string/lower-case)
(distinct)
(map (fn [p]
{:block/name p})))]
(map (fn [ref]
(if (string? ref)
{:block/name (string/lower-case ref)}
ref)))
(distinct))]
(recur (rest blocks)
(conj acc (assoc block :block/path-refs path-ref-pages))
parents)))))