mirror of
https://github.com/logseq/logseq.git
synced 2026-06-01 19:01:22 +00:00
enhance: importer displays one notification about ignored files
rather than one notification per file. Also ignore pdf highlight pages as user graphs shouldn't fail hard on features that aren't imported yet. This allowed the user graph in https://github.com/logseq/db-test/issues/191 to import without errors
This commit is contained in:
@@ -1108,6 +1108,8 @@
|
||||
;; Properties are ignored to keep graph valid and notify users of ignored properties.
|
||||
;; Properties with :schema are ignored due to property schema changes
|
||||
:ignored-properties (atom [])
|
||||
;; Vec of maps with keys :path and :reason
|
||||
:ignored-files (atom [])
|
||||
;; Map of property names (keyword) and their current schemas (map).
|
||||
;; Used for adding schemas to properties and detecting changes across a property's usage
|
||||
:property-schemas (atom {})
|
||||
@@ -1227,8 +1229,10 @@
|
||||
|
||||
(defn- extract-pages-and-blocks
|
||||
"Main fn which calls graph-parser to convert markdown into data"
|
||||
[db file content {:keys [extract-options notify-user]}]
|
||||
[db file content {:keys [extract-options import-state]}]
|
||||
(let [format (common-util/get-format file)
|
||||
;; TODO: Remove once pdf highlights are supported
|
||||
ignored-highlight-file? (string/starts-with? (str (path/basename file)) "hls__")
|
||||
extract-options' (merge {:block-pattern (common-config/get-block-pattern format)
|
||||
:date-formatter "MMM do, yyyy"
|
||||
:uri-encoded? false
|
||||
@@ -1236,7 +1240,7 @@
|
||||
:filename-format :legacy}
|
||||
extract-options
|
||||
{:db db})]
|
||||
(cond (contains? common-config/mldoc-support-formats format)
|
||||
(cond (and (contains? common-config/mldoc-support-formats format) (not ignored-highlight-file?))
|
||||
(-> (extract/extract file content extract-options')
|
||||
(update :pages (fn [pages]
|
||||
(map #(dissoc % :block.temp/original-page-name) pages)))
|
||||
@@ -1254,7 +1258,11 @@
|
||||
(update :blocks update-whiteboard-blocks format))
|
||||
|
||||
:else
|
||||
(notify-user {:msg (str "Skipped file since its format is not supported: " file)}))))
|
||||
(if ignored-highlight-file?
|
||||
(swap! (:ignored-files import-state) conj
|
||||
{:path file :reason :pdf-highlight})
|
||||
(swap! (:ignored-files import-state) conj
|
||||
{:path file :reason :unsupported-file-format})))))
|
||||
|
||||
(defn- build-journal-created-ats
|
||||
"Calculate created-at timestamps for journals"
|
||||
|
||||
Reference in New Issue
Block a user