mirror of https://github.com/logseq/logseq
fix: nested page properties extracting
parent
20626ef670
commit
43101c3c43
|
@ -93,10 +93,13 @@
|
|||
(or (util/safe-re-find page-ref-re s)
|
||||
(util/safe-re-find #"[\,|,|#]+" s)))
|
||||
(let [result (->> (string/split s page-ref-re-2)
|
||||
(map (fn [s] (if (string/ends-with? (string/trimr s) "]],")
|
||||
(let [s (string/trimr s)]
|
||||
(subs s 0 (dec (count s))))
|
||||
s)))
|
||||
(mapcat (fn [s] (if (string/includes? (string/trimr s) "]],")
|
||||
(let [idx (string/index-of s "]],")]
|
||||
[(subs s 0 idx)
|
||||
"]]"
|
||||
(subs s (+ idx 3))])
|
||||
[s])))
|
||||
(remove #(= % ""))
|
||||
(mapcat (fn [s] (if (string/ends-with? s "]]")
|
||||
[(subs s 0 (- (count s) 2))
|
||||
"]]"]
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
[["year" "\"1000\""]] []
|
||||
[["foo" "[[bar]] test"]] ["bar" "test"]
|
||||
[["foo" "[[bar]] test [[baz]]"]] ["bar" "test" "baz"]
|
||||
[["foo" "[[bar]] test [[baz]] [[nested [[baz]]]]"]] ["bar" "test" "baz" "nested [[baz]]"]))
|
||||
[["foo" "[[bar]] test [[baz]] [[nested [[baz]]]]"]] ["bar" "test" "baz" "nested [[baz]]"]
|
||||
[["foo" "#bar, #baz"]] ["bar" "baz"]
|
||||
[["foo" "[[nested [[page]]]], test"]] ["nested [[page]]" "test"]))
|
||||
|
||||
#_(run-tests)
|
||||
|
|
Loading…
Reference in New Issue