Revert "fix(zotero): attachment links in orgmode"

This reverts commit 177c8aa4ff.
pull/2679/head
Weihua Lu 2021-08-19 16:30:00 +08:00
parent f652e8e342
commit 478d459231
1 changed files with 6 additions and 13 deletions

View File

@ -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]