diff --git a/lisp/ob-exp.el b/lisp/ob-exp.el index c22740fae..c5cc0cb41 100644 --- a/lisp/ob-exp.el +++ b/lisp/ob-exp.el @@ -115,6 +115,23 @@ none ----- do not display either code or results upon export" (nth 1 info))) (org-babel-exp-do-export info 'block hash))))) +(defcustom org-babel-exp-call-line-template + "" + "Template used to export call lines. +This template may be customized to include the call line name +with any export markup. The template is filled out using +`org-fill-template', and the following %keys may be used. + + line --- call line + +An example value would be \"\\n: call: %line\" to export the call line +wrapped in a verbatim environment. + +Note: the results are inserted separately after the contents of +this template." + :group 'org-babel + :type 'string) + (defvar org-babel-default-lob-header-args) (defun org-babel-exp-non-block-elements (start end) "Process inline source and call lines between START and END for export." @@ -160,22 +177,24 @@ none ----- do not display either code or results upon export" (inlinep (match-string 11)) (inline-start (match-end 11)) (inline-end (match-end 0)) - (rep (let ((lob-info (org-babel-lob-get-info))) - (save-match-data - (org-babel-exp-do-export - (list "emacs-lisp" "results" - (org-babel-merge-params - org-babel-default-header-args - org-babel-default-lob-header-args - (org-babel-params-from-properties) - (org-babel-parse-header-arguments - (org-babel-clean-text-properties - (concat ":var results=" - (mapconcat #'identity - (butlast lob-info) - " "))))) - "" nil (car (last lob-info))) - 'lob))))) + (results (save-match-data + (org-babel-exp-do-export + (list "emacs-lisp" "results" + (org-babel-merge-params + org-babel-default-header-args + org-babel-default-lob-header-args + (org-babel-params-from-properties) + (org-babel-parse-header-arguments + (org-babel-clean-text-properties + (concat ":var results=" + (mapconcat #'identity + (butlast lob-info) + " "))))) + "" nil (car (last lob-info))) + 'lob))) + (rep (org-fill-template + org-babel-exp-call-line-template + `(("line" . ,(nth 0 lob-info)))))) (if inlinep (save-excursion (goto-char inline-start) diff --git a/testing/examples/babel.org b/testing/examples/babel.org index bc334f487..bfa366f33 100644 --- a/testing/examples/babel.org +++ b/testing/examples/babel.org @@ -334,3 +334,9 @@ Fifth #+begin_src emacs-lisp (push 5 *evaluation-collector*) #+end_src +* exporting more than just results from a call line + :PROPERTIES: + :ID: bec63a04-491e-4caa-97f5-108f3020365c + :END: +Here is a call line with more than just the results exported. +#+call: double(8) diff --git a/testing/lisp/test-ob-exp.el b/testing/lisp/test-ob-exp.el index 7ff7c4b93..8cdfba4fe 100644 --- a/testing/lisp/test-ob-exp.el +++ b/testing/lisp/test-ob-exp.el @@ -231,6 +231,15 @@ elements in the final html." (org-export-as-ascii nil nil nil 'string) (should (equal '(5 4 3 2 1) *evaluation-collector*))))) +(ert-deftest ob-exp/export-call-line-information () + (org-test-at-id "bec63a04-491e-4caa-97f5-108f3020365c" + (org-narrow-to-subtree) + (let* ((org-babel-exp-call-line-template "\n: call: %line special-token") + (html (org-export-as-html nil nil nil 'string t))) + (should (string-match "double" html)) + (should (string-match "16" html)) + (should (string-match "special-token" html))))) + (provide 'test-ob-exp) ;;; test-ob-exp.el ends here