Skip to content

Instantly share code, notes, and snippets.

@jbrains
Forked from anonymous/make-diagrams.sh
Created December 21, 2012 17:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbrains/4354193 to your computer and use it in GitHub Desktop.
Save jbrains/4354193 to your computer and use it in GitHub Desktop.
#!/bin/bash
download_yuml_image() {
local file="$1"
local output_directory="$2"
instructions=$(tr "\\n" "," < <(cat $file))
image_basename=$(basename $(echo $file | sed -E "s/(.+)\.yuml$/\1/"))
image_filename="${output_directory}/${image_basename}.png"
wget -O "$image_filename" "http://yuml.me/diagram/plain;dir:TB/class/$instructions"
gm convert ${image_filename} -units PixelsPerInch -density 96x96 'xc:white' -flatten ${image_filename}
}
for file in manuscript/diagrams/class/*.yuml; do
download_yuml_image "$file" "manuscript/images/Design"
done
@jbrains
Copy link
Author

jbrains commented Dec 21, 2012

It seems weird to strip off the path's extension first, then apply basename. I could do that backwards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment