8000 GitHub - brantou/ob-coffeescript: Org-Babel support for evaluating coffee-script code.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

brantou/ob-coffeescript

Repository files navigation

ob-coffeescript

https://travis-ci.org/brantou/ob-coffeescript.svg?branch=masterhttps://melpa.org/packages/ob-coffeescript-badge.svg https://stable.melpa.org/packages/ob-coffeescript-badge.svg

Introduction

ob-coffeescript enables Org-Babel support for evaluating CoffeeScript code. It was created based on the usage of ob-template.

"hello world"

Examples

variables

#+BEGIN_SRC coffeescript :var a=3 b=4
  a+b
#+END_SRC
#+RESULTS:
: 7

table and list

#+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

literate programming

#+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

session

#+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

Running tests

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

About

Org-Babel support for evaluating coffee-script code.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published
0