Skip to content

Commit

Permalink
Merge pull request #148 from scicloj/options2
Browse files Browse the repository at this point in the history
Options2 - rely on kindly *options* and kindly-advice for options
  • Loading branch information
daslu authored Sep 8, 2024
2 parents b277055 + 1b6877f commit 9df334c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
io.github.nextjournal/markdown {:mvn/version "0.5.148"}
hiccup/hiccup {:mvn/version "2.0.0-RC3"}
clj-commons/clj-yaml {:mvn/version "1.0.27"}
org.scicloj/kindly {:mvn/version "4-beta6"}
org.scicloj/kindly-advice {:mvn/version "1-beta1"}
org.scicloj/kindly {:mvn/version "4-beta7"}
org.scicloj/kindly-advice {:mvn/version "1-beta3"}
org.scicloj/tempfiles {:mvn/version "1-beta1"}
org.scicloj/kind-portal {:mvn/version "1-beta1"}
org.clojure/tools.reader {:mvn/version "1.3.7"}
Expand Down
4 changes: 3 additions & 1 deletion src/scicloj/clay/v2/notebook.clj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
[scicloj.clay.v2.read :as read]
[scicloj.clay.v2.config :as config]
[scicloj.clay.v2.util.merge :as merge]
[scicloj.kindly.v4.api :as kindly]
[scicloj.kindly.v4.kind :as kind]
[scicloj.kindly-advice.v1.api :as kindly-advice]))

Expand Down Expand Up @@ -201,7 +202,8 @@
format]}]
(binding [*ns* *ns*
*warn-on-reflection* *warn-on-reflection*
*unchecked-math* *unchecked-math*]
*unchecked-math* *unchecked-math*
kindly/*options* kindly/*options*]
(let [code (some-> full-source-path slurp)
notes (cond
single-value (conj (when code
Expand Down
16 changes: 7 additions & 9 deletions src/scicloj/clay/v2/prepare.clj
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,7 @@
(defn prepare [{:as context
:keys [value]}
{:keys [fallback-preparer]}]
(let [complete-context (-> context
(update :kindly/options
merge/deep-merge
(-> value meta :kindly/options)))
kind (-> complete-context
(let [kind (-> context
advise-if-needed
:kind)]
(case kind
Expand All @@ -174,11 +170,13 @@
(when-let [preparer (-> kind
(@*kind->preparer)
(or fallback-preparer))]
[(-> complete-context
[(-> context
preparer
(update :hiccup limit-hiccup-height complete-context)
(update :md limit-md-height complete-context)
(assoc :kindly/options (:kindly/options complete-context)))]))))
;; returns an item
(update :hiccup limit-hiccup-height context)
(update :md limit-md-height context)
;; items need the options from the context
(assoc :kindly/options (:kindly/options context)))]))))



Expand Down

0 comments on commit 9df334c

Please sign in to comment.