mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-11-22 07:09:47 +00:00
lisp/ob-plantuml.el: Insert results in buffer
When :results header arg is set to a value that doesn't include "file", insert txt output in buffer below src block. TINYCHANGE
This commit is contained in:
parent
a0b21e3f1c
commit
9cc60dee48
@ -343,6 +343,13 @@ files that are exported to Texinfo.
|
|||||||
|
|
||||||
=org-at-heading-p= now returns t by default on headings inside folds.
|
=org-at-heading-p= now returns t by default on headings inside folds.
|
||||||
Passing optional argument will produce the old behaviour.
|
Passing optional argument will produce the old behaviour.
|
||||||
|
|
||||||
|
*** =org-babel-execute:plantuml= can output ASCII graphs in the buffer
|
||||||
|
|
||||||
|
Previously, executing PlantUML src blocks always exported to a file. Now, if
|
||||||
|
:results is set to a value which does not include "file", no file will be
|
||||||
|
exported and an ASCII graph will be inserted below the src block.
|
||||||
|
|
||||||
** Removed or renamed functions and variables
|
** Removed or renamed functions and variables
|
||||||
*** =org-plantump-executable-args= is renamed and applies to jar as well
|
*** =org-plantump-executable-args= is renamed and applies to jar as well
|
||||||
|
|
||||||
|
@ -109,8 +109,11 @@ If BODY does not contain @startXXX ... @endXXX clauses, @startuml
|
|||||||
(defun org-babel-execute:plantuml (body params)
|
(defun org-babel-execute:plantuml (body params)
|
||||||
"Execute a block of plantuml code with org-babel.
|
"Execute a block of plantuml code with org-babel.
|
||||||
This function is called by `org-babel-execute-src-block'."
|
This function is called by `org-babel-execute-src-block'."
|
||||||
(let* ((out-file (or (cdr (assq :file params))
|
(let* ((do-export (member "file" (cdr (assq :result-params params))))
|
||||||
(error "PlantUML requires a \":file\" header argument")))
|
(out-file (if do-export
|
||||||
|
(or (cdr (assq :file params))
|
||||||
|
(error "No :file provided but :results set to file. For plain text output, set :results to verbatim"))
|
||||||
|
(org-babel-temp-file "plantuml-" ".txt")))
|
||||||
(cmdline (cdr (assq :cmdline params)))
|
(cmdline (cdr (assq :cmdline params)))
|
||||||
(in-file (org-babel-temp-file "plantuml-"))
|
(in-file (org-babel-temp-file "plantuml-"))
|
||||||
(java (or (cdr (assq :java params)) ""))
|
(java (or (cdr (assq :java params)) ""))
|
||||||
@ -155,7 +158,10 @@ This function is called by `org-babel-execute-src-block'."
|
|||||||
(if (and (string= (file-name-extension out-file) "svg")
|
(if (and (string= (file-name-extension out-file) "svg")
|
||||||
org-babel-plantuml-svg-text-to-path)
|
org-babel-plantuml-svg-text-to-path)
|
||||||
(org-babel-eval (format "inkscape %s -T -l %s" out-file out-file) ""))
|
(org-babel-eval (format "inkscape %s -T -l %s" out-file out-file) ""))
|
||||||
nil)) ;; signal that output has already been written to file
|
(unless do-export (with-temp-buffer
|
||||||
|
(insert-file-contents out-file)
|
||||||
|
(buffer-substring-no-properties
|
||||||
|
(point-min) (point-max))))))
|
||||||
|
|
||||||
(defun org-babel-prep-session:plantuml (_session _params)
|
(defun org-babel-prep-session:plantuml (_session _params)
|
||||||
"Return an error because plantuml does not support sessions."
|
"Return an error because plantuml does not support sessions."
|
||||||
|
Loading…
Reference in New Issue
Block a user