Function: org-roam-capture--convert-template

org-roam-capture--convert-template is a byte-compiled function defined in org-roam-capture.el.

Signature

(org-roam-capture--convert-template TEMPLATE &optional PROPS)

Documentation

Convert TEMPLATE from Org-roam syntax to org-capture-templates syntax.

PROPS is a plist containing additional Org-roam specific properties to be added to the template.

Source Code

;; Defined in ~/.emacs.d/elpa/org-roam-20260224.1637/org-roam-capture.el
(defun org-roam-capture--convert-template (template &optional props)
  "Convert TEMPLATE from Org-roam syntax to `org-capture-templates' syntax.
PROPS is a plist containing additional Org-roam specific
properties to be added to the template."
  (pcase template
    (`(,_key ,_desc)
     template)
    ((or `(,key ,desc ,type ignore ,body . ,rest)
         `(,key ,desc ,type (function ignore) ,body . ,rest)
         `(,key ,desc ,type ,body . ,rest))
     (setq rest (append rest props))
     (let (org-roam-plist options)
       (while rest
         (let* ((key (pop rest))
                (val (pop rest))
                (custom (member key org-roam-capture--template-keywords)))
           (when (and custom
                      (not val))
             (user-error "Invalid capture template format: %s\nkey %s cannot be nil" template key))
           (if custom
               (setq org-roam-plist (plist-put org-roam-plist key val))
             (setq options (plist-put options key val)))))
       (append `(,key ,desc ,type #'org-roam-capture--prepare-buffer ,body)
               options
               (list :org-roam org-roam-plist))))
    (_
     (signal 'invalid-template template))))