org-babel: export of functional-style source blocks
commitc84903f1b30ef830ef200b3c3470809e6b13b5d9
authorDan Davison <davison@stats.ox.ac.uk>
Sun, 1 Nov 2009 01:22:38 +0000 (31 21:22 -0400)
committerDan Davison <davison@stats.ox.ac.uk>
Sun, 1 Nov 2009 15:05:42 +0000 (1 10:05 -0500)
treed87c0ea20be52fbe6536681bae17ac91dd281d15
parent75299025d67a15b16fcd4b24b575ea9604b97db5
org-babel: export of functional-style source blocks

A "functional-style" source block is one in which the name is followed
immediately by a parenthesised argument. An example is the following
"function", which generates n uniform random numbers:

\#+srcname: rand(n)
\#+begin_src R
runif(n)
\#+end_src

With these changes, such source blocks are passed over to the export
machinery in the following form:

\#+begin_src org-babel-lob
<function-def-keyword> rand(n):
\#+end_src
\#+begin_src R <switches>
<indent>runif(n)
\#+end_src

where <function-def-keyword> is the value of
org-babel-function-def-export-keyword, which defaults to "function",
<switches> are the src block switches that belonged to the original
block, and <indent> is the whitespace indent of the function body, the
width of which is determined by org-babel-function-def-export-indent.
org-babel-lob is a simple major mode responsible for fontification of
the blocks corresponding to the function definition line (as opposed
to the function body).
contrib/babel/lisp/org-babel-exp.el
contrib/babel/lisp/org-babel-lob.el