diff options
author | Eric Schulte <schulte.eric@gmail.com> | 2011-06-30 15:23:35 -0700 |
---|---|---|
committer | Eric Schulte <schulte.eric@gmail.com> | 2011-06-30 15:23:46 -0700 |
commit | 311b09d92644f39040087327d6a1dbeb09a9ab6e (patch) | |
tree | 4ae3a0b9ed0c6120d707f4733e95e22271dbc81b | |
parent | d6fb52e157821115815039fa2f66ecc1e5f159ff (diff) | |
download | org-mode-311b09d92644f39040087327d6a1dbeb09a9ab6e.tar.gz |
ob-org: expanding variables in Org-mode text
* lisp/ob-org.el (org-babel-expand-body:org): Implemented this
function, only action is to expand variables.
(org-babel-execute:org): Uses the new body-expansion function.
-rw-r--r-- | lisp/ob-org.el | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lisp/ob-org.el b/lisp/ob-org.el index 7e8421b..83f3cf1 100644 --- a/lisp/ob-org.el +++ b/lisp/ob-org.el @@ -40,11 +40,19 @@ "#+TITLE: default empty header\n" "Default header inserted during export of org blocks.") +(defun org-babel-expand-body:org (body params) + (dolist (var (mapcar #'cdr (org-babel-get-header params :var))) + (setq body (replace-regexp-in-string + (regexp-quote (format "$%s" (car var))) (cdr var) body + nil 'literal))) + body) + (defun org-babel-execute:org (body params) "Execute a block of Org code with. This function is called by `org-babel-execute-src-block'." (let ((result-params (split-string (or (cdr (assoc :results params)) ""))) - (body (replace-regexp-in-string "^," "" body))) + (body (org-babel-expand-body:org + (replace-regexp-in-string "^," "" body) params))) (cond ((member "latex" result-params) (org-export-string (concat "#+Title: \n" body) "latex")) |