Function: denote--format-front-matter
denote--format-front-matter is a byte-compiled function defined in
denote.el.
Signature
(denote--format-front-matter TITLE DATE KEYWORDS IDENTIFIER SIGNATURE FILETYPE)
Documentation
Front matter for new notes.
TITLE, SIGNATURE, and IDENTIFIER are strings. DATE is a date object. KEYWORDS
is a list of strings. FILETYPE is one of the values of variable
denote-file-type(var)/denote-file-type(fun).
Source Code
;; Defined in ~/.emacs.d/elpa/denote-4.2.3/denote.el
(defun denote--format-front-matter (title date keywords identifier signature filetype)
"Front matter for new notes.
TITLE, SIGNATURE, and IDENTIFIER are strings. DATE is a date object. KEYWORDS
is a list of strings. FILETYPE is one of the values of variable
`denote-file-type'."
(let* ((fm (denote--front-matter filetype))
(title-value-function (denote--title-value-function filetype))
(keywords-value-function (denote--keywords-value-function filetype))
(identifier-value-function (denote--identifier-value-function filetype))
(signature-value-function (denote--signature-value-function filetype))
(title-string (if title-value-function (funcall title-value-function title) ""))
(date-string (denote--format-front-matter-date date filetype))
(keywords-string (if keywords-value-function (funcall keywords-value-function (denote-sluggify-keywords-and-apply-rules keywords)) ""))
(identifier-string (if identifier-value-function (funcall identifier-value-function identifier) ""))
(signature-string (if signature-value-function (funcall signature-value-function (denote-sluggify-and-apply-rules 'signature signature)) ""))
(new-front-matter (if fm (format fm title-string date-string keywords-string identifier-string signature-string) "")))
;; Remove lines with empty values if the corresponding component
;; is not in `denote-front-matter-components-present-even-if-empty-value'.
(with-temp-buffer
(insert new-front-matter)
(dolist (component '(title date keywords signature identifier))
(let ((value (pcase component ('title title) ('keywords keywords) ('signature signature) ('date date) ('identifier identifier)))
(component-key-regexp-function (denote--get-component-key-regexp-function component)))
(goto-char (point-min))
(when (and (not (denote--component-has-value-p component value))
(not (memq component denote-front-matter-components-present-even-if-empty-value))
(re-search-forward (funcall component-key-regexp-function filetype) nil t 1))
(goto-char (line-beginning-position))
(delete-region (line-beginning-position) (line-beginning-position 2)))))
(buffer-string))))