Prechádzať zdrojové kódy

fix: replace tags with page-refs ignores case

fixes LOG-3073
Gabriel Horner 1 rok pred
rodič
commit
82639cb07a

+ 9 - 7
deps/db/src/logseq/db/frontend/content.cljs

@@ -87,15 +87,17 @@
    (string/trim)))
 
 (defn replace-tags-with-page-refs
-  "Replace tags in content with page-ref ids"
+  "Replace tags in content with page-ref ids. Ignore case because tags in
+  content can have any case and still have a valid ref"
   [content tags]
   (reduce
    (fn [content tag]
-     (string/replace content
-                     (str "#" (:block/original-name tag))
-                     (str page-ref/left-brackets
-                          page-ref-special-chars
-                          (:block/uuid tag)
-                          page-ref/right-brackets)))
+     (common-util/replace-ignore-case
+      content
+      (str "#" (:block/original-name tag))
+      (str page-ref/left-brackets
+           page-ref-special-chars
+           (:block/uuid tag)
+           page-ref/right-brackets)))
    content
    (sort-by :block/original-name > tags)))