Repository navigation
PEP 635: fix duplicate labels - #2742
Conversation
gvanrossum
left a comment
There was a problem hiding this comment.
LG (although I think it's a silly requirement that labels must be unique across all PEPs -- it doesn't scale).
|
It is a little tedious, but the whole point of Sphinx cross-references is to be able to cross reference objects across documents, even if things get moved around—the solution here is namespacing the target names by the PEP number, which still preserves the generated in-page fragments without the number. That's what the Python docs do as well, though its not as clean as here (since they have to rely on full page titles, and which don't get auto-elided). |
|
A PEP shouldn’t have to repeat its own local namespace though IMO. (But I don’t know what Sphinx is capable of.) |
|
This works for references to, e.g., classes, functions and methods, since they are globally unique when fully qualified and don't depend on the file structure, but not so generic Here "namespaces" are only a convention, which can be flexible applied on a per-project (or even per-reference) basis—there is no formalized mechanism for automatic per-document namespacing. Outside of special cases like ours, it wouldn't really work well as it would defeat much of the portability and robustness of We could possibly implement bespoke hacks in a custom ref role and the PEP transforms to do something like this, but this might just be more trouble for authors than its worth since they might expect the standard behavior, like in the |
Fix these warnings:
Like #2735, we still get the same anchors in both:
Also remove redundant emacs metadata.
Preview
https://pep-previews--2742.org.readthedocs.build/pep-0635/