* ob-clojure-literate: Support vars initialization when prepare session

* contrib/lisp/ob-clojure-literate.el (org-babel-clojure-var-to-clojure):
(org-babel-variable-assignments:clojure): Support vars initialization
when prepare session.
This commit is contained in:
stardiviner 2018-03-26 09:47:54 +08:00 committed by Nicolas Goaziou
parent 0104bea3ad
commit 8835ee750e
1 changed files with 9 additions and 3 deletions

View File

@ -221,7 +221,14 @@ If it is a directory, `ob-clojure-literate' will try to create Clojure project a
(defun org-babel-clojure-var-to-clojure (var)
"Convert src block's `VAR' to Clojure variable."
;; TODO: reference `org-babel-python-var-to-python'
(if (listp var)
(replace-regexp-in-string "(" "'(" var)
(cond
((stringp var)
;; wrap org-babel passed in header argument value with quote in Clojure.
(format "\"%s\"" var))
(t
(format "%s" var))))
)
(defun org-babel-variable-assignments:clojure (params)
@ -230,8 +237,7 @@ If it is a directory, `ob-clojure-literate' will try to create Clojure project a
(lambda (pair)
(format "(def %s %s)"
(car pair)
;; (org-babel-clojure-var-to-clojure (cdr pair))
(cdr pair)))
(org-babel-clojure-var-to-clojure (cdr pair))))
(org-babel--get-vars params)))
;;; Support header arguments :results graphics :file "image.png" by inject Clojure code.