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

only process citations and citation_references with a 'bibtex' class #161

Closed

Conversation

chrisjsewell
Copy link
Contributor

Hey Matthias,

I see you have already considered this in #155,
well I have the answer :) You need to override sphinx.transforms.CitationReferences,
in order to propagate the cite_reference classes to pending_xref. I have just made a PR
to sphinx (sphinx-doc/sphinx#6147), to fix this upstream. But, for now, you'll see I've added
a modified copy of the transform, with a higher default priority.

FYI The reason that I come across this issue, is that I have been using your excellent package in my own
(see here)

@chrisjsewell
Copy link
Contributor Author

oops tests aren't parsing, I'll look into it. But I know it definitely does work in principle

@chrisjsewell
Copy link
Contributor Author

chrisjsewell commented Mar 8, 2019

Ok nearly there, its just test_citationnotfound that is failing now;
Sphinx is trying to convert the sphinx.addnodes.pending_xref to a docutils.nodes.Text,
which doesn't have class attributes.
So at some point in the code the bibtex class needs to be stripped from missing citations.
This appears to happen sometime before process_citation_references though

Note:
the test_sphinx assertions have been inverted, to test that there are no longer warnings about not relabelling [name]_ type references.

@coveralls
Copy link

coveralls commented Mar 8, 2019

Coverage Status

Coverage decreased (-0.8%) to 98.135% when pulling 30aa805 on chrisjsewell:add_cite_citeref_classes into 5abd972 on mcmtroffaes:develop.

@chrisjsewell
Copy link
Contributor Author

chrisjsewell commented Mar 8, 2019

Well that's all the tests parsed, only thing to note is that HandleMissingCitesTransform,
now basically replicates process_citation_references (I imagine that is where the decrease in coverage is coming from), so that can possibly be removed.

@chrisjsewell
Copy link
Contributor Author

chrisjsewell commented Mar 9, 2019

FYI sphinx-doc/sphinx#6147 has been merged into sphinx-doc 2.0 and
sphinx-doc/sphinx#6151 has also been merged there, to fix the missing references AssertionError

@mcmtroffaes
Copy link
Owner

Thanks so much Chris for your excellent work with the upstream sphinx devs! I rather prefer not to carry non-trivial workarounds for bugs that have been fixed upstream. It looks like your patch won't been backported to 1.8, so I suggest to release a new version, without your workarounds, but requiring sphinx 2.0, when it is released (I've seen 2.0 is due in a few weeks sphinx-doc/sphinx#5950 ).

@chrisjsewell
Copy link
Contributor Author

chrisjsewell commented Mar 12, 2019

requiring sphinx 2.0

Seems a shame to lock the dependency of sphinxcontrib-bibtex to this version of sphinx?

Anyway, as you'll see I've just made another PR #162 that at least allows the warnings to be suppressed.
This is really useful for testing purposes, so would be good if you could make a release for it
with the current sphinx 1.6 requirement :)

@chrisjsewell
Copy link
Contributor Author

The commit I just made, ensures that the patch is only applied when the sphinx version is less than 2.
But obviously it's up to you

@mcmtroffaes
Copy link
Owner

Just to note that I've now updated the repository for Sphinx 2.0. There are too many differences between Sphinx 1.x and 2.0 that I'm not planning to maintain support for both, so yes, Sphinx 2.0 will become a hard requirement for the next release. I'll merge this in due time (without 1.x workarounds). Thanks for your patience!

@mcmtroffaes
Copy link
Owner

Superseded by #171 - thanks again for your work on this, @chrisjsewell - especially your engagement with upstream on this is much appreciated!

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

Successfully merging this pull request may close these issues.

3 participants