|
|
@@ -149,6 +149,17 @@
|
|
|
properties)
|
|
|
[]))
|
|
|
|
|
|
+(defn- extract-refs-from-property-value
|
|
|
+ [value format]
|
|
|
+ (cond
|
|
|
+ (coll? value)
|
|
|
+ (filter (fn [v] (and (string? v) (not (string/blank? v)))) value)
|
|
|
+ (string? value)
|
|
|
+ (let [ast (gp-mldoc/inline->edn value (gp-mldoc/default-config format))]
|
|
|
+ (text/extract-refs-from-mldoc-ast ast))
|
|
|
+ :else
|
|
|
+ nil))
|
|
|
+
|
|
|
(defn- get-page-ref-names-from-properties
|
|
|
[properties user-config]
|
|
|
(let [page-refs (->>
|
|
|
@@ -162,8 +173,9 @@
|
|
|
(keyword k))))
|
|
|
;; get links ast
|
|
|
(map last)
|
|
|
- (mapcat (or (:extract-refs-from-property-value-fn user-config)
|
|
|
- text/extract-refs-from-mldoc-ast))
|
|
|
+ (mapcat (fn [value]
|
|
|
+ (let [f (or (:extract-refs-from-property-value-fn user-config) extract-refs-from-property-value)]
|
|
|
+ (f value (get user-config :format :markdown)))))
|
|
|
;; comma separated collections
|
|
|
(concat (->> (map second properties)
|
|
|
(filter coll?)
|
|
|
@@ -513,11 +525,7 @@
|
|
|
id (get-custom-id-or-new-id {:properties properties})
|
|
|
property-refs (->> (get-page-refs-from-properties
|
|
|
properties db date-formatter
|
|
|
- (assoc user-config
|
|
|
- :extract-refs-from-property-value-fn
|
|
|
- (fn [refs]
|
|
|
- (when (coll? refs)
|
|
|
- refs))))
|
|
|
+ user-config)
|
|
|
(map :block/original-name))
|
|
|
pre-block? (if (:heading properties) false true)
|
|
|
block {:block/uuid id
|