pandoc / lua-filters

A collection of lua filters for pandoc
MIT License
602 stars 165 forks source link

Support diagram-generator for tikz when inkscape installed as snap #230

Closed a2k42 closed 1 year ago

a2k42 commented 2 years ago
Operating System: Ubuntu 22.04 LTS                
Kernel: Linux 5.15.0-30-generic
pandoc 2.18
TeX 3.141592653 (TeX Live 2022)
Inkscape 1.1.2 (08b2f3d93c, 2022-04-05)  !!! Installed as Snap

After much debugging I discovered that the below error was being caused by Inkscape being unable to read files in the /tmp directory when installed as a snap. I checked with Firefox and had the same trouble. Unfortunately with Ubuntu 22.04, snap installations are the default.

As far as resolving the issue from the diagram-generator.lua perspective, perhaps a helpful error message might be more useful than trying to solve an OS problem?

I am going to try and find some suitable workarounds for the moment, suggestions welcome.

Related: Firefox Quantum installed but doesn't see internal or external storage drives

Reproduction

Install Inkscape as a Snap and process the diagram-generator/sample.md with make test

I/O Error: Couldn't open file '/tmp/tikz2image-76c32015dfdd72fc/tikz-image.pdf': No such file or directory.
** Message: 21:20:06.663: couldn't open the PDF file.

** (org.inkscape.Inkscape:83371): WARNING **: 21:20:06.669: Can't open file: /tmp/tikz2image-76c32015dfdd72fc/tikz-image.pdf (doesn't exist)
ink_file_open: '/tmp/tikz2image-76c32015dfdd72fc/tikz-image.pdf' cannot be opened!
InkscapeApplication::document_open: Failed to open: /tmp/tikz2image-76c32015dfdd72fc/tikz-image.pdf
ConcreteInkscapeApplication::on_open: failed to create document!
Warning
no image data has been returned.
Error running filter my-tikz.lua:
my-tikz.lua:181: Image conversion failed. Aborting.
stack traceback:
        my-tikz.lua:181: in function 'CodeBlock'
a2k42 commented 2 years ago

For the moment I've added a ~/tmp folder and then exported it in my .bashrc

export TMPDIR="$HOME/tmp"
tarleb commented 1 year ago

Apologies for the late reply, see #207 for some of the reasons for this delay.

The diagram generator is now maintained at https://github.com/pandoc-ext/diagram. Please feel free to re-raise the issue there.