[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote eb1131af24 2/7: Refactor denote--format-front-ma
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote eb1131af24 2/7: Refactor denote--format-front-matter-keywords |
Date: |
Wed, 10 Aug 2022 00:57:41 -0400 (EDT) |
branch: externals/denote
commit eb1131af2496c23cb99387c01fd4804dd81ebae5
Author: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Commit: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Refactor denote--format-front-matter-keywords
- Make type parameter mandatory
- Delete denote--format-markdown-keywords and
denote--format-org-keywords
---
denote.el | 36 +++++++++---------------------------
1 file changed, 9 insertions(+), 27 deletions(-)
diff --git a/denote.el b/denote.el
index 5f34344ae8..ee2aa68e5a 100644
--- a/denote.el
+++ b/denote.el
@@ -655,35 +655,17 @@ which include the starting dot or the return value of
(setq file-name (concat file-name "__" kws)))
(concat file-name ext)))
-(defun denote--format-markdown-keywords (keywords)
- "Quote, downcase, and comma-separate elements in KEYWORDS."
- (format "[%s]" (mapconcat (lambda (k)
- (format "%S" (downcase k)))
- keywords ", ")))
-
-(defun denote--format-org-keywords (keywords)
- "Quote, downcase, and colon-separate elements in KEYWORDS."
- (format ":%s:" (mapconcat (lambda (k)
- (downcase k))
- keywords ":")))
-
-(defun denote--format-front-matter-keywords (keywords &optional type)
- "Prepare KEYWORDS for inclusion in the file's front matter.
-Parse the output of `denote--keywords-prompt', using `downcase'
-on the keywords and separating them by two spaces. A single
-keyword is just downcased.
-
-With optional TYPE, format the keywords accordingly (this might
-be `toml' or, in the future, some other spec that needss special
-treatment)."
- (let ((kw (denote--sluggify-keywords keywords)))
+(defun denote--format-front-matter-keywords (keywords type)
+ "Format KEYWORDS according to TYPE for the file's front matter.
+Keywords are downcased."
+ (let ((kw (mapcar #'downcase (denote--sluggify-keywords keywords))))
(cond
((or (eq type 'markdown-toml) (eq type 'markdown-yaml) (eq type 'md))
- (denote--format-markdown-keywords kw))
+ (format "[%s]" (mapconcat (lambda (k) (format "%S" k)) kw ", ")))
((eq type 'text)
- (mapconcat #'downcase kw " "))
- (t
- (denote--format-org-keywords kw)))))
+ (string-join kw " "))
+ ((eq type 'org)
+ (format ":%s:" (string-join kw ":"))))))
(defun denote--front-matter-keywords-to-list (file)
"Return keywords from front matter of FILE as list of strings.
@@ -764,7 +746,7 @@ else that variable is used."
(denote--format-front-matter-keywords keywords 'text)
id denote-text-front-matter-delimiter))
(_ (format denote-org-front-matter title date
- (denote--format-front-matter-keywords keywords) id)))))
+ (denote--format-front-matter-keywords keywords 'org) id)))))
(defun denote--path (title keywords &optional dir id)
"Return path to new file with TITLE and KEYWORDS.
- [elpa] externals/denote updated (55b4a09606 -> 82424803d0), ELPA Syncer, 2022/08/10
- [elpa] externals/denote 12dc9e23ac 1/7: Rename denote--retrieve-process-grep and denote-link-button-action, ELPA Syncer, 2022/08/10
- [elpa] externals/denote 34daa52ea3 4/7: Refactor denote--dir-in-denote-directory-p, ELPA Syncer, 2022/08/10
- [elpa] externals/denote b5704da5c2 6/7: Refactor denote--file-extension and denote--path, ELPA Syncer, 2022/08/10
- [elpa] externals/denote ca6aa0d104 5/7: Make filetype parameter mandatory in denote--format-front-matter, ELPA Syncer, 2022/08/10
- [elpa] externals/denote eb1131af24 2/7: Refactor denote--format-front-matter-keywords,
ELPA Syncer <=
- [elpa] externals/denote a992c74a71 3/7: Delete denote--prompt-symbols, ELPA Syncer, 2022/08/10
- [elpa] externals/denote 82424803d0 7/7: Merge pull request #82 from jeanphilippegg/cleanup, ELPA Syncer, 2022/08/10