|
@@ -95,14 +95,41 @@ none ----- do not display either code or results upon export"
|
|
|
(message "org-babel-exp processing...")
|
|
|
(save-excursion
|
|
|
(goto-char (match-beginning 0))
|
|
|
- (let* ((info (org-babel-get-src-block-info))
|
|
|
- (params (nth 2 info)))
|
|
|
+ (let* ((raw-header (match-string 3))
|
|
|
+ (info (org-babel-get-src-block-info))
|
|
|
+ (lang (nth 0 info))
|
|
|
+ (lang-headers
|
|
|
+ (intern (concat "org-babel-default-header-args:" lang)))
|
|
|
+ (raw-params
|
|
|
+ (org-babel-parse-header-arguments
|
|
|
+ (org-babel-clean-text-properties
|
|
|
+ (mapconcat #'identity (cdr (split-string raw-header)) " "))))
|
|
|
+ (link (org-make-link-string
|
|
|
+ (concat
|
|
|
+ org-current-export-file
|
|
|
+ "::"
|
|
|
+ (nth 4 (ignore-errors (org-heading-components))))))
|
|
|
+ (export-buffer (current-buffer)))
|
|
|
;; bail if we couldn't get any info from the block
|
|
|
(when info
|
|
|
+ ;; resolve parameters in the original file so that headline
|
|
|
+ ;; and file-wide parameters are included
|
|
|
+ ;; attempt to go to the same heading in the original file
|
|
|
+ (set-buffer (get-file-buffer org-current-export-file))
|
|
|
+ (save-restriction
|
|
|
+ (org-open-link-from-string link)
|
|
|
+ (setf (nth 2 info)
|
|
|
+ (org-babel-merge-params
|
|
|
+ org-babel-default-header-args
|
|
|
+ (org-babel-params-from-buffer)
|
|
|
+ (org-babel-params-from-properties lang)
|
|
|
+ (if (boundp lang-headers) (eval lang-headers) nil)
|
|
|
+ raw-params)))
|
|
|
+ (set-buffer export-buffer)
|
|
|
;; expand noweb references in the original file
|
|
|
(setf (nth 1 info)
|
|
|
- (if (and (cdr (assoc :noweb params))
|
|
|
- (string= "yes" (cdr (assoc :noweb params))))
|
|
|
+ (if (and (cdr (assoc :noweb (nth 2 info)))
|
|
|
+ (string= "yes" (cdr (assoc :noweb (nth 2 info)))))
|
|
|
(org-babel-expand-noweb-references
|
|
|
info (get-file-buffer org-current-export-file))
|
|
|
(nth 1 info))))
|