branch: externals/denote commit 7366004e91462c5ed46b9a1c0109bcd42ac09fe3 Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Fix markdown-toml front matter format Thanks to Kaushal Modi for the feedback in issue 4 over at the GitHub mirror: <https://github.com/protesilaos/denote/issues/4>. --- denote.el | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/denote.el b/denote.el index fdd70dd457..e22d2c4395 100644 --- a/denote.el +++ b/denote.el @@ -354,13 +354,22 @@ treatment)." (cond ((and (> (length keywords) 1) (not (stringp keywords))) (pcase type - ('toml (format "[ %s ]" (denote--map-quote-downcase keywords))) + ('toml (format "[%s]" (denote--map-quote-downcase keywords))) (_ (mapconcat #'downcase keywords " ")))) (t (pcase type - ('toml (format "['%s']" (downcase keywords))) + ('toml (format "[%S]" (downcase keywords))) (_ (downcase keywords)))))) +(defvar denote--tml-front-matter-format + "+++ +title = %S +date = %s +tags = %s +identifier = %s ++++\n\n" + "TOML front matter value for `format'.") + (defun denote--file-meta-header (title date keywords id) "Front matter for new notes. @@ -369,13 +378,8 @@ TITLE, DATE, KEYWORDS, FILENAME, ID are all strings which are (let ((kw-space (denote--file-meta-keywords keywords)) (kw-toml (denote--file-meta-keywords keywords 'toml))) (pcase denote-file-type - ('markdown-toml (concat "+++" "\n" - "title: " title "\n" - "date: " date "\n" - "tags: " kw-toml "\n" - "identifier: " id "\n" - "+++" "\n" - "\n")) + ('markdown-toml + (format denote--tml-front-matter-format title date kw-toml id)) ('markdown-yaml (concat "---" "\n" "title: " title "\n"