mirror of
https://github.com/org-roam/org-roam
synced 2025-09-22 16:20:54 -05:00
(feat): allow org-roam-node-display-template to be a closure (#1891)
This commit is contained in:
@@ -60,9 +60,13 @@ field. If it's not specified, the field will be inserted as is,
|
||||
i.e. it won't be aligned nor trimmed. If it's an integer, the
|
||||
field will be aligned accordingly and all the exceeding
|
||||
characters will be trimmed out. If it's \"*\", the field will use
|
||||
as many characters as possible and will be aligned accordingly."
|
||||
as many characters as possible and will be aligned accordingly.
|
||||
|
||||
A closure can also be assigned to this variable in which case the
|
||||
closure is evaluated and the return value is used as the
|
||||
template. The closure must evaluate to a valid template string."
|
||||
:group 'org-roam
|
||||
:type 'string)
|
||||
:type '(string function))
|
||||
|
||||
(defcustom org-roam-node-annotation-function #'org-roam-node-read--annotation
|
||||
"This function used to attach annotations for `org-roam-node-read'.
|
||||
|
@@ -129,7 +129,9 @@ value (possibly nil). Adapted from `s-format'."
|
||||
(funcall replacer var default-val))))
|
||||
(if v (format "%s" v) (signal 'org-roam-format-resolve md)))
|
||||
(set-match-data replacer-match-data))))
|
||||
template
|
||||
(if (functionp template)
|
||||
(funcall template)
|
||||
template)
|
||||
;; Need literal to make sure it works
|
||||
t t)
|
||||
(set-match-data saved-match-data))))
|
||||
|
Reference in New Issue
Block a user