Do not check type in denote-format-string-for-{org/md}-front-matter

This commit is contained in:
Jean-Philippe Gagné Guay 2024-10-25 23:37:57 -04:00
parent b69736209c
commit acad7c3577
2 changed files with 4 additions and 11 deletions

View file

@ -1464,12 +1464,9 @@ Change the front matter format'.")
(defun denote-format-string-for-md-front-matter (s)
"Surround string S with quotes.
If S is not a string, return a literal emptry string.
This can be used in `denote-file-types' to format front mattter."
(if (stringp s)
(format "%S" s)
"\"\""))
(format "%S" s))
(defun denote-trim-whitespace (s)
"Trim whitespace around string S.
@ -1487,9 +1484,8 @@ This can be used in `denote-file-types' to format front mattter."
(denote--trim-quotes (denote-trim-whitespace s)))
(defun denote-format-string-for-org-front-matter (s)
"Return string S as-is for Org or plain text front matter.
If S is not a string, return an empty string."
(if (stringp s) s ""))
"Return string S as-is for Org or plain text front matter."
s)
(defun denote-format-keywords-for-md-front-matter (keywords)
"Format front matter KEYWORDS for markdown file type.

View file

@ -173,10 +173,7 @@ Extend what we do in `denote-test--denote-file-type-extensions'."
(ert-deftest denote-test--denote-surround-with-quotes ()
"Test that `denote-surround-with-quotes' returns a string in quotes."
(should (and (equal (denote-surround-with-quotes "test") "\"test\"")
(equal (denote-surround-with-quotes "") "\"\"")
(equal (denote-surround-with-quotes nil) "\"\"")
(equal (denote-surround-with-quotes 'wrong) "\"\"")
(equal (denote-surround-with-quotes '(wrong)) "\"\""))))
(equal (denote-surround-with-quotes "") "\"\""))))
(ert-deftest denote-test--denote--format-front-matter ()
"Test that `denote--format-front-matter' formats front matter correctly."