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

Lack of float support for right-aligned SVG figures in HTML documents (maybe a missing CSS class) #3371

Closed
jilljenn opened this issue Jan 29, 2017 · 2 comments

Comments

@jilljenn
Copy link

Subject: Lack of float support for right-aligned SVG figures in HTML documents (maybe a missing CSS class)

Problem

  • Whenever I have a right-aligned SVG figure in my HTML document, it lacks the float: right property, allowing text to flow around the figure.

Procedure to reproduce the problem

.. figure:: /_static/riken.gif
   :align: right

(Some text)

.. image:: /_static/pix.svg
   :align: right

(Some text)

Error logs / results

Yields the following layout (PIX is the SVG image).
sphinx

The corresponding HTML for the GIF:

<div class="figure align-right">
  <img alt="_images/riken.gif" src="_images/riken.gif">
</div>

And for the SVG:

<div align="right" class="align-right">
  <img alt="_images/pix.svg" src="_images/pix.svg">
</div>

So, the figure class seems missing.

Expected results

The SVG figure should be in a float: right environment, as the GIF figure.

Reproducible project / your project

  • The code above. Sorry, I wanted to fix it myself, but I didn't find out where you added the figure class.

Environment info

  • OS: Mac OS 10.11.6
  • Python version: 3.6
  • Sphinx version: 1.5.2
@tk0miya
Copy link
Member

tk0miya commented Jan 31, 2017

It seems you're using image directive for SVG image. Please use figure directive instead.

.. image:: /_static/pix.svg
   :align: right

Then you'll see right-aligned SVG image.

Input:

Image directive for SVG
-----------------------

.. image:: logo.svg
   :align: right

text text text text text text text text text text text text text text text text text text
text text text text text text text text text text text text text text text text text text
text text text text text text text text text text text text text text text text text text
text text text text text text text text text text text text text text text text text text

Figure directive for SVG
------------------------

.. figure:: logo.svg
   :align: right

text text text text text text text text text text text text text text text text text text
text text text text text text text text text text text text text text text text text text
text text text text text text text text text text text text text text text text text text
text text text text text text text text text text text text text text text text text text

Output:
2017-01-31 11 44 02

@tk0miya
Copy link
Member

tk0miya commented Feb 11, 2017

Now I close this because it's not a bug.
Please reopen if you still have same problem.

Thanks,

@tk0miya tk0miya closed this as completed Feb 11, 2017
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants