From 75035915a9722920e2194bcd8f07ec5cf2f97bf7 Mon Sep 17 00:00:00 2001 From: Nick Daly Date: Tue, 13 Apr 2021 21:18:41 -0500 Subject: [PATCH] Add PlantUML SVG to Path. * lisp/ob-plantuml.el (org-babel-execute:plantuml): Add SVG-specific post-export step that, when enabled, runs inkscape text-to-path replacement over the output file. Enabled with new custom variable `org-babel-plantuml-svg-text-to-path'. --- lisp/ob-plantuml.el | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lisp/ob-plantuml.el b/lisp/ob-plantuml.el index 93c653870..ee781290c 100644 --- a/lisp/ob-plantuml.el +++ b/lisp/ob-plantuml.el @@ -71,6 +71,12 @@ You can also configure extra arguments via `org-plantuml-executable-args'." :package-version '(Org . "9.4") :type '(repeat string)) +(defcustom org-babel-plantuml-svg-text-to-path 'nil + "When set, export text in SVG images to paths using Inkscape." + :group 'org-babel + :version "24.1" + :type 'boolean) + (defun org-babel-variable-assignments:plantuml (params) "Return a list of PlantUML statements assigning the block's variables. PARAMS is a property list of source block parameters, which may @@ -145,6 +151,10 @@ This function is called by `org-babel-execute-src-block'." " "))) (with-temp-file in-file (insert full-body)) (message "%s" cmd) (org-babel-eval cmd "") + (org-babel-plantuml-post-process out-file) + (if (and (string= (file-name-extension out-file) "svg") + org-babel-plantuml-svg-text-to-path) + (org-babel-eval (format "inkscape %s -T -l %s" out-file out-file) "")) nil)) ;; signal that output has already been written to file (defun org-babel-prep-session:plantuml (_session _params) -- 2.20.1