feat: remove the manually title prop check in filename conversion

This commit is contained in:
Junyi Du
2022-11-07 10:52:47 +08:00
committed by Tienson Qin
parent edacd9743b
commit ff72d0dcaa

View File

@@ -58,6 +58,8 @@
;; - 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]
@@ -74,14 +76,12 @@
;; and it includes reserved characters, format config change / file renaming is required.
;; It's about user's own data management decision and should be handled
;; by user manually.
;; Don't rename page that with a custom setup `title` property
(when (not (is-manual-title-prop? old-format file-body prop-title))
;; the 'expected' title of the user when updating from the previous format, or title will be broken in new format
(or (when (and (nil? prop-title)
(not= old-format new-format))
(calc-previous-name old-format new-format file-body))
;; the 'expected' title of the user when updating from the previous format, or title will be broken in new format
(or (when (and (nil? prop-title)
(not= old-format new-format))
(calc-previous-name old-format new-format file-body))
;; if no break-change conversion triggered, check if file name is in an informal / outdated style.
(calc-current-name new-format file-body prop-title))))
(calc-current-name new-format file-body prop-title)))
(defn calc-rename-target
"Return the renaming status and new file body to recover the original title of the file in previous version.