Skip to content

Allow case-insensitive match of label-refs through intersphinx#12033

Merged
picnixz merged 1 commit intosphinx-doc:masterfrom
goerz:intersphinx-case-insensitive-labels
Mar 2, 2024
Merged

Allow case-insensitive match of label-refs through intersphinx#12033
picnixz merged 1 commit intosphinx-doc:masterfrom
goerz:intersphinx-case-insensitive-labels

Conversation

@goerz
Copy link
Contributor

@goerz goerz commented Mar 2, 2024

Look up :std:label: object types case-insensitively in an intersphinx inventory. This is needed because ref and numref references (which both resolve to :std:label:) are case insensitive. They lowercase their target under the assumption that the target name in any inventory file is also lowercased.

That assumption holds for labels in inventory files generated by Sphinx from .rst files, since it generates lowercase labels. However, other documentation generators (such as the Julia Documenter.jl, which also writes objects.inv inventory files as of version 1.3) use mixed-case labels for section title.

With the change in this commit, if the lowercase label cannot be found in the inventory, also try a case-insensitive match.

This PR is an alternative to #12009.

It uses the same resolution as was implemented in #9299 for the similar issue #9291 for :term: references.

Closes #12008

Copy link
Member

@picnixz picnixz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Can you add a CHANGES entry please?

Look up `:std:label:` object types case-insensitively in an intersphinx
inventory. This is needed because `ref` and `numref` references (which
both resolve to `:std:label:`) are case insensitive. They lowercase
their target under the assumption that the target name in any inventory
file is also lowercased.

That assumption holds for labels in inventory files generated by Sphinx
from `.rst` files, since it generates lowercase labels. However, other
documentation generators (such as the Julia Documenter.jl, which
also writes `objects.inv` inventory files as of version 1.3) use
mixed-case labels for section title.

With the change in this commit, if the lowercase label cannot be found
in the inventory, also try a case-insensitive match.

See sphinx-doc#12008
@goerz goerz force-pushed the intersphinx-case-insensitive-labels branch from 05223e0 to fcf9c53 Compare March 2, 2024 11:28
@goerz
Copy link
Contributor Author

goerz commented Mar 2, 2024

Done. Switched list of case-insensitive types to set and updated CHANGES

@picnixz picnixz merged commit 265ffee into sphinx-doc:master Mar 2, 2024
@picnixz
Copy link
Member

picnixz commented Mar 2, 2024

Thank you! in the future, don't force push since we squash-merge anyway (sometimes it is easier to review without a force-push).

@goerz goerz deleted the intersphinx-case-insensitive-labels branch March 2, 2024 11:48
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 6, 2024
@AA-Turner AA-Turner added this to the 7.3.0 milestone Jul 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Intersphinx cannot link to section headers with uppercase names

3 participants