aboutsummaryrefslogtreecommitdiff
path: root/bin/mermaid_cvt_svg
diff options
context:
space:
mode:
Diffstat (limited to 'bin/mermaid_cvt_svg')
-rwxr-xr-xbin/mermaid_cvt_svg15
1 files changed, 8 insertions, 7 deletions
diff --git a/bin/mermaid_cvt_svg b/bin/mermaid_cvt_svg
index 11aa596..3198a00 100755
--- a/bin/mermaid_cvt_svg
+++ b/bin/mermaid_cvt_svg
@@ -3,22 +3,23 @@
set -e -u -o pipefail -x
TOPLEVEL=$(realpath $(dirname "$0"))/..
+TMPDIR="$1"
: ${MMDC:=mmdc}
-# We can't use mktemp here, since we need the actual
-# path in build.html
-TMPDIR="${TOPLEVEL}/tmp_mermaid/"
-rm -rf "$TMPDIR"
-mkdir -p "${TOPLEVEL}/tmp_mermaid/"
+cd "$TOPLEVEL"
# We make a mirror of the specs, since we will need to make changes to them.
-cp -rl spec ./tmp_mermaid/spec
+cp -rl spec proposals mdbook "$TMPDIR"
+
# We use mermaid-cli to extract the mermaid from any file containing it,
# and generate a new version that uses svg instead.
-for fname in $(find ./tmp_mermaid -name "*.md") ; do
+for fname in $(find "$TMPDIR" -name "*.md") ; do
if grep '^```mermaid' $fname; then
ORIG="${fname%.md}.__orig.md"
mv $fname $ORIG
$MMDC -i $ORIG -o $fname
fi
done
+
+
+