mirror of
https://github.com/org-roam/org-roam
synced 2025-08-01 12:17:21 -05:00
(fix)capture: Process fn capture templates before whitespace-content (#2157)
* [Fix #2156] Expand fn templates in fill-template before whitespace-content * Update change log and adding tests related to #2157
This commit is contained in:
@ -8,6 +8,7 @@
|
||||
### Fixed
|
||||
- [#2130](https://github.com/org-roam/org-roam/pull/2130) buffer: unlinked-references section now also searches within symlinked directories
|
||||
- [#2152](https://github.com/org-roam/org-roam/pull/2152) org-roam-preview-default-function: doesn't copy copy content of next heading node when current node's content is empty
|
||||
- [#2156](https://github.com/org-roam/org-roam/pull/2157) capture: templates with functions are handled correctly to avoid signaling `char-or-string-p`
|
||||
|
||||
### Changed
|
||||
|
||||
|
@ -762,7 +762,10 @@ This function is to be called in the Org-capture finalization process."
|
||||
It expands ${var} occurrences in TEMPLATE, and then runs
|
||||
org-capture's template expansion.
|
||||
When ENSURE-NEWLINE, always ensure there's a newline behind."
|
||||
(let ((template-whitespace-content (org-roam-whitespace-content template)))
|
||||
(let* ((template (if (functionp template)
|
||||
(funcall template)
|
||||
template))
|
||||
(template-whitespace-content (org-roam-whitespace-content template)))
|
||||
(setq template
|
||||
(org-roam-format-template
|
||||
template
|
||||
|
@ -46,6 +46,11 @@
|
||||
:to-equal "foo\n\n")
|
||||
(expect
|
||||
(org-roam-capture--fill-template "foo\n\t\n")
|
||||
:to-equal "foo\n\t\n")))
|
||||
:to-equal "foo\n\t\n"))
|
||||
|
||||
(it "expands templates when it's a function"
|
||||
(expect
|
||||
(org-roam-capture--fill-template (lambda () "foo"))
|
||||
:to-equal "foo")))
|
||||
|
||||
(provide 'test-org-roam-capture)
|
||||
|
Reference in New Issue
Block a user