From: Henrik Koschitzki <h.koschitzki@mailbox.org>
To: emacs-orgmode@gnu.org
Subject: [PATCH] ob-plantuml.el support for non-UML diagrams
Date: Thu, 1 Aug 2019 15:57:24 +0200 (CEST) [thread overview]
Message-ID: <893890293.19079.1564667844201@office.mailbox.org> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 592 bytes --]
Hello,
ob-plantuml encloses the body of PlantUML ( http://plantuml.com) diagram code with @startuml/@enduml clauses. Recent versions of PlantUML support non-UML diagrams like gantt, mindmap and others that needs to be enclosed with @startgantt/@endgantt and @startmindmap/@endmindmap clauses.
I created a patch that only inserts @startuml and @enduml if the body does not already starts with the string "@start". This patch allows the execution of existing UML diagrams without @startuml/@enduml as well as non-UML diagrams that contain any @start-/@end- clause.
Regards
Henrik Koschitzki
[-- Attachment #1.2: Type: text/html, Size: 899 bytes --]
[-- Attachment #2: 0001-ob-plantuml-Allow-different-start-end-clauses.patch --]
[-- Type: application/octet-stream, Size: 1915 bytes --]
From befa6db98579956de3214865575f387358618204 Mon Sep 17 00:00:00 2001
From: Henrik Koschitzki <h.koschitzki@mailbox.org>
Date: Thu, 1 Aug 2019 15:03:55 +0200
Subject: [PATCH] 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 now contain the proper clauses without being enclosed
additionally with @startuml/@enduml.
---
lisp/ob-plantuml.el | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/lisp/ob-plantuml.el b/lisp/ob-plantuml.el
index 5d7b15903..b123313ab 100644
--- a/lisp/ob-plantuml.el
+++ b/lisp/ob-plantuml.el
@@ -64,12 +64,21 @@ 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 already contains @startXXX, @endXXX clauses,
+@startuml
+@enduml
+will be added."
+ (if (string-prefix-p "@start" body t)
+ (concat
+ (org-babel-expand-body:generic
+ body params (org-babel-variable-assignments:plantuml params)))
+ (concat
+ "@startuml\n"
+ (org-babel-expand-body:generic
+ body params (org-babel-variable-assignments:plantuml params))
+ "\n@enduml")))
(defun org-babel-execute:plantuml (body params)
"Execute a block of plantuml code with org-babel.
--
2.22.0.windows.1
next reply other threads:[~2019-08-01 13:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-01 13:57 Henrik Koschitzki [this message]
2019-08-01 15:18 ` [PATCH] ob-plantuml.el support for non-UML diagrams Fraga, Eric
2019-10-07 2:54 ` stardiviner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=893890293.19079.1564667844201@office.mailbox.org \
--to=h.koschitzki@mailbox.org \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).