Skip to content

gettext: Extract indented doctest blocks - #14632

Open
jdillard wants to merge 1 commit into
sphinx-doc:masterfrom
jdillard:fix-12871-gettext-doctest
Open

gettext: Extract indented doctest blocks#14632
jdillard wants to merge 1 commit into
sphinx-doc:masterfrom
jdillard:fix-12871-gettext-doctest

Conversation

@jdillard

@jdillard jdillard commented Aug 22, 2026

Copy link
Copy Markdown
Member

Purpose

Docutils does not set source metadata on doctest blocks nested in block quotes, which is how indented doctest blocks are parsed. Consequently, gettext skips these blocks even when doctest-block is enabled in gettext_additional_targets. Docutils tracks the underlying inconsistent source and line metadata in feature request #41.

Extend the existing source-metadata workaround for literal blocks to cover doctest blocks, and add regression coverage. Sphinx still needs this workaround for supported Docutils releases.

Note

Prefer merging #14633 first because it removes the obsolete literal-block workaround modified by this PR. Afterward, this PR can rebase to add a doctest_block-only workaround.

References

AI Disclosure

AI was used to investigate the root cause and draft the implementation. I reviewed and validated the changes.

@jdillard jdillard added the docutils Tags upstream Docutils issues label Aug 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docutils Tags upstream Docutils issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gettext builder not extracting content of doctest blocks

1 participant