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

code-block directive with same :caption: causes warning of duplicate target #2931

Closed
jason-s opened this issue Aug 31, 2016 · 3 comments
Closed

Comments

@jason-s
Copy link

jason-s commented Aug 31, 2016

test1.rst:

Yippee
======

+---------------------------------+------------------------------------+
| foo                             | bar                                |
+=================================+====================================+
| .. code-block:: c               | .. code-block:: c                  |
|    :caption: m2.h               |    :caption: m2.h                  |
|                                 |                                    |
|    blah blah blah foo           |    #include <stdint.h>             |
|                                 |    blah blah blah bar              |
+---------------------------------+------------------------------------+

I get this message: test1.rst:2: WARNING: Duplicate explicit target name: "m2.h".

If I change one of the m2.h's to m1.h, the warning goes away.

Looks like code-block is creating a target with the caption name, not sure why it is doing this.
Multiple code-blocks with the same caption should be allowed.

@jason-s
Copy link
Author

jason-s commented Aug 31, 2016

Looks like if I specify a :name: argument then I can prevent the warning.

Yippee
======

+---------------------------------+------------------------------------+
| foo                             | bar                                |
+=================================+====================================+
| .. code-block:: c               | .. code-block:: c                  |
|    :caption: m2.h               |    :caption: m2.h                  |
|    :name: m2_foo                |    :name: m2_bar                   |
|                                 |                                    |
|    blah blah blah foo           |    #include <stdint.h>             |
|                                 |    blah blah blah bar              |
+---------------------------------+------------------------------------+

@tk0miya
Copy link
Member

tk0miya commented Sep 1, 2016

Sorry for inconvenience. It's bug of Sphinx.

Note: This comes from #1742. It diverts caption option to name if name not given.

@tk0miya tk0miya added this to the 1.4.7 milestone Sep 1, 2016
tk0miya added a commit that referenced this issue Sep 17, 2016
@tk0miya
Copy link
Member

tk0miya commented Sep 17, 2016

Fixed at 82c153f (stable).
It will be released as 1.4.7.

Thank you for reporting!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 4, 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