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

:name: does not creating a proper label inside figure or code-block #1742

Closed
Jellby opened this issue Feb 25, 2015 · 4 comments
Closed

:name: does not creating a proper label inside figure or code-block #1742

Jellby opened this issue Feb 25, 2015 · 4 comments
Assignees
Milestone

Comments

@Jellby
Copy link
Contributor

Jellby commented Feb 25, 2015

Sample document:

Float Test
==========

.. table:: Table caption
   :name: my_table

   === === ===
   1   2   3
   4   5   6
   === === ===

.. figure:: acrolein.*
   :name: my_figure

   Foo

.. code-block::
   :name: my_block

   Foo

References to :ref:`my_table`, :ref:`my_figure`, :ref:`my_block`.

The :name: option works fine in the table. In the code-block it's not accepted, and in the figure it has two problems:

  1. It does not generate a sphinx label, so :ref:my_figure`` does not work.

  2. The generated HTML assigns the id to the <img> rather than to the <div>:

     <div class="figure" id="id1">
     <img alt="_images/acrolein.png" id="my-figure" src="_images/acrolein.png" />
     <p class="caption">...</p>
     </div>
    
@shimizukawa
Copy link
Member

Thanks! I'll take a look.

@shimizukawa shimizukawa self-assigned this Feb 28, 2015
shimizukawa added a commit to shimizukawa/sphinx that referenced this issue Mar 8, 2015
…e-block` and `literalinclude` dirctives.
shimizukawa added a commit to shimizukawa/sphinx that referenced this issue Mar 8, 2015
…e-block` and `literalinclude` dirctives.
shimizukawa added a commit to shimizukawa/sphinx that referenced this issue Mar 8, 2015
…e-block` and `literalinclude` dirctives.
shimizukawa added a commit to shimizukawa/sphinx that referenced this issue Mar 8, 2015
shimizukawa added a commit to shimizukawa/sphinx that referenced this issue Mar 8, 2015
…e-block` and `literalinclude` dirctives.
shimizukawa added a commit to shimizukawa/sphinx that referenced this issue Mar 8, 2015
shimizukawa added a commit to shimizukawa/sphinx that referenced this issue Mar 8, 2015
@shimizukawa
Copy link
Member

Now, code-block and literalinclude support :name: option. And them and figure name can be referenced from :ref: role.

The generated HTML assigns the id to the <img> rather than to the <div>

It's a specification of docutils. We'll keep compatibility.

@shimizukawa shimizukawa added this to the 1.3 milestone Mar 8, 2015
@Jellby
Copy link
Contributor Author

Jellby commented Mar 9, 2015

Thanks. About the '':name:'' in ''figure'', where is it specified in docutils? Maybe I can report it for them to change it...

@shimizukawa
Copy link
Member

@Jellby Ah, "implementation" is better than "specification". I can't find any documentation for the behavior.

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