Commit 320d6e09 authored by Erik Hetzner's avatar Erik Hetzner

Add support for old style links

parent 5bbffbbe
......@@ -60,8 +60,8 @@ prefix argument (C-u C-u) to `org-zotxt-insert-reference-link'"
(defun org-zotxt-extract-link-id-from-path (path)
"Return the zotxt ID from a link PATH."
(if (string-match "^//select/items/\\(.*\\)$" path)
(match-string 1 path)
(if (string-match "^\\(zotero:\\)?//select/items/\\(.*\\)$" path)
(match-string 2 path)
(defun org-zotxt-insert-reference-link-to-item (item)
......@@ -116,6 +116,13 @@
(goto-char (point-min))
(should (equal (org-zotxt-extract-link-id-at-point) "0_ZBZQ4KMP"))))
(ert-deftest org-zotxt-extract-link-id-from-path ()
(let ((link-id "0_ZBZQ4KMP"))
(should (equal link-id
(org-zotxt-extract-link-id-from-path "zotero://select/items/0_ZBZQ4KMP")))
(should (equal link-id
(org-zotxt-extract-link-id-from-path "//select/items/0_ZBZQ4KMP")))))
(ert-deftest org-zotxt-test-update-reference-link-at-point ()
(let ((org-zotxt-link-description-style :citation)
(start-text "[[zotero://select/items/0_ZBZQ4KMP][foo]]")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment