[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.
- [elpa] externals/denote a809e9ea1d 087/355: Clarify active development; things might break, (continued)
- [elpa] externals/denote a809e9ea1d 087/355: Clarify active development; things might break, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 3f9bfcb74e 101/355: Name the FSF as the copyright holder, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 299b8970ee 095/355: Add support for notes in Markdown and Plain Text, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 112a12e6e5 130/355: Remove duplicate word from face names, ELPA Syncer, 2022/06/27
- [elpa] externals/denote bca23b3e3d 115/355: Clarify how front matter variables are used, ELPA Syncer, 2022/06/27
- [elpa] externals/denote f91d2472c3 128/355: Make the field delimiter face a bit more subtle, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 8a35382067 126/355: Rename internal variable for clarity, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 308322afab 108/355: Fix markdown-toml identifier value, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 11be1d6b40 123/355: Change "tml" to "toml" in denote-toml-front-matter, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 6000313eec 118/355: Enforce sluggification of keywords; document it, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 82eeb381dc 110/355: Make all front matter abstractions consistent,
ELPA Syncer <=
- [elpa] externals/denote 73dc07ac00 113/355: Make front matter variables "public", ELPA Syncer, 2022/06/27
- [elpa] externals/denote 21e415e2e7 111/355: Remove obsolete symbol of command, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 60d64ca07c 117/355: Document ways to change the front matter, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 28518416f3 131/355: Name the faces in the manual, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 0bda79ef19 139/355: Move heading further up in the manual, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 890a335092 149/355: Add denote-dired-rename-expert user option, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 5977a9bc7b 164/355: Add warning about likely changes to denote-link.el, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 3f768cc438 168/355: Remove commented-out 'require', ELPA Syncer, 2022/06/27
- [elpa] externals/denote d6285c8c5a 182/355: Omit current file from backlinks, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 02507c6f0d 171/355: Rename private variable, ELPA Syncer, 2022/06/27