emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/denote 7366004e91 106/355: Fix markdown-toml front matt


From: ELPA Syncer
Subject: [elpa] externals/denote 7366004e91 106/355: Fix markdown-toml front matter format
Date: Sun, 26 Jun 2022 23:58:08 -0400 (EDT)

branch: externals/denote
commit 7366004e91462c5ed46b9a1c0109bcd42ac09fe3
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@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"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]