aboutsummaryrefslogtreecommitdiff
path: root/bin/mermaid_cvt_svg
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2023-11-09 14:56:21 -0500
committerNick Mathewson <nickm@torproject.org>2023-11-09 16:42:47 -0500
commit729b79c61b9ac979563f34118add1d6b2ebd022f (patch)
treed43036e8ac5a5d77a0366f0135b8e356557f3100 /bin/mermaid_cvt_svg
parentb9ba76e22180aaf1a3c848c74e4019727f7375ec (diff)
downloadtorspec-729b79c61b9ac979563f34118add1d6b2ebd022f.tar.gz
torspec-729b79c61b9ac979563f34118add1d6b2ebd022f.zip
Make mmdc optional.
The build script now only uses mmdc and a temporary conditionally, and otherwise (for now) leaves mermaid blocks unformatted.
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
+
+
+