ob-coffeescript
enables Org-Babel support for evaluating CoffeeScript code.
It was created based on the usage of ob-template.
"hello world"
#+BEGIN_SRC coffeescript :var a=3 b=4 a+b #+END_SRC
#+RESULTS: : 7
#+NAME: tel-note | name | tel | |-------+--------| | brant | 170... | | ou | 138... |
#+BEGIN_SRC coffeescript :var tb=tel-note :results output table console.log tb #+END_SRC
#+RESULTS: | brant | 170... | | ou | 138... |
#+BEGIN_SRC coffeescript :var lst='(1 2 3) :results output console.log lst console.log num for num in lst #+END_SRC
#+RESULTS: : [ 1, 2, 3 ] : 1 : 2 : 3
#+NAME: square #+BEGIN_SRC coffeescript square = (x) -> x * x #+END_SRC
#+NAME: calc-square #+BEGIN_SRC coffeescript :var x=0 :noweb strip-export :results output <<square>> console.log square x #+END_SRC
#+CALL: calc-square(x=5)
#+RESULTS: : 25
#+NAME: func-def #+BEGIN_SRC coffeescript :session :results output silent square = (x) -> x * x #+END_SRC
#+NAME: func-call-output #+BEGIN_SRC coffeescript :session :results output :var x=5 console.log square x #+END_SRC
#+NAME: func-call-value #+BEGIN_SRC coffeescript :session :results value :var x=5 square x #+END_SRC
#+CALL: func-def() #+CALL: func-call-output(x=10)
#+RESULTS: : 100
#+CALL: func-call-value(x=10)
#+RESULTS: : 100
Tests can be executed by make test or invoking emacs directly with the command-line below:
emacs -Q --batch -q \
-L . \
-l ob-coffeescript.el \
-l test-ob-coffeescript.el \
--eval "(progn \
(setq org-confirm-babel-evaluate nil) \
(org-babel-do-load-languages \
'org-babel-load-languages '((emacs-lisp . t) \
(sh . t) \
(org . t) \
(js . t) \
(coffeescript . t))))" \
-f ob-coffeescript-test-runall