fix: block id property lost

Close #1727
This commit is contained in:
Tienson Qin
2021-05-05 11:47:51 +08:00
parent aa029dfe0d
commit b756980a80
7 changed files with 218 additions and 215 deletions

View File

@@ -178,36 +178,38 @@
(remove string/blank?))
properties (->> properties
(medley/map-kv (fn [k v]
(let [k (name k)
v (string/trim v)
k (string/replace k " " "-")
k (string/replace k "_" "-")
k (string/lower-case k)
v (cond
(= v "true")
true
(= v "false")
false
(if (coll? v)
[(keyword k) v]
(let [k (name k)
v (string/trim v)
k (string/replace k " " "-")
k (string/replace k "_" "-")
k (string/lower-case k)
v (cond
(= v "true")
true
(= v "false")
false
(re-find #"^\d+$" v)
(util/safe-parse-int v)
(re-find #"^\d+$" v)
(util/safe-parse-int v)
(and (= "\"" (first v) (last v))) ; wrapped in ""
(string/trim (subs v 1 (dec (count v))))
(and (= "\"" (first v) (last v))) ; wrapped in ""
(string/trim (subs v 1 (dec (count v))))
(contains? @non-parsing-properties (string/lower-case k))
v
(contains? @non-parsing-properties (string/lower-case k))
v
:else
(let [v' v
;; built-in collections
comma? (contains? #{"tags" "alias"} k)]
(if (and k v'
(contains? config/markers k)
(util/safe-parse-int v'))
(util/safe-parse-int v')
(text/split-page-refs-without-brackets v' comma?))))]
[(keyword k) v]))))]
:else
(let [v' v
;; built-in collections
comma? (contains? #{"tags" "alias"} k)]
(if (and k v'
(contains? config/markers k)
(util/safe-parse-int v'))
(util/safe-parse-int v')
(text/split-page-refs-without-brackets v' comma?))))]
[(keyword k) v])))))]
{:properties properties
:page-refs page-refs}))