Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Docs HTML: Remove self-closing tags#132220

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
hugovk merged 2 commits intopython:mainfromhugovk:deslash
Apr 7, 2025
Merged

Conversation

hugovk
Copy link
Member

@hugovkhugovk commentedApr 7, 2025
edited by github-actionsbot
Loading

Self-closing tags (<tag />) do not exist in HTML.

If a trailing/ (slash) character is present in the start tag of an HTML element, HTML parsers ignore that slash character. This is especially important to remember for elements such as<script> or<ul> that do require a closing tag. In these cases, adding a trailing slash in the start tag does not close the element. Instead, the trailing slash is ignored, and the element is treated as open until an explicit closing tag is encountered or until the parser implicitly closes the element based on the HTML structure and parsing rules. For example, in the case of<div/>Some text, browsers interpret this as<div>Some text</div>, treating the slash as ignored and considering the div element to encapsulate the text that follows.

https://developer.mozilla.org/en-US/docs/Glossary/Void_element#self-closing_tags

Let's omit them: they're ignored, could be misleading (give the false impression they do something when they do not) and are ugly (IMO).


📚 Documentation preview 📚:https://cpython-previews--132220.org.readthedocs.build/

@picnixz
Copy link
Member

I think we have self-closing tags in Sphinx' writers so we should also fix this upstream.

@AA-TurnerAA-Turner requested a review froma team as acode ownerApril 7, 2025 15:14
@hugovkhugovk merged commitce72457 intopython:mainApr 7, 2025
24 checks passed
@hugovkhugovk deleted the deslash branchApril 7, 2025 15:21
@miss-islington-app
Copy link

Thanks@hugovk for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Sorry,@hugovk, I could not cleanly backport this to3.13 due to a conflict.
Please backport usingcherry_picker on command line.

cherry_picker ce724571b35f4e79fff1c862fcd9afa4c26b605f 3.13

@miss-islington-app
Copy link

Sorry,@hugovk, I could not cleanly backport this to3.12 due to a conflict.
Please backport usingcherry_picker on command line.

cherry_picker ce724571b35f4e79fff1c862fcd9afa4c26b605f 3.12

hugovk added a commit to hugovk/cpython that referenced this pull requestApr 7, 2025
(cherry picked from commitce72457)Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
@bedevere-app
Copy link

GH-132228 is a backport of this pull request to the3.13 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.13bugs and security fixes labelApr 7, 2025
hugovk added a commit to hugovk/cpython that referenced this pull requestApr 7, 2025
(cherry picked from commitce72457)Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
@bedevere-app
Copy link

GH-132229 is a backport of this pull request to the3.12 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.12only security fixes labelApr 7, 2025
AA-Turner added a commit that referenced this pull requestApr 7, 2025
(cherry picked from commitce72457)Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
AA-Turner added a commit that referenced this pull requestApr 7, 2025
(cherry picked from commitce72457)Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
seehwan pushed a commit to seehwan/cpython that referenced this pull requestApr 16, 2025
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
@m-aciek
Copy link
Contributor

Change inDoc/tools/templates/layout.html breaks EPUBs. Maybe we should add it only when the builder ishtml?

% uvx epubcheck…FATAL - RSC-016 - Python.epub/c-api/codec.xhtml:27:5 - Fatal Error while parsing file: The element type "link" must be terminated by the matching end-tag "</link>".FATAL - RSC-016 - Python.epub/c-api/complex.xhtml:27:5 - Fatal Error while parsing file: The element type "link" must be terminated by the matching end-tag "</link>".FATAL - RSC-016 - Python.epub/c-api/concrete.xhtml:27:5 - Fatal Error while parsing file: The element type "link" must be terminated by the matching end-tag "</link>".FATAL - RSC-016 - Python.epub/c-api/contextvars.xhtml:27:5 - Fatal Error while parsing file: The element type "link" must be terminated by the matching end-tag "</link>".FATAL - RSC-016 - Python.epub/c-api/conversion.xhtml:27:5 - Fatal Error while parsing file: The element type "link" must be terminated by the matching end-tag "</link>".FATAL - RSC-016 - Python.epub/c-api/coro.xhtml:27:5 - Fatal Error while parsing file: The element type "link" must be terminated by the matching end-tag "</link>".FATAL - RSC-016 - Python.epub/contents.xhtml:27:5 - Fatal Error while parsing file: The element type "link" must be terminated by the matching end-tag "</link>".FATAL - RSC-016 - Python.epub/copyright.xhtml:27:5 - Fatal Error while parsing file: The element type "link" must be terminated by the matching end-tag "</link>".FATAL - RSC-016 - Python.epub/glossary.xhtml:27:5 - Fatal Error while parsing file: The element type "link" must be terminated by the matching end-tag "</link>".FATAL - RSC-016 - Python.epub/license.xhtml:27:5 - Fatal Error while parsing file: The element type "link" must be terminated by the matching end-tag "</link>".FATAL - RSC-016 - Python.epub/py-modindex.xhtml:29:5 - Fatal Error while parsing file: The element type "link" must be terminated by the matching end-tag "</link>".FATAL - RSC-016 - Python.epub/download.xhtml:36:5 - Fatal Error while parsing file: The element type "meta" must be terminated by the matching end-tag "</meta>".FATAL - RSC-016 - Python.epub/index.xhtml:35:5 - Fatal Error while parsing file: The element type "meta" must be terminated by the matching end-tag "</meta>".

@merwok
Copy link
Member

Ah, EPUB is the holdover using XHTML… Cursed knowledge.

The templates used by HTML and EPUB builders should be kept compatible then 🙁

@m-aciek
Copy link
Contributor

I've opened#133720 with a fix proposition.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@merwokmerwokmerwok approved these changes

@AA-TurnerAA-TurnerAA-Turner approved these changes

Assignees

@hugovkhugovk

Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@hugovk@picnixz@m-aciek@merwok@AA-Turner

[8]ページ先頭

©2009-2025 Movatter.jp