|
55 | 55 | [:build/page {:build/journal (:block/journal-day pvalue)}])) |
56 | 56 |
|
57 | 57 | (defn- build-pvalue-entity-default [db ent-properties pvalue |
58 | | - {:keys [include-uuid-fn] |
59 | | - :or {include-uuid-fn (constantly false)} |
| 58 | + {:keys [content-ref-uuids] |
| 59 | + :or {content-ref-uuids #{}} |
60 | 60 | :as options}] |
61 | | - (if (or (seq ent-properties) (seq (:block/tags pvalue))) |
| 61 | + (if (or (seq ent-properties) (seq (:block/tags pvalue)) (contains? content-ref-uuids (:block/uuid pvalue))) |
62 | 62 | (cond-> {:build/property-value :block |
63 | 63 | :block/title (or (block-title pvalue) |
64 | 64 | (:logseq.property/value pvalue))} |
|
75 | 75 | [k v])))) |
76 | 76 | (into {}))) |
77 | 77 |
|
78 | | - (include-uuid-fn (:block/uuid pvalue)) |
| 78 | + (contains? content-ref-uuids (:block/uuid pvalue)) |
79 | 79 | (assoc :block/uuid (:block/uuid pvalue) :build/keep-uuid? true) |
80 | 80 |
|
81 | 81 | (:include-timestamps? options) |
|
95 | 95 | (if-let [build-page (and (not property-value-uuids?) (build-pvalue-entity-for-build-page pvalue))] |
96 | 96 | build-page |
97 | 97 | (if (contains? #{:node :date} (:logseq.property/type property-ent)) |
98 | | - ;; Idents take precedence over uuid because they are keep data graph-agnostic |
| 98 | + ;; Idents take precedence over uuid because they keep data graph-agnostic |
99 | 99 | (if (:db/ident pvalue) |
100 | 100 | (:db/ident pvalue) |
101 | | - ;; Use metadata distinguish from block references that don't exist like closed values |
| 101 | + ;; Use metadata to distinguish from block references that don't exist like closed values |
102 | 102 | ^::existing-property-value? [:block/uuid (:block/uuid pvalue)]) |
103 | 103 | (or (:db/ident pvalue) |
104 | 104 | (let [ent-properties* (->> (apply dissoc (db-property/properties pvalue) |
|
488 | 488 |
|
489 | 489 | (defn- remove-uuid-if-not-ref-given-uuids |
490 | 490 | [ref-uuids m] |
491 | | - (if (contains? ref-uuids (:block/uuid m)) |
492 | | - m |
493 | | - (dissoc m :block/uuid :build/keep-uuid?))) |
| 491 | + (cond-> m |
| 492 | + (not (contains? ref-uuids (:block/uuid m))) |
| 493 | + (dissoc :block/uuid :build/keep-uuid?))) |
494 | 494 |
|
495 | 495 | (defn- build-page-export* |
496 | | - "When given the :handle-block-uuids option, handle references between blocks" |
| 496 | + "When given the :handle-block-uuids option, handle uuid references between |
| 497 | + blocks including property value blocks" |
497 | 498 | [db eid page-blocks* {:keys [handle-block-uuids?] :as options}] |
498 | 499 | (let [page-entity (d/entity db eid) |
499 | 500 | page-blocks (->> page-blocks* |
|
542 | 543 | {:keys [content-ref-ents] :as content-ref-export} (build-content-ref-export db page-blocks*) |
543 | 544 | {:keys [pvalue-uuids] :as page-export*} |
544 | 545 | (build-page-export* db eid page-blocks* {:include-uuid-fn (:content-ref-uuids content-ref-export) |
| 546 | + :content-ref-uuids (:content-ref-uuids content-ref-export) |
545 | 547 | :handle-block-uuids? true |
546 | 548 | :include-alias? true}) |
547 | 549 | page-entity (d/entity db eid) |
|
784 | 786 | ontology-export (build-graph-ontology-export db ontology-options) |
785 | 787 | ontology-pvalue-uuids (set (concat (mapcat get-pvalue-uuids (vals (:properties ontology-export))) |
786 | 788 | (mapcat get-pvalue-uuids (vals (:classes ontology-export))))) |
787 | | - pages-export (build-graph-pages-export db ontology-export options) |
| 789 | + pages-export (build-graph-pages-export db ontology-export (assoc options :content-ref-uuids content-ref-uuids)) |
788 | 790 | graph-export* (-> (merge ontology-export pages-export) (dissoc :pvalue-uuids)) |
789 | 791 | graph-export (if (seq (:exclude-namespaces options)) |
790 | 792 | (assoc graph-export* ::auto-include-namespaces (:exclude-namespaces options)) |
|
0 commit comments