From 3cf2a73635ea830a7dc0fb6585250cfe0059633a Mon Sep 17 00:00:00 2001 From: adham-omran Date: Wed, 24 Jul 2024 09:01:46 +0300 Subject: [PATCH] Remove duplicate require of `clojure.string` --- src/scicloj/clay/v2/item.clj | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/src/scicloj/clay/v2/item.clj b/src/scicloj/clay/v2/item.clj index 7f59676a..6523c67e 100644 --- a/src/scicloj/clay/v2/item.clj +++ b/src/scicloj/clay/v2/item.clj @@ -1,6 +1,5 @@ (ns scicloj.clay.v2.item (:require [clojure.pprint :as pp] - [clojure.string :as string] [charred.api :as charred] [scicloj.clay.v2.files :as files] [scicloj.clay.v2.util.image :as util.image] @@ -23,14 +22,13 @@ (defn escape [string] (-> string - (string/escape + (str/escape {\< "<" \> ">" \& "&" \" """ \' "'"}))) - (defn clojure-code-item [{:keys [tag hiccup-element md-class]}] (fn [string-or-strings] (let [strings (->> string-or-strings @@ -53,7 +51,7 @@ ``` ::: " (name md-class) s))) - (string/join "\n"))}))) + (str/join "\n"))}))) (def source-clojure (clojure-code-item {:tag :source-clojure @@ -65,8 +63,6 @@ :hiccup-element :code.sourceCode.language-clojure.printed-clojure :md-class :printedClojure})) - - (defn just-println [value] (-> value println @@ -84,7 +80,7 @@ (defn md [text] {:md (->> text in-vector - (string/join "\n"))}) + (str/join "\n"))}) (defn katex-hiccup [string] [:div @@ -98,7 +94,7 @@ {:md (->> text in-vector (map (partial format "$$%s$$")) - (string/join "\n")) + (str/join "\n")) :hiccup (->> text in-vector (map katex-hiccup) @@ -119,7 +115,6 @@ {:md string :hiccup [:p string]}) - (def next-id (let [*counter (atom 0)] #(str "id" (swap! *counter inc)))) @@ -165,7 +160,6 @@ };"))]] :deps [:cytoscape]}) - (defn echarts [{:as context :keys [value]}] {:hiccup [:div @@ -181,7 +175,6 @@ };"))]] :deps [:echarts]}) - (defn plotly [{:as context {:keys [data layout config] :or {layout {} @@ -197,7 +190,6 @@ (charred/write-json-str config))]] :deps [:plotly]}) - (defn portal [value] {:hiccup [:div [:script @@ -226,11 +218,10 @@ [:a {:href url} path] path)]]])]}) - (defn html [html] {:html (->> html in-vector - (string/join "\n"))}) + (str/join "\n"))}) (defn image [{:keys [value full-target-path @@ -245,17 +236,16 @@ image ".png")] (when-not - (util.image/write! image "png" png-path) + (util.image/write! image "png" png-path) (throw (ex-message "Failed to save image as PNG."))) {:hiccup [:img {:src (-> png-path - (string/replace + (str/replace (re-pattern (str "^" base-target-path "/")) ""))}] :item-class "clay-image"})) - (defn vega-embed [{:keys [value full-target-path base-target-path] @@ -270,7 +260,7 @@ ".csv")] (spit csv-path values) {:url (-> csv-path - (string/replace + (str/replace (re-pattern (str "^" base-target-path "/")) @@ -284,7 +274,6 @@ (->> (format "vegaEmbed(document.currentScript.parentElement, %s);")))]] :deps [:vega]})) - (defn video [{:keys [youtube-id iframe-width iframe-height @@ -309,7 +298,7 @@ (defn observable [code] {:md (->> code in-vector - (string/join "\n") + (str/join "\n") (format " ```{ojs} //| echo: false