Skip to content

References before the first section of a file are mangled #301

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

Open
CalebBell opened this issue Nov 1, 2020 · 1 comment
Open

References before the first section of a file are mangled #301

CalebBell opened this issue Nov 1, 2020 · 1 comment

Comments

@CalebBell
Copy link

Hello,
I found a similar issue to #214 which has already been fixed. I believe the trigger is when the reference appears before the first section of the document. The following image illustrates the problem, and I have modified the standalone example in #214 to show the new issue.

image

The test case is attached as: numpydoctest.zip
The command given to reproduce the error is
sphinx-build -b singlehtml -d _build/doctrees . _build/singlehtml

I checked out 0.9.2 and 0.8.0 as well, both have the still have the issue so I don't think this is a regression. I also checked the issue is reproducible on the latest master commit.

Sincerely,
Caleb

@rossbar
Copy link
Contributor

rossbar commented Nov 2, 2020

I think the problem stems from the fact that, in your example, the link that the reference is supposed to resolve to occurs outside of the References section. i.e. if you change:

# From your tmp.py
"""

Citation before the a section
[100]_

.. [100] Does not work at present on 1.2.dev0


References
----------
[1]_

.. [1] Works after a bugfix in 2019

"""

to:

"""

Citation before the a section
[100]_


References
----------
[1]_

.. [1] Works after a bugfix in 2019

.. [100] ref remapping should work 1.2.dev0

"""

then you should get the output you expect.

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

2 participants