feat: journal file names add custom format support

Add `:journal/file-name-format "yyyy_MM_dd"` to the `config.edn`.
pull/706/head
Tienson Qin 2020-11-19 12:17:17 +08:00
parent e54ea35131
commit e22ba14e64
2 changed files with 9 additions and 1 deletions

View File

@ -182,7 +182,10 @@
(defn journal-title->default
[journal-title]
(journal-title-> journal-title #(tf/unparse default-journal-title-formatter %)))
(let [formatter (if-let [format (state/get-journal-file-name-format)]
(tf/formatter format)
default-journal-title-formatter)]
(journal-title-> journal-title #(tf/unparse formatter %))))
(defn journal-title->custom-format
[journal-title]

View File

@ -190,6 +190,11 @@
[repo]
(:org-mode/insert-file-link? (get-config repo)))
(defn get-journal-file-name-format
[]
(when-let [repo (get-current-repo)]
(:journal/file-name-format (get-config repo))))
(defn get-preferred-workflow
[]
(keyword