Quellcode durchsuchen

fix: ignore parsing for :file-path

Tienson Qin vor 3 Jahren
Ursprung
Commit
78d1b17743

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

@@ -174,8 +174,13 @@
                                            k)
                                        v (if (coll? v)
                                            (remove string/blank? v)
-                                           (if (string/blank? v)
+                                           (cond
+                                             (string/blank? v)
                                              nil
+                                             (and (= (keyword k) :file-path)
+                                                  (string/starts-with? v "file:"))
+                                             v
+                                             :else
                                              (text/parse-property format k v user-config)))
                                        k (keyword k)
                                        v (if (and

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

@@ -153,7 +153,9 @@
             properties (let [properties (and (gp-property/properties-ast? first-block)
                                              (->> (last first-block)
                                                   (map (fn [[x y]]
-                                                         [x (if (string? y)
+                                                         [x (if (and (string? y)
+                                                                     (not (and (= (keyword x) :file-path)
+                                                                               (string/starts-with? y "file:"))))
                                                               (text/parse-property format x y user-config)
                                                               y)]))
                                                   (into {})

+ 2 - 1
deps/graph-parser/test/logseq/graph_parser/block_test.cljs

@@ -21,7 +21,8 @@
     [["foo" "[[bar]], [[nested [[baz]]]]"]] {:foo #{"bar" "nested [[baz]]"}}
     [["foo" "[[bar]], [[nested [[baz]]]]"]] {:foo #{"bar" "nested [[baz]]"}}
     [["foo" "bar, [[baz, test]]"]] {:foo #{"bar" "baz, test"}}
-    [["foo" "bar, [[baz, test, [[nested]]]]"]] {:foo #{"bar" "baz, test, [[nested]]"}})
+    [["foo" "bar, [[baz, test, [[nested]]]]"]] {:foo #{"bar" "baz, test, [[nested]]"}}
+    [["file-path" "file:///home/x, y.pdf"]] {:file-path "file:///home/x, y.pdf"})
 
   (are [x y] (= (vec (:page-refs (gp-block/extract-properties :markdown x {}))) y)
     [["year" "1000"]] []

+ 4 - 1
src/main/frontend/components/block.cljs

@@ -1795,6 +1795,9 @@
        (int? v)
        v
 
+       (= k :file-path)
+       v
+
        date
        date
 
@@ -3264,4 +3267,4 @@
               {})])))]
 
      :else
-     (blocks-container blocks config))])
+     (blocks-container blocks config))])