emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] ob-plantuml.el support for non-UML diagrams
@ 2019-08-01 13:57 Henrik Koschitzki
  2019-08-01 15:18 ` Fraga, Eric
  2019-10-07  2:54 ` stardiviner
  0 siblings, 2 replies; 3+ messages in thread
From: Henrik Koschitzki @ 2019-08-01 13:57 UTC (permalink / raw)
  To: emacs-orgmode


[-- 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ob-plantuml.el support for non-UML diagrams
  2019-08-01 13:57 [PATCH] ob-plantuml.el support for non-UML diagrams Henrik Koschitzki
@ 2019-08-01 15:18 ` Fraga, Eric
  2019-10-07  2:54 ` stardiviner
  1 sibling, 0 replies; 3+ messages in thread
From: Fraga, Eric @ 2019-08-01 15:18 UTC (permalink / raw)
  To: Henrik Koschitzki; +Cc: emacs-orgmode@gnu.org

Thanks for this.  I've not tested but I appreciate the head's up on the
new features in plantuml!
-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.2.4-399-g4e6222

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ob-plantuml.el support for non-UML diagrams
  2019-08-01 13:57 [PATCH] ob-plantuml.el support for non-UML diagrams Henrik Koschitzki
  2019-08-01 15:18 ` Fraga, Eric
@ 2019-10-07  2:54 ` stardiviner
  1 sibling, 0 replies; 3+ messages in thread
From: stardiviner @ 2019-10-07  2:54 UTC (permalink / raw)
  To: emacs-orgmode


Sounds great, is it merged now?

Henrik Koschitzki <h.koschitzki@mailbox.org> writes:

> 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 


-- 
[ stardiviner ]
       I try to make every word tell the meaning what I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
      

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-07  2:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-01 13:57 [PATCH] ob-plantuml.el support for non-UML diagrams Henrik Koschitzki
2019-08-01 15:18 ` Fraga, Eric
2019-10-07  2:54 ` stardiviner

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).