When exporting svg, if an image file name contains a "&", it
will be escaped as "&" following html encoding. But when then asked
to embed the png into the svg for export, the file won't be found with
the sequence escaped. The solution is to unescape (using
html.parser.unescape) the line before extracting the png url.
PNG came out wrong because of concurrency (?) issues where the SVG file
was converted before being fully generated. The solution was to close
the temporary file between each operation.
tempfile.NamedTemporaryFile() creates **and opens** the file.
jinja2.stream().dump() will try to open the file too, if given a str
(filename). This does not cause issue on Linux, but on Windows the same
file cannot be open twice at the same time...
The solution was to pass a file pointer to 'dump()' instead of the
filename, so jinja2 does not need to open it again.
This submodule will handle saving the outfile to whatever format you
want.
For now, it can save in svg (default), png using inkscape, png, pdf or
ps using cairosvg.