refactor: consistent alias of clojure.string

This commit is contained in:
rcmerci
2025-01-03 16:45:10 +08:00
parent dd17560fd5
commit b65a2d5c0f
15 changed files with 409 additions and 410 deletions

View File

@@ -1,6 +1,6 @@
(ns ^:no-doc frontend.external.roam-export
(:require [clojure.set :as s]
[clojure.string :as str]
[clojure.string :as string]
[clojure.walk :as walk]
[frontend.db.async :as db-async]
[frontend.state :as state]
@@ -18,7 +18,7 @@
(defn nano-id []
(->> (repeatedly 9 nano-id-char)
(str/join)))
(string/join)))
(defn <uuid->uid-map []
(let [repo (state/get-current-repo)]
@@ -36,13 +36,13 @@
(defn update-content [content uuid->uid-map]
(when content ; page block doesn't have content
(let [uuids (keys uuid->uid-map)]
(reduce
(fn [acc uuid]
(if (str/includes? acc (str uuid))
(str/replace acc (str uuid) (get uuid->uid-map uuid))
acc))
content
uuids))))
(reduce
(fn [acc uuid]
(if (string/includes? acc (str uuid))
(string/replace acc (str uuid) (get uuid->uid-map uuid))
acc))
content
uuids))))
(defn update-uid [{:block/keys [uuid title] :as b}
uuid->uid-map]
@@ -50,7 +50,7 @@
(contains? uuid->uid-map uuid)
(assoc :block/uid (get uuid->uid-map uuid))
(some (fn [id] (str/includes? (str title) (str id))) (keys uuid->uid-map))
(some (fn [id] (string/includes? (str title) (str id))) (keys uuid->uid-map))
(update :block/title #(update-content % uuid->uid-map))))
(defn update-todo [{:block/keys [title] :as block}]
@@ -58,10 +58,10 @@
(update block :block/title
(fn [c]
(-> c
(str/replace todo-marker-regex "{{[[TODO]]}}")
(str/replace done-marker-regex "{{[[DONE]]}}")
(str/replace "{{embed " "{{embed: ")
(str/trim))))
(string/replace todo-marker-regex "{{[[TODO]]}}")
(string/replace done-marker-regex "{{[[DONE]]}}")
(string/replace "{{embed " "{{embed: ")
(string/trim))))
block))
(defn traverse