mirror of
https://github.com/logseq/logseq.git
synced 2026-04-24 22:25:01 +00:00
fix: importing namespaced tags with spaces
Fixes https://github.com/logseq/db-test/issues/210. Also fix invalid EDN class db-ident related to this
This commit is contained in:
2
deps/db/src/logseq/db/frontend/db_ident.cljc
vendored
2
deps/db/src/logseq/db/frontend/db_ident.cljc
vendored
@@ -68,7 +68,7 @@
|
||||
:cljs (exists? js/process)
|
||||
:default false)
|
||||
;; So that we don't have to change :user.{property|class} in our tests
|
||||
(keyword user-namespace (-> name-string (string/replace "/" "-") (string/replace-first #"^\d" "NUM-")))
|
||||
(keyword user-namespace (-> name-string (string/replace #"/|\s+" "-") (string/replace-first #"^(\d)" "NUM-$1")))
|
||||
(keyword user-namespace
|
||||
(str
|
||||
(->> (filter #(re-find #"[0-9a-zA-Z-]{1}" %) (seq name-string)) (apply str))
|
||||
|
||||
@@ -50,11 +50,13 @@
|
||||
:block/name (common-util/page-name-sanity-lc new-title)})))
|
||||
|
||||
(defn- get-page-uuid [page-names-to-uuids page-name ex-data']
|
||||
(or (get @page-names-to-uuids (if (string/includes? (str page-name) "#")
|
||||
(string/lower-case (gp-block/sanitize-hashtag-name page-name))
|
||||
page-name))
|
||||
(or (get @page-names-to-uuids (some-> (if (string/includes? (str page-name) "#")
|
||||
(string/lower-case (gp-block/sanitize-hashtag-name page-name))
|
||||
page-name)
|
||||
string/trimr))
|
||||
(throw (ex-info (str "No uuid found for page name " (pr-str page-name))
|
||||
(merge ex-data' {:page-name page-name})))))
|
||||
(merge ex-data' {:page-name page-name
|
||||
:page-names (sort (keys @page-names-to-uuids))})))))
|
||||
|
||||
(defn- replace-namespace-with-parent [block page-names-to-uuids]
|
||||
(if (:block/namespace block)
|
||||
|
||||
@@ -197,7 +197,7 @@
|
||||
#_(map #(select-keys % [:block/title :block/tags]))
|
||||
count))
|
||||
"Correct number of pages with block content")
|
||||
(is (= 12 (->> @conn
|
||||
(is (= 13 (->> @conn
|
||||
(d/q '[:find [?ident ...]
|
||||
:where [?b :block/tags :logseq.class/Tag] [?b :db/ident ?ident] (not [?b :logseq.property/built-in?])])
|
||||
count))
|
||||
@@ -270,7 +270,7 @@
|
||||
(is (= {:user.property/prop-bool true
|
||||
:user.property/prop-num 5
|
||||
:user.property/prop-string "yeehaw"
|
||||
:block/tags [:logseq.class/Page]}
|
||||
:block/tags [:logseq.class/Page :user.class/Some---Namespace]}
|
||||
(readable-properties @conn (db-test/find-page-by-title @conn "some page")))
|
||||
"Existing page has correct properties")
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
prop-string:: yeehaw
|
||||
prop-num:: 5
|
||||
prop-bool:: true
|
||||
tags:: [[Some / Namespace ]]
|
||||
|
||||
- has some content
|
||||
|
||||
Reference in New Issue
Block a user