mirror of
https://github.com/vale981/emacs-jupyter
synced 2025-03-05 07:41:37 -05:00
jupyter-org--wrap-result-maybe: Use cond
This commit is contained in:
parent
87bd83c99b
commit
44e3823a93
1 changed files with 15 additions and 14 deletions
|
@ -1130,19 +1130,20 @@ appear after the element."
|
|||
|
||||
(defun jupyter-org--wrap-result-maybe (context result)
|
||||
"Depending on CONTEXT, wrap RESULT in a drawer."
|
||||
;; If a keyword is the context, this is the first result.
|
||||
(if (eq (org-element-type context) 'keyword)
|
||||
(cond
|
||||
((eq (org-element-type context) 'keyword)
|
||||
;; Only wrap the result if it can't be removed by `org-babel'.
|
||||
(if (jupyter-org-babel-result-p result) result
|
||||
(jupyter-org-results-drawer result))
|
||||
(if (jupyter-org--wrappable-element-p context)
|
||||
(jupyter-org-results-drawer result)))
|
||||
((jupyter-org--wrappable-element-p context)
|
||||
(prog1 (jupyter-org-results-drawer context result)
|
||||
;; Ensure that a #+RESULTS: line is not prepended to context
|
||||
;; when calling `org-element-interpret-data'.
|
||||
;; Ensure that a #+RESULTS: line is not prepended to context when calling
|
||||
;; `org-element-interpret-data'.
|
||||
(org-element-put-property context :results nil)
|
||||
;; Ensure there is no post-blank since
|
||||
;; `org-element-interpret-data' already normalizes the string.
|
||||
(org-element-put-property context :post-blank nil))
|
||||
;; Ensure there is no post-blank since `org-element-interpret-data'
|
||||
;; already normalizes the string.
|
||||
(org-element-put-property context :post-blank nil)))
|
||||
(t
|
||||
result)))
|
||||
|
||||
;;;; Stream results
|
||||
|
|
Loading…
Add table
Reference in a new issue