From 0a9884ea131a06837df80c57d3be995156ddaae7 Mon Sep 17 00:00:00 2001 From: Timothy Pratley Date: Sun, 8 Sep 2024 12:42:31 -0700 Subject: [PATCH 1/5] leave option detection to kindly advice --- src/scicloj/clay/v2/prepare.clj | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/scicloj/clay/v2/prepare.clj b/src/scicloj/clay/v2/prepare.clj index d491e5bc..6ecdbe26 100644 --- a/src/scicloj/clay/v2/prepare.clj +++ b/src/scicloj/clay/v2/prepare.clj @@ -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 @@ -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)))])))) From ca98790f14f5552534456c115a45aeb592a93bdc Mon Sep 17 00:00:00 2001 From: Timothy Pratley Date: Sun, 8 Sep 2024 12:43:28 -0700 Subject: [PATCH 2/5] update to *options* in kindly and advice --- deps.edn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deps.edn b/deps.edn index d2ab2a54..5e64d458 100644 --- a/deps.edn +++ b/deps.edn @@ -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-beta2"} org.scicloj/tempfiles {:mvn/version "1-beta1"} org.scicloj/kind-portal {:mvn/version "1-beta1"} org.clojure/tools.reader {:mvn/version "1.3.7"} From 24fa53b6e88c9969f746b6114bcbd1a49f0266c9 Mon Sep 17 00:00:00 2001 From: Timothy Pratley Date: Sun, 8 Sep 2024 13:37:17 -0700 Subject: [PATCH 3/5] reset kindly/*options* per notebook or single-form --- src/scicloj/clay/v2/notebook.clj | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/scicloj/clay/v2/notebook.clj b/src/scicloj/clay/v2/notebook.clj index 65bda55b..8a554964 100644 --- a/src/scicloj/clay/v2/notebook.clj +++ b/src/scicloj/clay/v2/notebook.clj @@ -1,15 +1,16 @@ (ns scicloj.clay.v2.notebook (:require - [clojure.string :as string] - [scicloj.clay.v2.item :as item] - [scicloj.clay.v2.util.path :as path] - [scicloj.clay.v2.item :as item] - [scicloj.clay.v2.prepare :as prepare] - [scicloj.clay.v2.read :as read] - [scicloj.clay.v2.config :as config] - [scicloj.clay.v2.util.merge :as merge] - [scicloj.kindly.v4.kind :as kind] - [scicloj.kindly-advice.v1.api :as kindly-advice])) + [clojure.string :as string] + [scicloj.clay.v2.item :as item] + [scicloj.clay.v2.util.path :as path] + [scicloj.clay.v2.item :as item] + [scicloj.clay.v2.prepare :as prepare] + [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])) (defn deref-if-needed [v] (if (delay? v) @@ -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 From a819148f24352e2c34aa1aa233e1cc69d9234662 Mon Sep 17 00:00:00 2001 From: Timothy Pratley Date: Sun, 8 Sep 2024 13:38:36 -0700 Subject: [PATCH 4/5] use kindly-advice with ns options mutation --- deps.edn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps.edn b/deps.edn index 5e64d458..efbd5c3a 100644 --- a/deps.edn +++ b/deps.edn @@ -8,7 +8,7 @@ hiccup/hiccup {:mvn/version "2.0.0-RC3"} clj-commons/clj-yaml {:mvn/version "1.0.27"} org.scicloj/kindly {:mvn/version "4-beta7"} - org.scicloj/kindly-advice {:mvn/version "1-beta2"} + 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"} From 1b6877f7c0063e8c695f3f23f1b0d10f85283559 Mon Sep 17 00:00:00 2001 From: Timothy Pratley Date: Sun, 8 Sep 2024 13:43:54 -0700 Subject: [PATCH 5/5] revert whitespace change --- src/scicloj/clay/v2/notebook.clj | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/scicloj/clay/v2/notebook.clj b/src/scicloj/clay/v2/notebook.clj index 8a554964..318b219e 100644 --- a/src/scicloj/clay/v2/notebook.clj +++ b/src/scicloj/clay/v2/notebook.clj @@ -1,16 +1,16 @@ (ns scicloj.clay.v2.notebook (:require - [clojure.string :as string] - [scicloj.clay.v2.item :as item] - [scicloj.clay.v2.util.path :as path] - [scicloj.clay.v2.item :as item] - [scicloj.clay.v2.prepare :as prepare] - [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])) + [clojure.string :as string] + [scicloj.clay.v2.item :as item] + [scicloj.clay.v2.util.path :as path] + [scicloj.clay.v2.item :as item] + [scicloj.clay.v2.prepare :as prepare] + [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])) (defn deref-if-needed [v] (if (delay? v)