Function: denote--get-front-matter-components-order
denote--get-front-matter-components-order is a byte-compiled function
defined in denote.el.
Signature
(denote--get-front-matter-components-order CONTENT FILE-TYPE)
Documentation
Return the components in the order they appear in CONTENT given FILE-TYPE.
Return a list containing the symbols title, signature, keywords,
identifier and date in the order that they appear in TEXT. TEXT can
be any string. For example, it can be a front matter template or an
entire file content.
Source Code
;; Defined in ~/.emacs.d/elpa/denote-4.2.3/denote.el
(defun denote--get-front-matter-components-order (content file-type)
"Return the components in the order they appear in CONTENT given FILE-TYPE.
Return a list containing the symbols `title', `signature', `keywords',
`identifier' and `date' in the order that they appear in TEXT. TEXT can
be any string. For example, it can be a front matter template or an
entire file content."
(let ((components-with-line-numbers '()))
(with-temp-buffer
(insert content)
(goto-char (point-min))
(when (re-search-forward (denote--title-key-regexp file-type) nil t 1)
(push `(,(line-number-at-pos) . title) components-with-line-numbers))
(goto-char (point-min))
(when (re-search-forward (denote--keywords-key-regexp file-type) nil t 1)
(push `(,(line-number-at-pos) . keywords) components-with-line-numbers))
(goto-char (point-min))
(when (re-search-forward (denote--signature-key-regexp file-type) nil t 1)
(push `(,(line-number-at-pos) . signature) components-with-line-numbers))
(goto-char (point-min))
(when (re-search-forward (denote--date-key-regexp file-type) nil t 1)
(push `(,(line-number-at-pos) . date) components-with-line-numbers))
(goto-char (point-min))
(when (re-search-forward (denote--identifier-key-regexp file-type) nil t 1)
(push `(,(line-number-at-pos) . identifier) components-with-line-numbers)))
(mapcar #'cdr
(sort components-with-line-numbers (lambda (x y) (< (car x) (car y)))))))