mirror of https://github.com/logseq/logseq
refactor: remove unnecessary codes
parent
42b291bad9
commit
538b0d8ad6
|
@ -55,8 +55,6 @@
|
||||||
|
|
||||||
(and
|
(and
|
||||||
(= typ "Search")
|
(= typ "Search")
|
||||||
(string? (second (:url (second block))))
|
|
||||||
(text/page-ref? (second (:url (second block))))
|
|
||||||
(text/page-ref-un-brackets! (second (:url (second block)))))
|
(text/page-ref-un-brackets! (second (:url (second block)))))
|
||||||
|
|
||||||
(and
|
(and
|
||||||
|
@ -88,35 +86,17 @@
|
||||||
(= "Macro" (first block)))
|
(= "Macro" (first block)))
|
||||||
(let [{:keys [name arguments]} (second block)]
|
(let [{:keys [name arguments]} (second block)]
|
||||||
(let [argument (string/join ", " arguments)]
|
(let [argument (string/join ", " arguments)]
|
||||||
(when (and (= name "embed")
|
(when (= name "embed")
|
||||||
(string? argument)
|
|
||||||
(text/page-ref? argument))
|
|
||||||
(text/page-ref-un-brackets! argument))))
|
(text/page-ref-un-brackets! argument))))
|
||||||
|
|
||||||
(and (vector? block)
|
(and (vector? block)
|
||||||
(= "Tag" (first block)))
|
(= "Tag" (first block)))
|
||||||
(let [text (get-tag block)]
|
(let [text (get-tag block)]
|
||||||
(when (and
|
(text/page-ref-un-brackets! text))
|
||||||
(string? text)
|
|
||||||
(text/page-ref? text))
|
|
||||||
(text/page-ref-un-brackets! text)))
|
|
||||||
|
|
||||||
:else
|
:else
|
||||||
nil)]
|
nil)]
|
||||||
(cond
|
(text/block-ref-un-brackets! page)))
|
||||||
(and
|
|
||||||
(string? page)
|
|
||||||
(not (string/blank? page))
|
|
||||||
(text/block-ref? page))
|
|
||||||
(text/block-ref-un-brackets! page)
|
|
||||||
|
|
||||||
(and
|
|
||||||
(string? page)
|
|
||||||
(not (string/blank? page)))
|
|
||||||
(string/trim page)
|
|
||||||
|
|
||||||
:else
|
|
||||||
nil)))
|
|
||||||
|
|
||||||
(defn get-block-reference
|
(defn get-block-reference
|
||||||
[block]
|
[block]
|
||||||
|
@ -146,8 +126,7 @@
|
||||||
(if (= "id" (:protocol (second (:url (second block)))))
|
(if (= "id" (:protocol (second (:url (second block)))))
|
||||||
(:link (second (:url (second block))))
|
(:link (second (:url (second block))))
|
||||||
(let [id (second (:url (second block)))]
|
(let [id (second (:url (second block)))]
|
||||||
(when (text/block-ref? id)
|
(text/block-ref-un-brackets! id)))
|
||||||
(text/block-ref-un-brackets! id))))
|
|
||||||
|
|
||||||
:else
|
:else
|
||||||
nil)]
|
nil)]
|
||||||
|
|
Loading…
Reference in New Issue