Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension should only run on LaTeX builder #8

Closed
Daltz333 opened this issue May 7, 2020 · 15 comments
Closed

Extension should only run on LaTeX builder #8

Daltz333 opened this issue May 7, 2020 · 15 comments

Comments

@Daltz333
Copy link

Daltz333 commented May 7, 2020

The extension currently runs on all builders, HTML, Gettext, Linkcheck, etc.

@sephalon
Copy link
Collaborator

The SVG to PDF converters are based on the Sphinx ImageConverter class that is only invoked if the builder does not support the image type. So this should not happen – could you please elaborate a bit more on what exactly you see?

@Daltz333
Copy link
Author

There was a bug in upstream imgconverter where it would run is_available in all builders. This has been fixed and will be published in Sphinx 3.1.0

@Daltz333
Copy link
Author

Daltz333 commented Jun 23, 2020

Reopening as this issue is still present in sphinx-build -b html. rsvg-convert should only run in the latexpdf builder

@sephalon
Copy link
Collaborator

sphinx-doc/sphinx#7978 has been merged by now. Does it solve the issue for you?

@Daltz333
Copy link
Author

No. All that issue does is prevent it from running many times on those builders. This extension still runs on all builders.

sephalon pushed a commit to sephalon/sphinx that referenced this issue Jan 4, 2021
Close sphinx-doc#7973: ImgConverter runs is_available in HTML builder
Close missinglinkelectronics/sphinxcontrib-svg2pdfconverter#8: Extension should only run on LaTeX builder
@sephalon
Copy link
Collaborator

sephalon commented Jan 4, 2021

sphinx-doc/sphinx#8649 should finally fix this issue. Closed.

@mgeier
Copy link

mgeier commented Apr 29, 2021

I'm still getting an error, is this really solved?

See spatialaudio/nbsphinx#559 for details.

@Daltz333
Copy link
Author

Works for me. That error you have looks like it's having an issue running rsvg-convert. Try running it by hand and verifying it works.

@mgeier
Copy link

mgeier commented Apr 29, 2021

Thanks for the quick answer @Daltz333!
I was expecting that rsvg-convert wouldn't be called at all when not needed, isn't that so?

I'm only generating HTML in the linked issue, so I would expect that rsvg-convert is not needed and doesn't have to be called.

I have intentionally not installed it for this situation.

@Daltz333
Copy link
Author

Hm, are you using a custom builder to the standard HTML builder?

@mgeier
Copy link

mgeier commented Apr 29, 2021

Well I'm using some custom nodes and quite a few suspicious hacks in nbsphinx, but I think I'm using the standard HTML builder.

@Daltz333
Copy link
Author

I attempted to build your documentation locally, but looks like it has several things line-endings related that prevents me (Windows) from building it.

This is the logic doing the skip

elif set(node['candidates']) & set(self.app.builder.supported_image_types):
            # builder supports the image; no need to convert
            return False

@mgeier
Copy link

mgeier commented Apr 29, 2021

I'm not changing anything regarding builder.supported_image_types, at least not knowingly.

looks like it has several things line-endings related that prevents me (Windows) from building it.

It would be great if you could create an issue for this!
I'd like to make it work on Windows, but I'm not a user myself ...

@mgeier
Copy link

mgeier commented Aug 8, 2021

@Daltz333 I looked into this again and I made a minimal reproducible example: https://github.com/mgeier/rsvgconverter-bug

At first I couldn't reproduce the problem, but then I found out that the error occurs when using a "data" URL instead of an image file, e.g.

.. image:: data:image/png;base64,....

I've added this to my test repo: mgeier/rsvgconverter-bug@82379d1.

Here's a failing test: https://github.com/mgeier/rsvgconverter-bug/runs/3274422618

Any idea how to fix this?

@mgeier
Copy link

mgeier commented Jan 9, 2022

I've created a Sphinx issue for this: sphinx-doc/sphinx#10073.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants