From b2d4caaaddca220d1534a73567a68c1c3c69be7f Mon Sep 17 00:00:00 2001 From: Ben Edgington Date: Thu, 10 Jul 2025 01:14:14 +0100 Subject: [PATCH] Build: comment and tidy --- bin/util/drawio2svg.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/util/drawio2svg.sh b/bin/util/drawio2svg.sh index 083fdea..e957c48 100755 --- a/bin/util/drawio2svg.sh +++ b/bin/util/drawio2svg.sh @@ -4,6 +4,7 @@ # # A drawio file can have multiple diagrams/tabs/pages. We extract them individually and # make an SVG filename that includes the drawio basename and the diagram's tab name. +# The SVG files are written to the current working directory. if [ -z "$1" ]; then echo "Usage: $0 " @@ -17,6 +18,10 @@ if [[ $drawio_file != *.drawio ]]; then exit 1 fi +# Note that (as of 27.0.9 anyway) this doesn't work, and neither does --disable-update +export DRAWIO_DISABLE_UPDATE=true + +drawio=/usr/bin/drawio drawio_opts="-b 10 --svg-theme light" root=$(basename -s '.drawio' $drawio_file) @@ -24,13 +29,13 @@ names=$(grep -oP ']*name="\K[^"]+' $drawio_file) # If there is only one tab, we don't need to rename or page count if [[ $(echo $names | wc -w) == 1 ]]; then - drawio -x $drawio_opts -o $root.svg $drawio_file + $drawio $drawio_opts -x -o $names.svg $drawio_file exit 0 fi # Loop over the diagrams and convert them individually n=1 for name in $names; do - drawio -x -p $n $drawio_opts -o $root-$name.svg $drawio_file + $drawio $drawio_opts -x -p $n -o $root-$name.svg $drawio_file ((n++)) done