diff options
Diffstat (limited to 'lisp/org/ob-org.el')
-rw-r--r-- | lisp/org/ob-org.el | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/lisp/org/ob-org.el b/lisp/org/ob-org.el index 99c04d8e313..74071363747 100644 --- a/lisp/org/ob-org.el +++ b/lisp/org/ob-org.el @@ -1,11 +1,11 @@ ;;; ob-org.el --- org-babel functions for org code block evaluation -;; Copyright (C) 2010-2011 Free Software Foundation, Inc. +;; Copyright (C) 2010 Free Software Foundation, Inc. ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.4 +;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -40,13 +40,22 @@ "#+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 body "latex")) + ((member "latex" result-params) (org-export-string + (concat "#+Title: \n" body) "latex")) ((member "html" result-params) (org-export-string body "html")) ((member "ascii" result-params) (org-export-string body "ascii")) (t body)))) @@ -57,5 +66,6 @@ This function is called by `org-babel-execute-src-block'." (provide 'ob-org) +;; arch-tag: 130af5fe-cc56-46bd-9508-fa0ebd94cb1f ;;; ob-org.el ends here |