فهرست منبع

Another test and address review feedback that shouldn't be controversial

- Added test for 71514ab36c1083ff78c49b7dbc10d196a7d302e9
- Also removed dependency that is no longer used
Gabriel Horner 3 سال پیش
والد
کامیت
edd79954c1

+ 1 - 2
deps/graph-parser/deps.edn

@@ -1,8 +1,7 @@
 {:paths ["src"]
  :deps
  ;; External deps should be kept in sync with https://github.com/logseq/nbb-logseq/blob/main/bb.edn
- {frankiesardo/linked {:mvn/version "1.3.0"}
-  com.andrewmcveigh/cljs-time {:git/url "https://github.com/logseq/cljs-time" ;; fork
+ {com.andrewmcveigh/cljs-time {:git/url "https://github.com/logseq/cljs-time" ;; fork
                                :sha     "5704fbf48d3478eedcf24d458c8964b3c2fd59a9"}
   ;; local dep
   logseq/db {:local/root "../db"}

+ 1 - 1
deps/graph-parser/src/logseq/graph_parser/extract.cljc

@@ -78,7 +78,7 @@
                                       (map (fn [tag] {:block/name (gp-util/page-name-sanity-lc tag)
                                                       :block/original-name tag})
                                         tags))))]
-    (update result :block/properties #(dissoc % :tags :alias))))
+    (update result :block/properties #(apply dissoc % gp-property/editable-linkable-built-in-properties))))
 
 (defn- build-page-map
   [properties invalid-properties file page page-name {:keys [date-formatter db from-page]}]

+ 3 - 3
deps/graph-parser/src/logseq/graph_parser/text.cljs

@@ -3,6 +3,7 @@
             [goog.string :as gstring]
             [clojure.string :as string]
             [clojure.set :as set]
+            [logseq.graph-parser.property :as gp-property]
             [logseq.graph-parser.mldoc :as gp-mldoc]
             [logseq.graph-parser.util :as gp-util]
             [logseq.graph-parser.util.page-ref :as page-ref]))
@@ -135,9 +136,8 @@
 (defn separated-by-commas?
   [config-state k]
   (let [k' (if (keyword? k) k (keyword k))]
-    (contains? (set/union #{:alias :tags}
-                          (set (get config-state :property/separated-by-commas))
-                          (set (:property/separated-by-commas config-state)))
+    (contains? (set/union gp-property/editable-linkable-built-in-properties
+                          (set (get config-state :property/separated-by-commas)))
                k')))
 
 (defn parse-property

+ 18 - 0
deps/graph-parser/test/logseq/graph_parser_test.cljs

@@ -3,6 +3,7 @@
             [clojure.string :as string]
             [logseq.graph-parser :as graph-parser]
             [logseq.db :as ldb]
+            [logseq.db.default :as default-db]
             [logseq.graph-parser.block :as gp-block]
             [logseq.graph-parser.property :as gp-property]
             [datascript.core :as d]))
@@ -235,3 +236,20 @@
                 (map first)
                 (map #(select-keys % [:block/properties :block/invalid-properties]))))
         "Has correct (in)valid page properties")))
+
+(deftest correct-page-names-created
+  (testing "from title"
+    (let [conn (ldb/start-conn)
+          built-in-pages (set (map string/lower-case default-db/built-in-pages-names))]
+      (graph-parser/parse-file conn
+                               "foo.md"
+                               "title:: core.async"
+                               {})
+      (is (= #{"core.async"}
+             (->> (d/q '[:find (pull ?b [*])
+                         :in $
+                         :where [?b :block/name]]
+                       @conn)
+                  (map (comp :block/name first))
+                  (remove built-in-pages)
+                  set))))))