numpydoc
numpydoc copied to clipboard
References before the first section of a file are mangled
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.
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
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.