convert-ascii-to-svg.sh 716 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env bash
  2. # Convert .bob and .msc files in docs/art to .svg files located where the
  3. # site build will find them.
  4. set -e
  5. cd "$(dirname "$0")"
  6. output_dir=static/img
  7. svgbob_cli="$(command -v svgbob_cli || true)"
  8. if [[ -z "$svgbob_cli" ]]; then
  9. svgbob_cli="$(command -v svgbob || true)"
  10. [[ -n "$svgbob_cli" ]] || ( echo "svgbob_cli binary not found" && exit 1 )
  11. fi
  12. mkdir -p "$output_dir"
  13. while read -r bob_file; do
  14. out_file=$(basename "${bob_file%.*}".svg)
  15. "$svgbob_cli" "$bob_file" --output "$output_dir/$out_file"
  16. done < <(find art/*.bob)
  17. while read -r msc_file; do
  18. out_file=$(basename "${msc_file%.*}".png)
  19. mscgen -T png -o "$output_dir/$out_file" -i "$msc_file"
  20. done < <(find art/*.msc)