8000 Glossary URLs with anchor link no longer jump to definitions · Issue #90492 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

Glossary URLs with anchor link no longer jump to definitions #90492

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

Open
treyhunner opened this issue Jan 10, 2022 · 4 comments
Open

Glossary URLs with anchor link no longer jump to definitions #90492

treyhunner opened this issue Jan 10, 2022 · 4 comments
Labels
3.10 only security fixes 3.11 only security fixes docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error

Comments

@treyhunner
Copy link
Member
BPO 46334
Nosy @rhettinger, @JulienPalard, @treyhunner, @AlexWaygood

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2022-01-10.17:20:52.535>
labels = ['3.11', 'type-bug', '3.10', 'docs']
title = 'Glossary URLs with anchor link no longer jump to definitions'
updated_at = <Date 2022-01-11.04:50:58.978>
user = 'https://github.com/treyhunner'

bugs.python.org fields:

activity = <Date 2022-01-11.04:50:58.978>
actor = 'ned.deily'
assignee = 'docs@python'
closed = False
closed_date = None
closer = None
components = ['Documentation']
creation = <Date 2022-01-10.17:20:52.535>
creator = 'trey'
dependencies = []
files = []
hgrepos = []
issue_num = 46334
keywords = []
message_count = 3.0
messages = ['410234', '410235', '410247']
nosy_count = 5.0
nosy_names = ['rhettinger', 'docs@python', 'mdk', 'trey', 'AlexWaygood']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue46334'
versions = ['Python 3.10', 'Python 3.11']

@treyhunner
Copy link
Member Author

The glossary page allows for anchor links to jump to specific definitions.

For example: https://docs.python.org/3.9/glossary.html#term-lbyl will open the glossary page with the web browser showing the LBYL at the top of the page.

This no longer works in Python 3.10 and Python 3.11 documentation.

https://docs.python.org/3.10/glossary.html#term-lbyl

https://docs.python.org/3.11/glossary.html#term-lbyl

Opening either of those links in Chrome or Firefox on my machine results in the glossary page being opened without any scrolling (the top of the glossary page is shown rather than the LBYL definition).

@treyhunner treyhunner added 3.10 only security fixes 3.11 only security fixes labels Jan 10, 2022
@treyhunner treyhunner added docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error 3.10 only security fixes 3.11 only security fixes labels Jan 10, 2022
@treyhunner treyhunner added docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error labels Jan 10, 2022
@AlexWaygood
Copy link
Member

Reproduced on safari on my iPad, as well.

@treyhunner
Copy link
Member Author

I just realized those only affects some terms.

parameter works: https://docs.python.org/3/glossary.html#term-parameter

And LBYL does work but only if LBYL was used: https://docs.python.org/3/glossary.html#term-LBYL

The EAFP term does link to #term-LBYL instead of the old #term-lbyl.

It looks like the capitalization changed. The search doesn't seem to know that though (the LBYL glossary link at the top is broken): https://docs.python.org/3/search.html?q=lbyl

I would vote for changing the link back to lowercase rather than changing the search to link to the new URL. Otherwise links to specific glossary terms scattered around the internet will all link to the top of the glossary page instead.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
@CAM-Gerlach
Copy link
Member

I would vote for changing the link back to lowercase rather than changing the search to link to the new URL. Otherwise links to specific glossary terms scattered around the internet will all link to the top of the glossary page instead.

The anchors are generated by Sphinx, so unless we implement our own hacks here, that would have to be a Sphinx change; since that was probably from back when they added support for case-sensitive glossary entries several years and 2-3 major versions ago (since 3.9 was built with Sphinx 2.4.4, 3.10 was built with 3.4.3 and 5.x is the current stable branch), so it would break other users who have adapted by now. To note, until Sphinx 3.5.0 and Python 3.11, the glossary anchors weren't copyable (there was no link or icon in the UI), people had to construct them manually, so the backward compatibility breakage is less concerning than it would have been (though still not ideal).

The immediate fix on the CPython side would be to have our custom search functionality generate the correct glossary links from 3.10+. From a quick look, the culprit appears to be the .lower() call here, which is what eventually gets used to construct the fragment in the JS on the custom search page template. We'd have to test it, though, and confirm that nothing else relies on it to be case-folded, but that at least should be a straightforward fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.10 only security fixes 3.11 only security fixes docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants
0