-
Notifications
You must be signed in to change notification settings - Fork 44
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
:cite:ref1,ref2
: put the two references in the same bracket?
#94
Comments
If you're familiar with latex, then yes that's a sensible suggestion. However, does sphinx supports this for standard docutils citations? I think not (but if I'm wrong, tell me!), so this would have to be implemented into upstream sphinx first. I'm not sure how that would have to work, as docutils itself also doesn't support this sort of formatting out of the box. So it's probably possible, but it probably also takes quite a lot of upstream work and convincing. |
@mcmtroffaes Can you tell me what is the standard docutils citation? |
Simply something like: Here's a standard restructured text citation [CIT2002]_.
.. [CIT2002] Title, author, year... The sphinxcontrib-bibtex extension essentially converts |
@mcmtroffaes Thanks for your explanation. I tried to include two citations in a bracket, the following seems working: [this_, that_]
.. [this] here
.. [that] there
In my opinion, this is enough to implement the features. What do you think? |
Thanks for looking into what we can do with docutils. I think these are not citations but regular references; does the latex backend produce an actual bibliography for these? |
Oh actually reading the docs they are citations. 💃 I wonder whether this will jive well with latex; I suspect it may just produce something like |
I've verified that the LaTeX output is consistent with the html output :-) |
Many thanks for doing the research. It looks like you uncovered a deep undocumented feature of docutils, pretty impressive! ;-) I'll try to see if I can find out how to generate the proper nodes in docutils to achieve the same effect with the extension. |
@mcmtroffaes This feature is actually documented in the example here -- see the final "this" in the example. |
@mcmtroffaes It seems that sphinx explicitly transforms any citation reference to the bracket format: Is it possible to generate |
Great find! Yes, maybe that's exactly what we should do. I'm a bit hesitant to override any of sphinx's clever magic, but if we can somehow "inject" our own transforms, that would be pretty cool. Judging from the priority on Sphinx's transform, if we add one at priority 618, that should do the trick. There's nothing at that priority in Sphinx at the moment: https://github.com/sphinx-doc/sphinx/search?utf8=%E2%9C%93&q=618&type=Code |
@mcmtroffaes @xuhdev did you get anywhere with this? We would also like to be able to represent multiple citations as [i,j,k,...] |
Bringing this back from 3.5 years in the past. |
…multiple cites into the same bracket. Should close issue #94.
Glad to report this has now been implemented as part of #219 which hopefully will get merged soon. That PR switches to our own fully custom node generation rather than relying on docutils/sphinx to manipulate the doctree and resolve references, making this feature request easy to implement. |
* Use check_consistency to identify all citation cross-references, use resolve_xref for citation references, and SphinxPostTransform for bibliography citations, so that bibtex.json no longer needed and thus Sphinx no longer needs to run twice as in the past if the file did not exist (closes issues #214 #215). * Citations with multiple keys will now reside in the same bracket (closes issue #94). * Consistent use of doctutils note_explicit_target to set ids, to ensure no clashing ids. * Improved and robustified test suit, using regular expressions to verify generated html. * Various API updates to accommodate the new design.
Maybe this is my bias, but when I wrote
:cite:
ref1,ref2`` I would expect something like the following output:[ref1,ref2]
instead of
[ref1][ref2]
.[ref1,ref2]
looks common in papers --- when people want[ref1][ref2]
, they put them into two different cites. Can we make the change in this extension? Thanks!The text was updated successfully, but these errors were encountered: