(feat): fix citation links not showing up in graph (#547)

This change adds a `type` column to the refs column, and strips the prefix before storing the key in the `refs` table.
This commit is contained in:
Göktuğ Karakaşlı
2020-05-04 15:44:15 +03:00
committed by GitHub
parent 7df50c14ec
commit 11d239d661
7 changed files with 105 additions and 43 deletions

View File

@@ -114,14 +114,11 @@ When non-nil, the window will not be closed when deleting other windows."
(defun org-roam-buffer--insert-citelinks ()
"Insert citation backlinks for the current buffer."
(if-let* ((roam-key (with-temp-buffer
(insert-buffer-substring org-roam-buffer--current)
(org-roam--extract-ref)))
(if-let* ((ref (with-temp-buffer
(insert-buffer-substring org-roam-buffer--current)
(org-roam--extract-ref)))
(org-ref-p (require 'org-ref nil t)) ; Ensure that org-ref is present
(cite-prefixes (-map (lambda (type)
(concat type ":")) org-ref-cite-types))
(key-backlinks (org-roam--get-backlinks
(s-chop-prefixes cite-prefixes roam-key)))
(key-backlinks (org-roam--get-backlinks (cdr ref)))
(grouped-backlinks (--group-by (nth 0 it) key-backlinks)))
(progn
(insert (let ((l (length key-backlinks)))
@@ -196,6 +193,7 @@ When non-nil, the window will not be closed when deleting other windows."
(run-hooks 'org-roam-buffer-prepare-hook)
(read-only-mode 1)))))
(cl-defun org-roam-buffer--update-maybe (&key redisplay)
"Reconstructs `org-roam-buffer'.
This needs to be quick or infrequent, because this is run at