feat: initial support for namespace pages

This commit is contained in:
Tienson Qin
2021-03-15 23:07:07 +08:00
parent 387cdac3e9
commit 3fcc8bf69c
2 changed files with 6 additions and 2 deletions

View File

@@ -241,8 +241,11 @@
(swap! ref-pages conj tag)))
form)
(concat title body))
(let [ref-pages (remove string/blank? @ref-pages)]
(assoc block :ref-pages (vec ref-pages)))))
(let [ref-pages (remove string/blank? @ref-pages)
children-pages (->> (mapcat (fn [p] (if (string/includes? p "/") (string/split p #"/"))) ref-pages)
(remove string/blank?))
ref-pages (distinct (concat ref-pages children-pages))]
(assoc block :ref-pages ref-pages))))
(defn with-block-refs
[{:keys [title body] :as block}]