wrights-deck/glif2asy.sh

4 lines
504 B
Bash
Executable file

#!/bin/sh
sd -f m '</contour>(\n| )*<contour>' '^^' | sd -f m '(.|\n)+<contour>' '' | sd -f m '</contour>(.|\n)+' '' | sd '^ +' '' | sd -f m '<point x="(-?[0-9]+)" y="(-?[0-9]+)"/>\n<point x="(-?[0-9]+)" y="(-?[0-9]+)"/>\n' '..controls ($1,$2) and ($3,$4)..' | sd '<point x="(-?[0-9]+)" y="(-?[0-9]+)" type="curve".*/>' '($1,$2)' | sd -- '<point x="(-?[0-9]+)" y="(-?[0-9]+)" type="line" smooth="yes"/>' '---($1,$2)' | sd -- '<point x="(-?[0-9]+)" y="(-?[0-9]+)" type="line"/>' '--($1,$2)' | tr -d '\n'