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

numref not working with download in only block #2143

Closed
andreacassioli opened this issue Nov 30, 2015 · 2 comments
Closed

numref not working with download in only block #2143

andreacassioli opened this issue Nov 30, 2015 · 2 comments

Comments

@andreacassioli
Copy link

Hi,
I am trying to show code blocks with a link to the file for download in the block caption. The link should only appears in html. So I do

.. only:: html

   .. literalinclude:: my_file
      :caption: title :download:`click<filelink>`
      :name: code

.. only:: latex

   .. literalinclude:: my_file
      :caption: title
      :name: code

The code and the download link are displayed correctly, but if I try to refer to the block with


:numref:`code`

the link is broken. Any clue?

@andreacassioli
Copy link
Author

OK, it seems not to be related with download, so I close the issue and make a new one.

@tk0miya
Copy link
Member

tk0miya commented Dec 2, 2015

In this case, you'd got a following warning on building docs:

WARNING: Duplicate explicit target name: "code".

The message was raised at second literalinclude.
because the only directive did not remove first literalinclude block. but It made the block invisible (still exists).

so the :numref: role refers the invisible one and the generated document looks like broken.
It seems a little strange, but it is a current specification. (see also #1717, #1488)

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

No branches or pull requests

2 participants