https://github.com/brantou/ob-coffeescript
Org-Babel support for evaluating coffee-script code.
https://github.com/brantou/ob-coffeescript
coffeescript emacs emacs-lisp org-babel org-mode
Last synced: about 1 year ago
JSON representation
Org-Babel support for evaluating coffee-script code.
- Host: GitHub
- URL: https://github.com/brantou/ob-coffeescript
- Owner: brantou
- License: gpl-3.0
- Created: 2017-06-26T15:06:55.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-01-26T07:20:02.000Z (over 8 years ago)
- Last Synced: 2025-04-09T12:21:50.880Z (over 1 year ago)
- Topics: coffeescript, emacs, emacs-lisp, org-babel, org-mode
- Language: Emacs Lisp
- Homepage:
- Size: 39.1 KB
- Stars: 5
- Watchers: 0
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
- License: LICENSE
Awesome Lists containing this project
README
#+TITLE: ob-coffeescript
[[https://travis-ci.org/brantou/ob-coffeescript][file:https://travis-ci.org/brantou/ob-coffeescript.svg?branch=master]][[https://melpa.org/#/ob-coffeescript][file:https://melpa.org/packages/ob-coffeescript-badge.svg]]
[[https://stable.melpa.org/#/ob-coffeescript][file:https://stable.melpa.org/packages/ob-coffeescript-badge.svg]]
* Introduction
:PROPERTIES:
:ID: 04d934b4-079c-4bb7-ae60-ad75dea39537
:END:
=ob-coffeescript= enables [[http://orgmode.org/worg/org-contrib/babel/intro.html][Org-Babel]] support for evaluating [[http://coffee-script.org/][CoffeeScript]] code.
It was created based on the usage of [[http://orgmode.org/w/worg.git/blob/HEAD:/org-contrib/babel/ob-template.el][ob-template]].
#+BEGIN_SRC coffeescript
"hello world"
#+END_SRC
#+RESULTS:
: hello world
* Examples
:PROPERTIES:
:ID: f76698a5-8e6d-4c47-a712-beda78487865
:END:
** variables
:PROPERTIES:
:ID: c7c04ccf-b33b-4f50-8457-a808072e4e58
:END:
: #+BEGIN_SRC coffeescript :var a=3 b=4
: a+b
: #+END_SRC
: #+RESULTS:
: : 7
** table and list
:PROPERTIES:
:ID: 7d18b8cb-9d50-4c44-a968-536846a6b413
:END:
: #+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
:PROPERTIES:
:ID: 94fb606d-fad9-489d-a091-f63ad87953cc
:END:
: #+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
: <>
: console.log square x
: #+END_SRC
: #+CALL: calc-square(x=5)
: #+RESULTS:
: : 25
** session
:PROPERTIES:
:ID: 2F331C5F-75BD-486D-ABCB-85F4E04A4BEF
:END:
: #+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
:PROPERTIES:
:ID: 166fe0ff-8f74-48b1-a95b-df5ba831271e
:END:
Tests can be executed by /make test/ or invoking emacs directly with
the command-line below:
#+BEGIN_SRC shell
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
#+END_SRC