forked from mirrors/org-mode
ob-plantuml: Allow different @start-/@end clauses
* lisp/ob-plantuml (org-babel-plantuml-make-body) Do not insert @startuml and @enduml if body already starts with "@start". PlantUML supports non-UML diagrams that have to be enclosed with @startgantt/@endgantt for example. The code for these diagrams can contain the proper clauses without being enclosed additionally with @startuml/@enduml.
This commit is contained in:
parent
c7bce7a986
commit
4e854974be
|
@ -60,16 +60,19 @@ are expected to be scalar variables."
|
||||||
|
|
||||||
(defun org-babel-plantuml-make-body (body params)
|
(defun org-babel-plantuml-make-body (body params)
|
||||||
"Return PlantUML input string.
|
"Return PlantUML input string.
|
||||||
|
|
||||||
BODY is the content of the source block and PARAMS is a property list
|
BODY is the content of the source block and PARAMS is a property list
|
||||||
of source block parameters. This function relies on the
|
of source block parameters. This function relies on the
|
||||||
`org-babel-expand-body:generic' function to extract `:var' entries
|
`org-babel-expand-body:generic' function to extract `:var' entries
|
||||||
from PARAMS and on the `org-babel-variable-assignments:plantuml'
|
from PARAMS and on the `org-babel-variable-assignments:plantuml'
|
||||||
function to convert variables to PlantUML assignments."
|
function to convert variables to PlantUML assignments.
|
||||||
(concat
|
|
||||||
"@startuml\n"
|
If BODY does not contain @startXXX ... @endXXX clauses, @startuml
|
||||||
(org-babel-expand-body:generic
|
... @enduml will be added."
|
||||||
body params (org-babel-variable-assignments:plantuml params))
|
(let ((assignments (org-babel-variable-assignments:plantuml params)))
|
||||||
"\n@enduml"))
|
(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)
|
(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.
|
||||||
|
|
Loading…
Reference in a new issue