Repository navigation
Conversation
|
Fixed the CI failures — ready for re-review! 🙏 The Verified locally: ruff clean on all touched lines, plus |
759f33c to
f1a0270
Compare
|
I have rebased this PR onto the latest What was done
All 195 related tests pass locally (Python 3.12, docutils 0.22, Pygments 2.21). Happy to adjust anything — in particular, let me know if you would prefer the Pygments test fix to be dropped from this PR once #14674 merges. |
|
Follow-up on the new head: the For completeness, the remaining red jobs on this branch are pre-existing and unrelated:
|
|
Follow-up on the new head: the For completeness, the remaining red jobs on this branch are pre-existing and unrelated:
|
Added source_language config option. Set lang attribute on untranslated nodes for WCAG 3.1.2 compliance. Closes sphinx-doc#13841
The starttag override was accidentally defined as a module-level function (where bare super() is illegal and the implicit-missing return broke the str contract), so ruff/mypy/pyright/ty all flagged it. Move it into HTML5Translator with the docutils signature (node, tagname, suffix, empty, **atts) and always delegate to super().starttag(). Also drop a redundant condition in i18n.py (already inside the untranslated else-branch).
- tests/test_intl: test_source_language_lang_attr — asserts the lang attribute lands on untranslated elements (doctree + HTML output) - doc/usage/configuration.rst: document the new source_language confval - CHANGES.rst: add the entry under 9.1.1 Features added
b02ea09 to
19107bc
Compare
|
Rebased on current master, conflicts resolved. The redundant Pygments-expectation cherry-pick is dropped (upstream #14611 now covers it); kept the source_language feature, test_source_language_lang_attr, docs, and CHANGES entry. ruff format clean on touched files. Note: Docutils-HEAD and LaTeX CI failures are pre-existing (#14673), not related to this change. |
|
|
Rebased on current master. Verified: Docutils-HEAD and LaTeX failures are pre-existing (#14673) — same TypeError signature on clean master without my changes. The Python 3.12 (Docutils 0.21) run shows 1 unrelated failure (test_numfig_disabled_warn, numfig warning assertion — not i18n/lang); touched test test_source_language_lang_attr passes locally, ruff format clean, ruff check shows only pre-existing noqa-style findings outside this diff. |
|
Thank you for the patience on CI. Update on head a1f6b36 (retrigger):
I pushed an empty commit to retrigger CI after the earlier LaTeX failure. Happy to address any concerns on the |
Added
source_languageconfig option andlangattribute onuntranslated nodes for WCAG SC 3.1.2 compliance.
Problem
When working with mixed-language web content, HTML elements should use
the
langattribute to define their language if it differs from the<html>page language. Without this, documentation produced with Sphinxfails WCAG SC 3.1.2 Language of Parts.
Changes
config.py— Addedsource_languageconfig option (default:"en")transforms/i18n.py— Setnode['lang']tosource_languageonuntranslated nodes in
AddTranslationClasseswriters/html5.py— Overridestarttag()inHTML5Translatortorespect node
langattributeResult
Before:
After:
References
Closes #13841