mirror of
https://github.com/benjaminion/upgrading-ethereum-book.git
synced 2026-01-08 06:03:53 -05:00
Build: comment and tidy
This commit is contained in:
@@ -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 <drawio_file>"
|
||||
@@ -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 '<diagram[^>]*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
|
||||
|
||||
Reference in New Issue
Block a user