diff options
Diffstat (limited to 'lisp/org/ob-plantuml.el')
-rw-r--r-- | lisp/org/ob-plantuml.el | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lisp/org/ob-plantuml.el b/lisp/org/ob-plantuml.el index 91229a29497..09c9a333463 100644 --- a/lisp/org/ob-plantuml.el +++ b/lisp/org/ob-plantuml.el @@ -60,16 +60,19 @@ are expected to be scalar variables." (defun org-babel-plantuml-make-body (body params) "Return PlantUML input string. + BODY is the content of the source block and PARAMS is a property list of source block parameters. This function relies on the `org-babel-expand-body:generic' function to extract `:var' entries from PARAMS and on the `org-babel-variable-assignments:plantuml' -function to convert variables to PlantUML assignments." - (concat - "@startuml\n" - (org-babel-expand-body:generic - body params (org-babel-variable-assignments:plantuml params)) - "\n@enduml")) +function to convert variables to PlantUML assignments. + +If BODY does not contain @startXXX ... @endXXX clauses, @startuml +... @enduml will be added." + (let ((assignments (org-babel-variable-assignments:plantuml params))) + (if (string-prefix-p "@start" body t) assignments + (format "@startuml\n%s\n@enduml" + (org-babel-expand-body:generic body params assignments))))) (defun org-babel-execute:plantuml (body params) "Execute a block of plantuml code with org-babel. @@ -93,6 +96,8 @@ This function is called by `org-babel-execute-src-block'." " -teps" "") (if (string= (file-name-extension out-file) "pdf") " -tpdf" "") + (if (string= (file-name-extension out-file) "tex") + " -tlatex" "") (if (string= (file-name-extension out-file) "vdx") " -tvdx" "") (if (string= (file-name-extension out-file) "xmi") |