logseq-publish-excalidraw-t.../to_svg.sh

8 lines
539 B
Bash
Raw Permalink Normal View History

2023-10-13 21:12:11 +00:00
#!/usr/bin/env bash
2023-10-16 17:29:03 +00:00
EXCALIDRAW="$(jq '{"type": .type, "version": .version, "source": .source, "elements": .elements, "appState": {"gridSize": null, "exportWithDarkMode": '"$2"'}}' "$1")"
ENCODED="$(echo $EXCALIDRAW | python -c "import sys; import base64; import zlib; print(base64.urlsafe_b64encode(zlib.compress(sys.stdin.read().encode('utf-8'), 9)).decode('ascii'))")"
echo ::debug::'$ENCODED' "$ENCODED"
docker ps
2023-10-18 13:20:51 +00:00
mkdir -p "svg-repo/svg-assets/$(dirname $1)"
curl "localhost:8080/excalidraw/svg/$ENCODED" > "svg-repo/svg-assets/$1.svg"