Commit Graph

13 Commits (18a4b6674e816fbac25ffb4b9d45a1928f04d6fb)

Author SHA1 Message Date
Lertsenem e23294fd06 Remove generate_outfile function 2021-07-03 20:18:51 +02:00
Lertsenem 53429428e9 Fix bug with special chars in filenames
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.
2021-01-27 00:58:56 +01:00
Lertsenem 6bc8e8c9e3 Add new export-options and svg_embed_png option
New set of options to tweak the export, and the first one: a way to
embed PNG images inside the resulting SVG file.
2021-01-06 09:33:36 +01:00
Lertsenem cd9c201191 Add export function 'generate_pic()' 2020-12-20 19:25:21 +01:00
Lertsenem f35d467a40 Fix export issue
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.
2020-09-02 09:09:35 +02:00
Niels Giorno e5907ad380 Fix jinja2 dump in temporary file for Windows
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.
2020-08-28 12:53:46 +02:00
Niels Giorno 01f90de9c2 Fix export when cairosvg module is not found
If not found, the program should not try to export the image using it
anyway.
2020-08-28 12:52:53 +02:00
Niels Giorno deb2e031a1 Fix temporary file suffix svg -> .svg 2020-08-28 12:51:49 +02:00
Lertsenem cadb53e3b4 Add context debug in export 2020-07-25 14:51:04 +02:00
Lertsenem f807cf9c6f Fix str-to-pathlib conversion issues 2020-07-22 20:29:23 +02:00
Lertsenem 9b2388973c Add cachedir argument for export function
Use system-specific user cache directory thanks to appdirs
2020-07-22 18:07:52 +02:00
Lertsenem 2e7dfe4bec Remove tmp svg file for inkscape export 2020-07-16 22:22:25 +02:00
Lertsenem 1272a64d54 Add export submodule to handle output
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.
2020-07-09 14:31:22 +02:00