macro: Properly collect multiple authors

* lisp/org-macro.el (org-macro--collect-macros): Multiple lines are
allowed for AUTHOR keyword (per `org-export-options-alist') so make
sure we collect all of them.
* testing/lisp/test-org-macro.el (test-org-macro/author): Add test.

Reported-by: Vinicius Vinicius <vinicius.vin@yandex.com>
<http://lists.gnu.org/r/emacs-orgmode/2021-10/msg00727.html>
This commit is contained in:
Nicolas Goaziou 2021-10-23 14:32:00 +02:00
parent 37791bb4fc
commit 52e6f1cf57
2 changed files with 10 additions and 1 deletions

View file

@ -125,7 +125,7 @@ previous one, unless VALUE is nil. Return the updated list."
"Collect macro definitions in current buffer and setup files.
Return an alist containing all macro templates found."
(let ((templates
`(("author" . ,(org-macro--find-keyword-value "AUTHOR"))
`(("author" . ,(org-macro--find-keyword-value "AUTHOR" t))
("email" . ,(org-macro--find-keyword-value "EMAIL"))
("title" . ,(org-macro--find-keyword-value "TITLE" t))
("date" . ,(org-macro--find-date)))))

View file

@ -314,6 +314,15 @@
(org-macro-replace-all org-macro-templates)
(buffer-substring-no-properties
(line-beginning-position) (point-max)))))
;; Return AUTHOR keyword value.
(should
(equal "author 1 author 2"
(org-test-with-temp-text
"#+author: author 1\n#+author: author 2\n<point>{{{author}}}"
(org-macro-initialize-templates)
(org-macro-replace-all org-macro-templates)
(buffer-substring-no-properties
(line-beginning-position) (point-max)))))
;; When AUTHOR keyword is missing, return the empty string.
(should
(equal ""