Skip to content

Commit

Permalink
feat: journal file names add custom format support
Browse files Browse the repository at this point in the history
Add `:journal/file-name-format "yyyy_MM_dd"` to the `config.edn`.
  • Loading branch information
tiensonqin committed Nov 19, 2020
1 parent e54ea35 commit e22ba14
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/frontend/date.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
5 changes: 5 additions & 0 deletions src/main/frontend/state.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e22ba14

Please sign in to comment.