mirror of
https://github.com/logseq/logseq.git
synced 2026-05-05 19:36:35 +00:00
fix: add more file graph concepts to db linter
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
[logseq.db.sqlite.util :as sqlite-util]
|
||||
[datascript.core :as d]
|
||||
[logseq.common.config :as common-config]
|
||||
[logseq.common.util :as common-util]
|
||||
[logseq.db.frontend.content :as db-content]
|
||||
[frontend.worker.handler.page.db-based.page :as db-worker-page]
|
||||
[frontend.worker.handler.page.file-based.page :as file-worker-page]))
|
||||
@@ -14,7 +15,8 @@
|
||||
[conn config title {:keys [uuid]}]
|
||||
(assert (uuid? uuid) (str "rtc-create-page! `uuid` is not a uuid " uuid))
|
||||
(let [date-formatter (common-config/get-date-formatter config)
|
||||
[title page-name] (db-worker-page/get-title-and-pagename title)
|
||||
title (db-worker-page/sanitize-title title)
|
||||
page-name (common-util/page-name-sanity-lc title)
|
||||
page (-> (gp-block/page-name->map title @conn true date-formatter
|
||||
{:page-uuid uuid
|
||||
:skip-existing-page-check? true})
|
||||
|
||||
@@ -42,15 +42,14 @@
|
||||
(db-property-build/build-properties-with-ref-values property-vals-tx-m)))))))
|
||||
|
||||
;; TODO: Revisit title cleanup as this was copied from file implementation
|
||||
(defn get-title-and-pagename
|
||||
(defn sanitize-title
|
||||
[title]
|
||||
(let [title (-> (string/trim title)
|
||||
(text/page-ref-un-brackets!)
|
||||
;; remove `#` from tags
|
||||
(string/replace #"^#+" ""))
|
||||
title (common-util/remove-boundary-slashes title)
|
||||
page-name (common-util/page-name-sanity-lc title)]
|
||||
[title page-name]))
|
||||
title (common-util/remove-boundary-slashes title)]
|
||||
title))
|
||||
|
||||
(defn build-first-block-tx
|
||||
[page-uuid format]
|
||||
@@ -64,7 +63,7 @@
|
||||
:block/format format})]))
|
||||
|
||||
(defn create!
|
||||
[conn title
|
||||
[conn title*
|
||||
{:keys [create-first-block? properties uuid persist-op? whiteboard? class? today-journal?]
|
||||
:or {create-first-block? true
|
||||
properties nil
|
||||
@@ -72,7 +71,7 @@
|
||||
persist-op? true}
|
||||
:as options}]
|
||||
(let [date-formatter (:logseq.property.journal/title-format (d/entity @conn :logseq.class/Journal))
|
||||
[title page-name] (get-title-and-pagename title)
|
||||
title (sanitize-title title*)
|
||||
type (cond class?
|
||||
"class"
|
||||
whiteboard?
|
||||
@@ -104,5 +103,5 @@
|
||||
:outliner-op :create-page}
|
||||
today-journal?
|
||||
(assoc :create-today-journal? true
|
||||
:today-journal-name page-name))))
|
||||
[page-name page-uuid]))))
|
||||
:today-journal-name title))))
|
||||
[title page-uuid]))))
|
||||
|
||||
Reference in New Issue
Block a user