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

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

[elpa] externals/denote 82eeb381dc 110/355: Make all front matter abstra


From: ELPA Syncer
Subject: [elpa] externals/denote 82eeb381dc 110/355: Make all front matter abstractions consistent
Date: Sun, 26 Jun 2022 23:58:10 -0400 (EDT)

branch: externals/denote
commit 82eeb381dc46edeb08ea55d667972fba45fecda0
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Make all front matter abstractions consistent
---
 README.org |  8 ++++----
 denote.el  | 54 ++++++++++++++++++++++++++++++------------------------
 2 files changed, 34 insertions(+), 28 deletions(-)

diff --git a/README.org b/README.org
index e537bf1e53..7e497b6320 100644
--- a/README.org
+++ b/README.org
@@ -249,7 +249,7 @@ This is how it looks for Org mode (~denote-file-type~ is 
nil):
 #+title:      This is a sample note
 #+date:       2022-06-10
 #+filetags:   denote  testing
-#+identifier: 20220610T134640
+#+identifier: 20220610T202537
 #+end_example
 
 For Markdown with YAML, it looks like this (~denote-file-type~ has the
@@ -257,10 +257,10 @@ For Markdown with YAML, it looks like this 
(~denote-file-type~ has the
 
 #+begin_example
 ---
-title:      This is a sample note
+title:      "This is a sample note"
 date:       2022-06-10
 tags:       denote  testing
-identifier: 20220610T134718
+identifier: "20220610T202021"
 ---
 #+end_example
 
@@ -283,7 +283,7 @@ And for plain text, we have the following 
(~denote-file-type~ has the
 title:      This is a sample note
 date:       2022-06-10
 tags:       denote  testing
-identifier: 20220610T134829
+identifier: 20220610T202232
 ---------------------------
 #+end_example
 
diff --git a/denote.el b/denote.el
index 7d9d1b56a7..2f0ff596aa 100644
--- a/denote.el
+++ b/denote.el
@@ -361,7 +361,7 @@ treatment)."
       ('toml (format "[%S]" (downcase keywords)))
       (_ (downcase keywords))))))
 
-(defvar denote--tml-front-matter-format
+(defvar denote--tml-front-matter
   "+++
 title      = %S
 date       = %s
@@ -370,6 +370,31 @@ identifier = %S
 +++\n\n"
   "TOML front matter value for `format'.")
 
+(defvar denote--yaml-front-matter
+  "---
+title:      %S
+date:       %s
+tags:       %s
+identifier: %S
+---\n\n"
+  "YAML front matter value for `format'.")
+
+(defvar denote--text-front-matter
+  "title:      %s
+date:       %s
+tags:       %s
+identifier: %s
+%s\n\n"
+  "Plain text front matter value for `format'.")
+
+(defvar denote--org-front-matter
+  "#+title:      %s
+#+date:       %s
+#+filetags:   %s
+#+identifier: %s
+\n"
+  "Org front matter value for `format'.")
+
 (defun denote--file-meta-header (title date keywords id)
   "Front matter for new notes.
 
@@ -378,29 +403,10 @@ 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
-       (format denote--tml-front-matter-format title date kw-toml id))
-
-      ('markdown-yaml (concat "---" "\n"
-                              "title:      " title    "\n"
-                              "date:       " date     "\n"
-                              "tags:       " kw-space "\n"
-                              "identifier: " id       "\n"
-                              "---"                   "\n"
-                              "\n"))
-
-      ('text (concat "title:      " title    "\n"
-                     "date:       " date     "\n"
-                     "tags:       " kw-space "\n"
-                     "identifier: " id       "\n"
-                     (make-string 27 ?-)     "\n"
-                     "\n"))
-
-      (_ (concat "#+title:      " title    "\n"
-                 "#+date:       " date     "\n"
-                 "#+filetags:   " kw-space "\n"
-                 "#+identifier: " id       "\n"
-                 "\n")))))
+      ('markdown-toml (format denote--tml-front-matter title date kw-toml id))
+      ('markdown-yaml (format denote--yaml-front-matter title date kw-space 
id))
+      ('text (format denote--text-front-matter title date kw-space id 
(make-string 27 ?-)))
+      (_ (format denote--org-front-matter title date kw-space id)))))
 
 (defun denote--path (title keywords)
   "Return path to new file with TITLE and KEYWORDS.



reply via email to

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