Fix: roam_refs now go in PROPERTIES at top of node
This commit is contained in:
@@ -29,10 +29,19 @@
|
|||||||
:heading heading
|
:heading heading
|
||||||
:url url-line)))
|
:url url-line)))
|
||||||
|
|
||||||
|
(defun my/journelly-add-properties (url journelly-heading)
|
||||||
|
"Add ROAM_REFS and JOURNELLY_TITLE to the current node's property drawer."
|
||||||
|
(org-with-point-at 1
|
||||||
|
(when url
|
||||||
|
(org-roam-property-add "ROAM_REFS" url))
|
||||||
|
(when journelly-heading
|
||||||
|
(org-roam-property-add "JOURNELLY_TITLE" journelly-heading))))
|
||||||
|
|
||||||
|
|
||||||
(defun journelly-convert-entry-to-org-roam ()
|
(defun journelly-convert-entry-to-org-roam ()
|
||||||
"Interactive function to convert journelly entry to org-roam.
|
"Interactive function to convert journelly entry to org-roam.
|
||||||
Opens the capture buffer for review before finalizing."
|
Opens the capture buffer, adds url as ROAM_REFS
|
||||||
|
and then lets you review before finalizing."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let* ((entry-text (if (use-region-p)
|
(let* ((entry-text (if (use-region-p)
|
||||||
(buffer-substring-no-properties (region-beginning) (region-end))
|
(buffer-substring-no-properties (region-beginning) (region-end))
|
||||||
@@ -41,23 +50,20 @@ Opens the capture buffer for review before finalizing."
|
|||||||
(title (journelly-entry-title parsed))
|
(title (journelly-entry-title parsed))
|
||||||
(content (journelly-entry-content parsed))
|
(content (journelly-entry-content parsed))
|
||||||
(heading (journelly-entry-heading parsed))
|
(heading (journelly-entry-heading parsed))
|
||||||
(url (journelly-entry-url parsed)))
|
(url (journelly-entry-url parsed))
|
||||||
;; Build the initial content without ID (org-roam will add it)
|
(body (concat (or content "") "\n")))
|
||||||
(let ((initial-content
|
(org-roam-capture-
|
||||||
(concat
|
:node (org-roam-node-create :title title)
|
||||||
(or content "") "\n")))
|
:props (list :immediate-finish nil
|
||||||
(org-roam-capture-
|
:jump-to-captured t)
|
||||||
:node (org-roam-node-create :title title)
|
:templates `(("d" "default" plain
|
||||||
:props (list :immediate-finish nil
|
,body
|
||||||
:jump-to-captured t)
|
:target (file+head "%<%Y%m%d%H%M%S>-${slug}.org"
|
||||||
:templates `(("d" "default" plain
|
"#+title: ${title}\n")
|
||||||
,initial-content
|
:unnarrowed t)))
|
||||||
:target (file+head "%<%Y%m%d%H%M%S>-${slug}.org"
|
(my/journelly-add-properties url heading)))
|
||||||
,(concat "\n"
|
|
||||||
(when url (concat "#+roam_refs: " url "\n"))
|
|
||||||
(when heading (concat "#+journelly_heading: " heading "\n"))
|
|
||||||
"\n#+title: ${title}\n" ))
|
|
||||||
:unnarrowed t))))))
|
|
||||||
(ert-deftest test-journelly-parse-basic ()
|
(ert-deftest test-journelly-parse-basic ()
|
||||||
(let* ((entry " * [2025-10-08 Wed 22:39] @ -
|
(let* ((entry " * [2025-10-08 Wed 22:39] @ -
|
||||||
Paul is #XP
|
Paul is #XP
|
||||||
|
|||||||
Reference in New Issue
Block a user