mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-11-24 07:20:29 +00:00
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)
|
||||
"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.
|
||||
|
Loading…
Reference in New Issue
Block a user