From 340a2df114efeb3ef71b7b7c65f150bf30634bf5 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Thu, 22 Mar 2018 21:43:32 +0000
Subject: plantuml (22mar18)

git-svn-id: svn://tug.org/texlive/trunk@47076 c570f23f-e606-0410-a88d-b1316a301751
---
 .../texmf-dist/tex/lualatex/plantuml/plantuml.sty  | 74 +++++++++++++---------
 1 file changed, 43 insertions(+), 31 deletions(-)

(limited to 'Master/texmf-dist/tex/lualatex/plantuml/plantuml.sty')

diff --git a/Master/texmf-dist/tex/lualatex/plantuml/plantuml.sty b/Master/texmf-dist/tex/lualatex/plantuml/plantuml.sty
index 3f16671ea06..2fb13e34644 100644
--- a/Master/texmf-dist/tex/lualatex/plantuml/plantuml.sty
+++ b/Master/texmf-dist/tex/lualatex/plantuml/plantuml.sty
@@ -3,7 +3,7 @@
 %% SPDX-License-Identifier: LPPL-1.3c+
 \NeedsTeXFormat{LaTeX2e}\relax
 \ProvidesPackage{plantuml}
-  [2018/03/08 v0.1.0
+  [2018/03/21 v0.2.1
   Embed PlantUML diagrams in latex documents.]
 
 % Required by PlantUML LaTeX output
@@ -41,50 +41,62 @@
 \def\maxwidth#1{\ifdim\Gin@nat@width>#1 #1\else\Gin@nat@width\fi}
 \makeatother
 
+\ExplSyntaxOn
+\let\PlantUmlMode\l_plantuml_mode
+\ExplSyntaxOff
+
+\newcounter{PlantUmlFigureNumber}
+
 \ifluatex
-  \ExplSyntaxOn
-  \let\PlantUmlMode\l_plantuml_mode
-  \ExplSyntaxOff
   \RequirePackage{luacode}
-  \makeatletter
-  \ifcase\pdf@shellescape
-    \message{No shell escape. PlantUML cannot be called. Start lualatex with -shell-escape.}
-    \newenvironment{plantuml}{%
-      No shell escape. PlantUML cannot be called. Start lualatex with -shell-escape.
-    }{}
-  \or
+\else
+  \RequirePackage[usefamily=bash]{pythontex}
+\fi
+
+\makeatletter
+\ifcase\pdf@shellescape
+  \message{No shell escape. PlantUML cannot be called. Start pdflatex/lualatex with -shell-escape.}
+  \newenvironment{plantuml}{%
+    No shell escape. PlantUML cannot be called. Start pdflatex/lualatex with -shell-escape.
+  }{}
+\or
+  \ifluatex
     \directlua{
       local plantUmlJar = os.getenv("PLANTUML_JAR")
       if not plantUmlJar then
         texio.write_nl("Environment variable PLANTUML_JAR not set.")
       end
     }
-    \NewDocumentEnvironment{plantuml}{}{%
-      \VerbatimOut{\jobname-plantuml.txt}}
-    {%
-      \endVerbatimOut
+  \fi
+  \NewDocumentEnvironment{plantuml}{}{%
+    \VerbatimOut{\jobname-plantuml.txt}}
+  {%
+    \endVerbatimOut
+    \ifluatex
       \directlua{
         local jobname=\luastring{\jobname}
         local plantUmlMode=\luastring{\PlantUmlMode}
         require("plantuml.lua")
         convertPlantUmlToTikz(jobname, plantUmlMode)
       }
-      \ifthenelse{\equal{\PlantUmlMode}{latex}}{
-        \begin{adjustbox}{max width=\linewidth}
-          \input{\jobname-plantuml.latex}
-        \end{adjustbox}
-      }{
-        \includegraphics[width=\maxwidth{\textwidth}]{\jobname-plantuml.\PlantUmlMode}
-      }
+    \else
+      \stepcounter{PlantUmlFigureNumber}
+      %TODO: Execute pyhton here
+      \typeout{*** plantuml only works with lualatex ***}
+    \fi
+    \ifthenelse{\equal{\PlantUmlMode}{latex}}{
+      \begin{adjustbox}{max width=\linewidth}
+        \input{\jobname-plantuml.latex}
+      \end{adjustbox}
+    }{
+      \includegraphics[width=\maxwidth{\textwidth}]{\jobname-plantuml.\PlantUmlMode}
     }
-  \or
-    \message{Restricted shell escape. PlantUML cannot be called. Start lualatex with -shell-escape.}
-    \newenvironment{plantuml}{%
-      Restricted shell escape. PlantUML cannot be called. Start lualatex with -shell-escape.
-    }{}
-  \fi
-  \makeatother
-\else
-  \typeout{*** plantuml only works with lualatex ***}
+  }
+\or
+  \message{Restricted shell escape. PlantUML cannot be called. Start pdflatex/lualatex with -shell-escape.}
+  \newenvironment{plantuml}{%
+    Restricted shell escape. PlantUML cannot be called. Start pdflatex/lualatex with -shell-escape.
+  }{}
 \fi
+\makeatother
 
-- 
cgit v1.2.3

