Skip to content

Commit

Permalink
[autosummary] fix suffix detection (#12149)
Browse files Browse the repository at this point in the history
Fix a bug whereby the wrong file extension may be used,
when multiple suffixes are specified in the `source_suffix` configuration.

Co-authored-by: Chris Sewell <chrisj_sewell@hotmail.com>
  • Loading branch information
kou and chrisjsewell committed Mar 22, 2024
1 parent 6c92c5c commit 982679e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ Bugs fixed
Patch by James Addison.
* #11578: HTML Search: Order non-main index entries after other results.
Patch by Brad King.
* #12147: autosummary: Fix a bug whereby the wrong file extension
may be used,
when multiple suffixes are specified in :confval:`source_suffix`.
Patch by Sutou Kouhei.

Testing
-------
Expand Down
2 changes: 1 addition & 1 deletion sphinx/ext/autosummary/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ def run(self) -> tuple[list[Node], list[system_message]]:

def get_rst_suffix(app: Sphinx) -> str | None:
def get_supported_format(suffix: str) -> tuple[str, ...]:
parser_class = app.registry.get_source_parsers().get(suffix)
parser_class = app.registry.get_source_parsers().get(suffix.removeprefix('.'))
if parser_class is None:
return ('restructuredtext',)
return parser_class.supported
Expand Down

0 comments on commit 982679e

Please sign in to comment.