Permalink
Browse files

version 7.2.3

  • Loading branch information...
viebel committed Oct 6, 2017
1 parent 5e0f488 commit 5ef8754f2d54f0ca41c41d43949b71ed8b4b4c98
View

Large diffs are not rendered by default.

Oops, something went wrong.
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -1,4 +1,4 @@
(defproject klipse "7.2.2"
(defproject klipse "7.2.3"
:description "Embeddable multi-language WEB REPL"
:dependencies [[org.clojure/clojure "1.9.0-alpha14"]
[org.clojure/clojurescript "1.9.456"]
@@ -11,18 +11,15 @@
<pre>
<code class="eval-reason">
let square x => x * x;
let a = square 9;
let a = 1;
</code>
</pre>
<pre>
<code class="eval-reason">
type person = {name: string, age: int};
let somePerson = {name: "Guy", age: 30};
let {name, age} = somePerson;
external a: int = "" [@@bs.val];
let b = a;
</code>
</pre>
@@ -34,15 +31,15 @@
<p> Transpilation </p>
<pre>
<code class="transpile-reason">
let rec fib n => {
switch n {
| 0 => 1
| 1 => 1
| _ => fib (n-1) + fib (n-2)
};
};
let a = 1;
</code>
</pre>
<br/>
let x = fib 9;
<pre>
<code class="transpile-reason">
external a: int = "" [@@bs.val];
let b = a;
</code>
</pre>
<br/>
@@ -19,16 +19,19 @@
(->> (split s ",")
(map trim))))
(defn comment-out [src comment-str]
(if (string? comment-str)
(str comment-str src)
(comment-str src)))
(defn content-from-gist [element comment-str]
(go
(when-let [gist-id (or
(-> (aget element "dataset")
(aget "gistId")) nil)]
(let [gist-content (<! (read-input-from-gist gist-id))
gist-intro (str "loaded from gist: " (gist-path-page gist-id))
gist-intro-commented-out (if (string? comment-str)
(str comment-str gist-intro)
(comment-str gist-intro))]
gist-intro-commented-out (comment-out gist-intro comment-str)]
(str gist-intro-commented-out "\n" gist-content)))))
(defn content [element comment-str]
@@ -40,19 +40,22 @@
(let [[_ res] (ocaml-to-js exp)]
res)))
(defn comment-out [src]
(str "(* " src " *)"))
(def eval-opts {:editor-in-mode "text/x-ocaml"
:editor-out-mode "javascript"
:beautify? false
:eval-fn eval-ocaml
:external-scripts [(codemirror-mode-src "mllike") "https://viebel.github.io/klipse/repo/js/bs.js" "https://viebel.github.io/klipse/repo/js/stdlibBundle.js" "https://viebel.github.io/klipse/repo/js/pretty_format.js"]
:comment-str #(str "(*" %1 "*)")})
:comment-str comment-out})
(def transpile-opts {:editor-in-mode "text/x-ocaml"
:editor-out-mode "javascript"
:beautify? false
:eval-fn transpile-ocaml
:external-scripts [(codemirror-mode-src "mllike") "https://viebel.github.io/klipse/repo/js/bs.js"]
:comment-str #(str "(*" %1 "*)")})
:comment-str comment-out})
(register-mode "eval-ocaml" "selector_eval_ocaml" eval-opts)
(register-mode "transpile-ocaml" "selector_transpile_ocaml" transpile-opts)
@@ -60,27 +60,30 @@
(let [[_ res] (reason->ocaml exp)]
res)))
(defn comment-out [src]
(str "/* " src " */"))
(def eval-opts {:editor-in-mode "text/x-ocaml"
:editor-out-mode "javascript"
:beautify? false
:eval-fn eval-reason
:external-scripts [(codemirror-mode-src "mllike") "https://viebel.github.io/klipse/repo/js/bs.js" "https://viebel.github.io/klipse/repo/js/refmt.js" "https://viebel.github.io/klipse/repo/js/stdlibBundle.js" "https://viebel.github.io/klipse/repo/js/pretty_format.js"]
:comment-str #(str "/*" %1 "*/")})
:comment-str comment-out})
(def transpile-opts {:editor-in-mode "text/x-ocaml"
:editor-out-mode "javascript"
:beautify? false
:eval-fn transpile-reason
:external-scripts [(codemirror-mode-src "mllike") "https://viebel.github.io/klipse/repo/js/bs.js" "https://viebel.github.io/klipse/repo/js/refmt.js"]
:comment-str #(str "/*" %1 "*/")})
:comment-str comment-out})
(def transpile->ocaml-opts {:editor-in-mode "text/x-ocaml"
:editor-out-mode "text/x-ocaml"
:beautify? false
:eval-fn transpile-reason->ocaml
:external-scripts [(codemirror-mode-src "mllike") "https://viebel.github.io/klipse/repo/js/refmt.js"]
:comment-str #(str "/*" %1 "*/")})
:comment-str comment-out})
(register-mode "eval-reason" "selector_eval_reason" eval-opts)
View
@@ -75,14 +75,14 @@
:codemirror-options-out codemirror_options_out
:eval-fn (if (= :ok load-status) eval-fn-with-args #(chan))
:source-code source-code
:default-txt (if (= :ok load-status) (str comment-str out-placeholder) load-error)
:default-txt (if (= :ok load-status) out-placeholder load-error)
:idle-msec idle-msec})))))
(s/def ::dom-element isElement)
(s/def ::editor-in-mode string?)
(s/def ::editor-out-mode string?)
(s/def ::eval-fn fn?)
(s/def ::comment-str string?)
(s/def ::comment-str (s/or :fn fn? :str string?))
(s/def ::eval_idle_msec integer?)
(s/def ::minimalistic_ui #(or (= % true) (= % false)))

0 comments on commit 5ef8754

Please sign in to comment.