babel: Don't trim whitespace when `org-src-preserve-indentation' is non-nil

* ob-tangle.el (org-babel-spec-to-string): Don't trim
	whitespace when `org-src-preserve-indentation' is non-nil

	* ob-python.el (org-babel-expand-body:python): Don't trim
	whitespace when `org-src-preserve-indentation' is non-nil

Based on report and patches by Antti Kaihola.
This commit is contained in:
Dan Davison 2010-10-12 15:47:59 +01:00
parent 70e52ba9ac
commit deb391f128
2 changed files with 2 additions and 2 deletions

View File

@ -56,7 +56,7 @@
(car pair)
(org-babel-python-var-to-python (cdr pair))))
(nth 1 (or processed-params (org-babel-process-params params))) "\n")
"\n" (org-babel-trim body) "\n"))
"\n" (org-babel-trim body (if org-src-preserve-indentation "[\f\n\r\v]")) "\n"))
(defun org-babel-execute:python (body params)
"Execute a block of Python code with Babel.

View File

@ -366,7 +366,7 @@ form
(org-fill-template org-babel-tangle-comment-format-beg link-data)))
(when org-babel-tangle-pad-newline (insert "\n"))
(insert (format "%s\n" (replace-regexp-in-string
"^," "" (org-babel-trim body))))
"^," "" (org-babel-trim body (if org-src-preserve-indentation "[\f\n\r\v]")))))
(when link-p
(insert-comment
(org-fill-template org-babel-tangle-comment-format-end link-data))))))