ob: strip *single* trailing newline from code block bodies

This commit is contained in:
Eric Schulte 2011-07-15 09:26:43 -06:00
parent 407b87e9d9
commit 8834bde39f
1 changed files with 5 additions and 1 deletions

View File

@ -957,7 +957,11 @@ may be specified in the current buffer."
(lang (org-babel-clean-text-properties (match-string 2)))
(lang-headers (intern (concat "org-babel-default-header-args:" lang)))
(switches (match-string 3))
(body (org-babel-clean-text-properties (match-string 5)))
(body (org-babel-clean-text-properties
(let* ((body (match-string 5))
(sub-length (- (length body) 1)))
(when (string= "\n" (substring body sub-length))
(substring body 0 sub-length)))))
(preserve-indentation (or org-src-preserve-indentation
(string-match "-i\\>" switches))))
(list lang