generate.sh 947 B

123456789101112131415161718192021222324252627282930313233
  1. # Copyright John Maddock 2008.
  2. # Use, modification and distribution are subject to the
  3. # Boost Software License, Version 1.0. (See accompanying file
  4. # LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. #
  6. # Generates SVG and PNG files from the MML masters.
  7. #
  8. # Paths to tools come first, change these to match your system:
  9. #
  10. math2svg='m:\download\open\SVGMath-0.3.1\math2svg.py'
  11. python=/cygdrive/c/Python26/python.exe
  12. inkscape=/cygdrive/c/progra~1/Inkscape/inkscape
  13. # Image DPI:
  14. dpi=120
  15. for mmlfile in $*; do
  16. svgfile=$(basename $mmlfile .mml).svg
  17. pngfile=$(basename $svgfile .svg).png
  18. tempfile=temp.mml
  19. # strip html wrappers put in by MathCast:
  20. cat $mmlfile | tr -d "\r\n" | sed -e 's/.*\(<math[^>]*>.*<\/math>\).*/\1/' > $tempfile
  21. echo Generating $svgfile
  22. $python $math2svg $tempfile > $svgfile
  23. echo Generating $pngfile
  24. $inkscape -d $dpi -e $(cygpath -a -w $pngfile) $(cygpath -a -w $svgfile)
  25. rm $tempfile
  26. done