mirror of
https://github.com/correl/org-roam-export-backlinks.git
synced 2024-12-25 03:00:15 +00:00
Add backlink lookups
This commit is contained in:
parent
5663580322
commit
4ca2a56b7c
2 changed files with 20 additions and 1 deletions
|
@ -9,7 +9,7 @@
|
|||
;; Version: 0.0.1
|
||||
;; Keywords: abbrev bib c calendar comm convenience data docs emulations extensions faces files frames games hardware help hypermedia i18n internal languages lisp local maint mail matching mouse multimedia news outlines processes terminals tex tools unix vc wp
|
||||
;; Homepage: https://github.com/correlr/org-roam-export
|
||||
;; Package-Requires: ((emacs "24.3") org-roam)
|
||||
;; Package-Requires: ((emacs "24.3") org-roam s seq)
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
|
@ -20,6 +20,19 @@
|
|||
;;; Code:
|
||||
|
||||
(require 'org-roam)
|
||||
(require 's)
|
||||
(require 'seq)
|
||||
|
||||
(defun org-roam-export-backlink-title (backlink)
|
||||
"Get exportable title of BACKLINK."
|
||||
(s-join " > "
|
||||
(seq-concatenate 'list
|
||||
(list (org-roam-node-title (org-roam-backlink-source-node backlink)))
|
||||
(plist-get (org-roam-backlink-properties backlink) :outline))))
|
||||
|
||||
(defun org-roam-export-backlink-link (backlink)
|
||||
"Get Org link to BACKLINK."
|
||||
(concat "id:" (org-roam-node-id (org-roam-backlink-source-node backlink))))
|
||||
|
||||
(provide 'org-roam-export)
|
||||
;;; org-roam-export.el ends here
|
||||
|
|
6
tests.el
6
tests.el
|
@ -13,14 +13,20 @@
|
|||
(require 'ert)
|
||||
(require 'org-roam)
|
||||
(require 'org-roam-export)
|
||||
(require 'seq)
|
||||
|
||||
(setq org-roam-directory (expand-file-name "./test-slipbox")
|
||||
org-roam-db-location (expand-file-name "org-roam.db"))
|
||||
(org-roam-update-org-id-locations)
|
||||
(org-roam-db-sync)
|
||||
|
||||
|
||||
(ert-deftest simple-test ()
|
||||
(should (= 1 1)))
|
||||
|
||||
(ert-deftest lorem-backlink-titles ()
|
||||
(should (equal '("Ipsum > II")
|
||||
(seq-map #'org-roam-export-backlink-title (org-roam-backlinks-get (org-roam-node-from-id "d12a1ce4-3199-42f4-b39b-b68c03458669") :unique t)))))
|
||||
|
||||
(provide 'tests)
|
||||
;;; tests.el ends here
|
||||
|
|
Loading…
Reference in a new issue