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

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

[elpa] externals/denote b3cd0a7d4c 02/17: Add denote--file-types


From: ELPA Syncer
Subject: [elpa] externals/denote b3cd0a7d4c 02/17: Add denote--file-types
Date: Mon, 15 Aug 2022 01:57:34 -0400 (EDT)

branch: externals/denote
commit b3cd0a7d4c22f0f9b3c5efcfb0e51e02d18d8c76
Author: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Commit: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>

    Add denote--file-types
---
 denote.el | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)

diff --git a/denote.el b/denote.el
index f881f29303..b013a13860 100644
--- a/denote.el
+++ b/denote.el
@@ -638,6 +638,68 @@ identifier: %s
   "Extract keywords list from front matter KEYWORDS-STRING."
   (split-string keywords-string "[:,\s]+" t "[][ \"']+"))
 
+(defvar denote--file-types
+  `((markdown-toml . (".md"
+                      ,denote--toml-front-matter
+                      "^title\\s-*="
+                      denote--surround-with-quotes
+                      denote--trim-whitespace-then-quotes
+                      "^tags\\s-*="
+                      denote--format-keywords-for-md-front-matter
+                      denote--extract-keywords-from-front-matter))
+    (markdown-yaml . (".md"
+                      ,denote--yaml-front-matter
+                      "^title\\s-*:"
+                      denote--surround-with-quotes
+                      denote--trim-whitespace-then-quotes
+                      "^tags\\s-*:"
+                      denote--format-keywords-for-md-front-matter
+                      denote--extract-keywords-from-front-matter))
+    (text . (".txt"
+             ,denote--yaml-front-matter
+             "^title\\s-*:"
+             identity
+             denote--trim-whitespace
+             "^tags\\s-*:"
+             denote--format-keywords-for-text-front-matter
+             denote--extract-keywords-from-front-matter))
+    (org . (".org"
+            ,denote--org-front-matter
+            "^#\\+title\\s-*:"
+            identity
+            denote--trim-whitespace
+            "^#\\+tags\\s-*:"
+            denote--format-keywords-for-text-front-matter
+            denote--extract-keywords-from-front-matter)))
+  "Alist for Denote's file types.
+Each element is of the form (TYPE-SYMB . TYPE-INFO).
+
+TYPE-INFO is a list of 8 elements:
+
+  extension: The file extension, as a string.
+
+  front-matter: The type's front matter, as a string.
+
+  title-key-regexp: The regexp used to retrieve the title line in
+    a file. The first line matching this regexp is considered the
+    title line.
+
+  title-value-function: The function used to format the raw title
+    string for inclusion in the front matter.
+
+  title-value-reverse-function: The function used to retrieve the raw title
+    string from the string in the front matter.
+
+  keywords-key-regexp: The regexp used to retrieve the keywords
+    line in a file. The first line matching this regexp is
+    considered the keywords line.
+
+  keywords-value-function: The function used to format the
+    keywords list for inclusion in the front matter.
+
+  keywords-value-reverse-function: The function used to retrieve
+    the keywords list from the string in the front matter.")
+
 (defun denote--file-extension (file-type)
   "Return file type extension based on FILE-TYPE."
   (pcase file-type



reply via email to

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