Browse Source

fix: #2021/09/22 , create files named .md

close #2887
Tienson Qin 3 years ago
parent
commit
8af6a3d368
2 changed files with 8 additions and 1 deletions
  1. 7 0
      src/main/frontend/date.cljs
  2. 1 1
      src/main/frontend/modules/file/core.cljs

+ 7 - 0
src/main/frontend/date.cljs

@@ -231,6 +231,13 @@
                     default-journal-title-formatter)]
     (journal-title-> journal-title #(tf/unparse formatter %))))
 
+(defn date->file-name
+  [date]
+  (let [formatter (if-let [format (state/get-journal-file-name-format)]
+                    (tf/formatter format)
+                    default-journal-title-formatter)]
+    (tf/unparse formatter date)))
+
 (defn journal-title->custom-format
   [journal-title]
   (journal-title-> journal-title format))

+ 1 - 1
src/main/frontend/modules/file/core.cljs

@@ -125,7 +125,7 @@
                     (config/get-pages-directory))
                   "/"
                   (if journal-page?
-                    (date/journal-title->default title)
+                    (date/date->file-name journal-page?)
                     (-> (or (:block/original-name page) (:block/name page))
                         (util/file-name-sanity))) "."
                   (if (= format "markdown") "md" format))