mirror of
https://github.com/logseq/logseq.git
synced 2026-04-24 22:25:01 +00:00
Merge branch 'feat/db' into enhance/code-type-block
This commit is contained in:
@@ -29,13 +29,13 @@ and handles unexpected failure."
|
||||
:db-graph-mode? (config/db-based-graph? repo)})]
|
||||
(if (config/db-based-graph? repo)
|
||||
(map (fn [block]
|
||||
(cond-> (dissoc block :block/properties :block/macros :block/properties-order)
|
||||
(:block/properties block)
|
||||
(merge (update-keys (:block/properties block)
|
||||
(fn [k]
|
||||
(or ({:heading :logseq.property/heading} k)
|
||||
(throw (ex-info (str "Don't know how to save graph-parser property " (pr-str k)) {}))))))))
|
||||
blocks)
|
||||
(cond-> (dissoc block :block/properties :block/macros :block/properties-order)
|
||||
(:block/properties block)
|
||||
(merge (update-keys (:block/properties block)
|
||||
(fn [k]
|
||||
(or ({:heading :logseq.property/heading} k)
|
||||
(throw (ex-info (str "Don't know how to save graph-parser property " (pr-str k)) {}))))))))
|
||||
blocks)
|
||||
blocks))
|
||||
(catch :default e
|
||||
(log/error :exception e)
|
||||
@@ -78,7 +78,12 @@ and handles unexpected failure."
|
||||
format (or format :markdown)
|
||||
parse-config (mldoc/get-default-config format)
|
||||
ast (format/to-edn title format parse-config)
|
||||
blocks (extract-blocks ast title format {:parse-block block})
|
||||
;; Disable extraction for display-type blocks as there isn't a reason to have
|
||||
;; it enabled yet and can cause visible bugs when '#' is used
|
||||
blocks (if (and (config/db-based-graph? (state/get-current-repo))
|
||||
(:logseq.property.node/display-type block))
|
||||
[block]
|
||||
(extract-blocks ast title format {:parse-block block}))
|
||||
new-block (first blocks)
|
||||
block (cond->
|
||||
(merge block new-block)
|
||||
@@ -126,13 +131,13 @@ and handles unexpected failure."
|
||||
(if (= typ "Paragraph")
|
||||
(let [indexed-paras (map-indexed vector paras)]
|
||||
[typ (->> (filter
|
||||
#(let [[index value] %]
|
||||
(not (and (> index 0)
|
||||
(= value ["Break_Line"])
|
||||
(contains? #{"Timestamp" "Macro"}
|
||||
(first (nth paras (dec index)))))))
|
||||
indexed-paras)
|
||||
(map #(last %)))])
|
||||
#(let [[index value] %]
|
||||
(not (and (> index 0)
|
||||
(= value ["Break_Line"])
|
||||
(contains? #{"Timestamp" "Macro"}
|
||||
(first (nth paras (dec index)))))))
|
||||
indexed-paras)
|
||||
(map #(last %)))])
|
||||
ast)))
|
||||
|
||||
(defn trim-break-lines!
|
||||
|
||||
Reference in New Issue
Block a user