fix: Can't rename pages with nested titles

close #3245
This commit is contained in:
Tienson Qin
2021-11-24 10:35:36 +08:00
parent 12f0d41f93
commit 03cfc60a7e
2 changed files with 25 additions and 11 deletions

View File

@@ -718,6 +718,22 @@
(assoc :block/warning :multiple-blocks))]
(if uuid (assoc block :block/uuid uuid) block)))))
(defn parse-title-and-body
[format pre-block? content]
(def content content)
(let [ast (format/to-edn content format nil)
content (if pre-block? content
(str (config/get-block-pattern format) " " (string/triml content)))
content (property/remove-properties format content)
ast (->> (format/to-edn content format nil)
(map first))
title (when (heading-block? (first ast))
(:title (second (first ast))))]
(cond->
{:block/body (vec (if title (rest ast) ast))}
title
(assoc :block/title title))))
(defn macro-subs
[macro-content arguments]
(loop [s macro-content