|
493 | 493 | #_(nextjournal.clerk.builder/build-static-app! {:paths ["image.clj" "notebooks/image.clj" "notebooks/viewers/image.clj"] :browse? false}) |
494 | 494 |
|
495 | 495 | #?(:clj |
496 | | - (defn process-blobs [{:as doc+blob-opts :keys [blob-mode blob-id]} presented-result] |
497 | | - (w/postwalk #(if-some [content-type (get-safe % :nextjournal/content-type)] |
498 | | - (case blob-mode |
499 | | - :lazy-load (assoc % :nextjournal/value {:blob-id blob-id :path (:path %)}) |
500 | | - :inline (update % :nextjournal/value data-uri-base64-encode content-type) |
501 | | - :file (maybe-store-result-as-file doc+blob-opts %)) |
502 | | - %) |
503 | | - presented-result))) |
| 496 | + (defn process-content [{:as blob-opts :keys [blob-mode blob-id]} node] |
| 497 | + (if-some [content-type (get-safe node :nextjournal/content-type)] |
| 498 | + (case blob-mode |
| 499 | + :lazy-load (assoc node :nextjournal/value {:blob-id blob-id :path (:path node)}) |
| 500 | + :inline (update node :nextjournal/value data-uri-base64-encode content-type) |
| 501 | + :file (maybe-store-result-as-file blob-opts node)) |
| 502 | + node))) |
| 503 | + |
| 504 | +#?(:clj |
| 505 | + (defn process-blobs [blob-opts presented-result] |
| 506 | + (w/postwalk (partial process-content blob-opts) presented-result))) |
504 | 507 |
|
505 | 508 | (defn get-default-viewers [] |
506 | 509 | (:default @!viewers default-viewers)) |
|
546 | 549 | (= :directory package) :file |
547 | 550 | blob-id :lazy-load) |
548 | 551 | #?(:clj blob-opts :cljs _) (assoc doc :blob-mode blob-mode :blob-id blob-id) |
549 | | - #?@(:clj [process-content-fn (when blob-mode |
550 | | - (fn [node] |
551 | | - (if-some [content-type (:nextjournal/content-type node)] |
552 | | - (case blob-mode |
553 | | - :lazy-load (assoc node :nextjournal/value {:blob-id blob-id :path (:path node)}) |
554 | | - :inline (update node :nextjournal/value data-uri-base64-encode content-type) |
555 | | - :file (maybe-store-result-as-file blob-opts node)) |
556 | | - node)))]) |
| 552 | + #?@(:clj [process-content-fn (when blob-mode (partial process-content blob-opts))]) |
557 | 553 | opts-from-block (-> settings |
558 | 554 | (select-keys (keys viewer-opts-normalization)) |
559 | 555 | (set/rename-keys viewer-opts-normalization)) |
|
0 commit comments