• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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#
10math2svg='d:\download\open\SVGMath-0.3.3\math2svg.py'
11python='/cygdrive/c/Python27/python.exe'
12inkscape='/cygdrive/c/Program Files/Inkscape/inkscape.exe'
13# Image DPI:
14dpi=120
15
16for mmlfile in $*; do
17	svgfile=$(basename $mmlfile .mml).svg
18	pngfile=$(basename $svgfile .svg).png
19	tempfile=temp.mml
20	# strip html wrappers put in by MathCast:
21	cat $mmlfile | tr -d "\r\n" | sed -e 's/.*\(<math[^>]*>.*<\/math>\).*/\1/' -e 's/<semantics>//g' -e 's/<\/semantics>//g' > $tempfile
22
23	echo Generating $svgfile
24	"$python" $math2svg $tempfile > $svgfile
25	echo Generating $pngfile
26	"$inkscape" -d $dpi -e $(cygpath -a -w $pngfile) $(cygpath -a -w $svgfile)
27	rm $tempfile
28done
29
30
31
32
33