mirror of https://github.com/logseq/logseq
fix: indexing whiteboard page files
parent
4de59c6d63
commit
fb832d2493
|
@ -67,8 +67,9 @@
|
||||||
files)
|
files)
|
||||||
support-files (sort-by :file/path support-files)
|
support-files (sort-by :file/path support-files)
|
||||||
{journals true non-journals false} (group-by (fn [file] (string/includes? (:file/path file) "journals/")) support-files)
|
{journals true non-journals false} (group-by (fn [file] (string/includes? (:file/path file) "journals/")) support-files)
|
||||||
|
{whiteboards true non-whiteboards false} (group-by (fn [file] (string/includes? (:file/path file) "whiteboards/")) non-journals)
|
||||||
{built-in true others false} (group-by (fn [file]
|
{built-in true others false} (group-by (fn [file]
|
||||||
(or (string/includes? (:file/path file) "contents.")
|
(or (string/includes? (:file/path file) "contents.")
|
||||||
(string/includes? (:file/path file) ".edn")
|
(string/includes? (:file/path file) ".edn")
|
||||||
(string/includes? (:file/path file) "custom.css"))) non-journals)]
|
(string/includes? (:file/path file) "custom.css"))) non-whiteboards)]
|
||||||
(concat (reverse journals) built-in others)))
|
(concat (reverse journals) (reverse whiteboards) built-in others)))
|
||||||
|
|
|
@ -15,11 +15,17 @@
|
||||||
(gp-util/safe-re-find (re-pattern (str "^[./]*" local-assets-dir)) s))
|
(gp-util/safe-re-find (re-pattern (str "^[./]*" local-assets-dir)) s))
|
||||||
|
|
||||||
(defonce default-draw-directory "draws")
|
(defonce default-draw-directory "draws")
|
||||||
|
;; TODO read configurable value?
|
||||||
|
(defonce default-whiteboards-directory "whiteboards")
|
||||||
|
|
||||||
(defn draw?
|
(defn draw?
|
||||||
[path]
|
[path]
|
||||||
(string/starts-with? path default-draw-directory))
|
(string/starts-with? path default-draw-directory))
|
||||||
|
|
||||||
|
(defn whiteboard?
|
||||||
|
[path]
|
||||||
|
(string/includes? path (str "/" default-whiteboards-directory "/")))
|
||||||
|
|
||||||
;; TODO: rename
|
;; TODO: rename
|
||||||
(defonce mldoc-support-formats
|
(defonce mldoc-support-formats
|
||||||
#{:org :markdown :md})
|
#{:org :markdown :md})
|
||||||
|
|
|
@ -71,20 +71,24 @@
|
||||||
(assoc
|
(assoc
|
||||||
(gp-block/page-name->map page false db true date-formatter)
|
(gp-block/page-name->map page false db true date-formatter)
|
||||||
:block/file {:file/path (gp-util/path-normalize file)}))
|
:block/file {:file/path (gp-util/path-normalize file)}))
|
||||||
(seq properties)
|
|
||||||
(assoc :block/properties properties)
|
|
||||||
|
|
||||||
(seq aliases)
|
(seq properties)
|
||||||
(assoc :block/alias aliases)
|
(assoc :block/properties properties)
|
||||||
|
|
||||||
(:tags properties)
|
(seq aliases)
|
||||||
(assoc :block/tags (let [tags (:tags properties)
|
(assoc :block/alias aliases)
|
||||||
tags (if (string? tags) [tags] tags)
|
|
||||||
tags (remove string/blank? tags)]
|
(gp-config/whiteboard? file)
|
||||||
(swap! ref-tags set/union (set tags))
|
(assoc :block/whiteboard? true)
|
||||||
(map (fn [tag] {:block/name (gp-util/page-name-sanity-lc tag)
|
|
||||||
:block/original-name tag})
|
(:tags properties)
|
||||||
tags))))))
|
(assoc :block/tags (let [tags (:tags properties)
|
||||||
|
tags (if (string? tags) [tags] tags)
|
||||||
|
tags (remove string/blank? tags)]
|
||||||
|
(swap! ref-tags set/union (set tags))
|
||||||
|
(map (fn [tag] {:block/name (gp-util/page-name-sanity-lc tag)
|
||||||
|
:block/original-name tag})
|
||||||
|
tags))))))
|
||||||
|
|
||||||
;; TODO: performance improvement
|
;; TODO: performance improvement
|
||||||
(defn- extract-pages-and-blocks
|
(defn- extract-pages-and-blocks
|
||||||
|
|
Loading…
Reference in New Issue