mirror of https://github.com/logseq/logseq
parent
f652e8e342
commit
478d459231
|
@ -91,10 +91,6 @@
|
|||
(util/format "![%s](%s)" label link)
|
||||
(util/format "[%s](%s)" label link))))
|
||||
|
||||
(defn org-link
|
||||
[label link]
|
||||
(util/format "[[%s][%s]]" label link))
|
||||
|
||||
(defn local-link [item]
|
||||
(let [type (-> item :library :type)
|
||||
id (-> item :library :id)
|
||||
|
@ -156,30 +152,27 @@
|
|||
|
||||
(defmethod extract "attachment"
|
||||
[item]
|
||||
(let [{:keys [title url link-mode path content-type filename]} (-> item :data)
|
||||
link-func (if (= :org (state/get-preferred-format))
|
||||
org-link
|
||||
markdown-link)]
|
||||
(let [{:keys [title url link-mode path content-type filename]} (-> item :data)]
|
||||
(case link-mode
|
||||
"imported_file"
|
||||
(str
|
||||
(link-func title (local-link item))
|
||||
(markdown-link title (local-link item))
|
||||
" "
|
||||
(zotero-imported-file-macro (item-key item) filename))
|
||||
"linked_file"
|
||||
(if (str/starts-with? path "attachments:")
|
||||
(str
|
||||
(link-func title (local-link item))
|
||||
(markdown-link title (local-link item))
|
||||
" "
|
||||
(zotero-linked-file-macro path))
|
||||
(let [path (str/replace path " " "%20")]
|
||||
(if (= content-type "application/pdf")
|
||||
(markdown-link title (str "file://" path) true)
|
||||
(link-func title (str "file://" path)))))
|
||||
(markdown-link title (str "file://" path)))))
|
||||
"imported_url"
|
||||
(link-func title url)
|
||||
(markdown-link title url)
|
||||
"linked_url"
|
||||
(link-func title url))))
|
||||
(markdown-link title url))))
|
||||
|
||||
(defmethod extract :default
|
||||
[item]
|
||||
|
|
Loading…
Reference in New Issue