mirror of
https://github.com/logseq/logseq.git
synced 2026-06-01 19:01:22 +00:00
fix: filename format revert manual title check
This commit is contained in:
@@ -59,8 +59,6 @@
|
||||
;; - the special rule in `is-manual-title-prop?`
|
||||
(defonce supported-filename-formats [:triple-lowbar :legacy])
|
||||
|
||||
;; In case of recovering this check in future
|
||||
#_:clj-kondo/ignore
|
||||
(defn- is-manual-title-prop?
|
||||
"If it's an user defined title property instead of the generated one"
|
||||
[format file-body prop-title]
|
||||
@@ -104,6 +102,17 @@
|
||||
[page path old-format new-format]
|
||||
(let [prop-title (get-in page [:block/properties :title])
|
||||
file-body (gp-util/path->file-body path)
|
||||
journal? (:block/journal? page)]
|
||||
(when (not journal?)
|
||||
(calc-rename-target-impl old-format new-format file-body prop-title))))
|
||||
journal? (:block/journal? page)
|
||||
manual-prop-title? (is-manual-title-prop? old-format file-body prop-title)]
|
||||
(cond
|
||||
(and (not journal?)
|
||||
(not manual-prop-title?))
|
||||
(calc-rename-target-impl old-format new-format file-body prop-title)
|
||||
|
||||
(and (not journal?)
|
||||
manual-prop-title?
|
||||
(fs-util/include-reserved-chars? file-body))
|
||||
{:status :informal
|
||||
:target (fs-util/file-name-sanity file-body new-format)
|
||||
:old-title prop-title
|
||||
:changed-title prop-title})))
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
"aaa__bbb__cccon" "aaa/bbb/cccon" true
|
||||
"aaa.bbb.ccc" "adbcde/aks/sdf" true
|
||||
"a__.bbb.ccc" "adbcde/aks/sdf" true
|
||||
))
|
||||
"aaa__bbb__ccc" nil false))
|
||||
|
||||
(deftest rename-previous-tests
|
||||
(are [x y] (= y (#'conversion-handler/calc-previous-name :legacy :triple-lowbar x))
|
||||
|
||||
Reference in New Issue
Block a user