* 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:
parent
0104bea3ad
commit
8835ee750e
|
@ -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)
|
(defun org-babel-clojure-var-to-clojure (var)
|
||||||
"Convert src block's `VAR' to Clojure variable."
|
"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)
|
(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)
|
(lambda (pair)
|
||||||
(format "(def %s %s)"
|
(format "(def %s %s)"
|
||||||
(car pair)
|
(car pair)
|
||||||
;; (org-babel-clojure-var-to-clojure (cdr pair))
|
(org-babel-clojure-var-to-clojure (cdr pair))))
|
||||||
(cdr pair)))
|
|
||||||
(org-babel--get-vars params)))
|
(org-babel--get-vars params)))
|
||||||
|
|
||||||
;;; Support header arguments :results graphics :file "image.png" by inject Clojure code.
|
;;; Support header arguments :results graphics :file "image.png" by inject Clojure code.
|
||||||
|
|
Loading…
Reference in New Issue