diff options
author | Eric Schulte <eric.schulte@gmx.com> | 2012-03-31 11:28:37 -0400 |
---|---|---|
committer | Eric Schulte <eric.schulte@gmx.com> | 2012-03-31 11:28:37 -0400 |
commit | cb77b49774faa487b6977a4ac94f2e8b266b42e9 (patch) | |
tree | 0e877a500eaa424984574b61370d9e009196529e | |
parent | 61106491b3c0b7ac2cacad7be836a39fc1376533 (diff) | |
download | org-mode-cb77b49774faa487b6977a4ac94f2e8b266b42e9.tar.gz |
separate noweb handling for code and results on export
* lisp/ob-exp.el (org-babel-exp-src-block): Remove noweb handling from
the top level.
(org-babel-exp-code): Noweb handling for code export.
(org-babel-exp-results): Noweb handling for results export.
-rw-r--r-- | lisp/ob-exp.el | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/lisp/ob-exp.el b/lisp/ob-exp.el index 06d193a..0de488c 100644 --- a/lisp/ob-exp.el +++ b/lisp/ob-exp.el @@ -113,15 +113,6 @@ none ----- do not display either code or results upon export" (if (boundp lang-headers) (eval lang-headers) nil) raw-params)))) (setf hash (org-babel-sha1-hash info))) - ;; expand noweb references in the original file - (setf (nth 1 info) - (if (string= "strip-export" (cdr (assoc :noweb (nth 2 info)))) - (replace-regexp-in-string - (org-babel-noweb-wrap) "" (nth 1 info)) - (if (org-babel-noweb-p (nth 2 info) :export) - (org-babel-expand-noweb-references - info (org-babel-exp-get-export-buffer)) - (nth 1 info)))) (org-babel-exp-do-export info 'block hash))))) (defcustom org-babel-exp-call-line-template @@ -260,6 +251,14 @@ replaced with its value." (defun org-babel-exp-code (info) "Return the original code block formatted for export." + (setf (nth 1 info) + (if (string= "strip-export" (cdr (assoc :noweb (nth 2 info)))) + (replace-regexp-in-string + (org-babel-noweb-wrap) "" (nth 1 info)) + (if (org-babel-noweb-p (nth 2 info) :export) + (org-babel-expand-noweb-references + info (org-babel-exp-get-export-buffer)) + (nth 1 info)))) (org-fill-template org-babel-exp-code-template `(("lang" . ,(nth 0 info)) @@ -280,7 +279,10 @@ inhibit insertion of results into the buffer." (when (and org-export-babel-evaluate (not (and hash (equal hash (org-babel-current-result-hash))))) (let ((lang (nth 0 info)) - (body (nth 1 info)) + (body (if (org-babel-noweb-p (nth 2 info) :eval) + (org-babel-expand-noweb-references + info (org-babel-exp-get-export-buffer)) + (nth 1 info))) (info (copy-sequence info))) ;; skip code blocks which we can't evaluate (when (fboundp (intern (concat "org-babel-execute:" lang))) |