From bb6d65ee942068eba79076cccf7861110d9c6007 Mon Sep 17 00:00:00 2001 From: Marco Rossi Date: Wed, 14 Feb 2024 13:40:18 +0100 Subject: [PATCH] Fix nonascii object names --- ...ascii.NonAscii\303\204\303\266\303\274\303\237.rst" | 10 +++++----- .../tests/cases/non_ascii/output/index.rst.automodsumm | 2 +- sphinx_automodapi/tests/example_module/nonascii.py | 4 ++-- sphinx_automodapi/utils.py | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) rename sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.example_module.nonascii.NonAscii.rst => "sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.example_module.nonascii.NonAscii\303\204\303\266\303\274\303\237.rst" (65%) diff --git a/sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.example_module.nonascii.NonAscii.rst "b/sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.example_module.nonascii.NonAscii\303\204\303\266\303\274\303\237.rst" similarity index 65% rename from sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.example_module.nonascii.NonAscii.rst rename to "sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.example_module.nonascii.NonAscii\303\204\303\266\303\274\303\237.rst" index 1ea0c55..f4e8056 100644 --- a/sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.example_module.nonascii.NonAscii.rst +++ "b/sphinx_automodapi/tests/cases/non_ascii/output/api/sphinx_automodapi.tests.example_module.nonascii.NonAscii\303\204\303\266\303\274\303\237.rst" @@ -1,17 +1,17 @@ -NonAscii -======== +NonAsciiÄöüß +============ .. currentmodule:: sphinx_automodapi.tests.example_module.nonascii -.. autoclass:: NonAscii +.. autoclass:: NonAsciiÄöüß :show-inheritance: .. rubric:: Methods Summary .. autosummary:: - ~NonAscii.get_ß - ~NonAscii.get_äöü + ~NonAsciiÄöüß.get_ß + ~NonAsciiÄöüß.get_äöü .. rubric:: Methods Documentation diff --git a/sphinx_automodapi/tests/cases/non_ascii/output/index.rst.automodsumm b/sphinx_automodapi/tests/cases/non_ascii/output/index.rst.automodsumm index fb4ef02..d0cc103 100644 --- a/sphinx_automodapi/tests/cases/non_ascii/output/index.rst.automodsumm +++ b/sphinx_automodapi/tests/cases/non_ascii/output/index.rst.automodsumm @@ -11,5 +11,5 @@ .. autosummary:: :toctree: api - NonAscii + NonAsciiÄöüß diff --git a/sphinx_automodapi/tests/example_module/nonascii.py b/sphinx_automodapi/tests/example_module/nonascii.py index ccded8e..7fa4f1a 100644 --- a/sphinx_automodapi/tests/example_module/nonascii.py +++ b/sphinx_automodapi/tests/example_module/nonascii.py @@ -1,7 +1,7 @@ -__all__ = ['NonAscii'] +__all__ = ['NonAsciiÄöüß'] -class NonAscii(object): +class NonAsciiÄöüß(object): def get_äöü(self): """ Return a string with common umlauts like äöüß diff --git a/sphinx_automodapi/utils.py b/sphinx_automodapi/utils.py index 57c68cd..4512cf9 100644 --- a/sphinx_automodapi/utils.py +++ b/sphinx_automodapi/utils.py @@ -125,10 +125,10 @@ def find_autosummary_in_lines_for_automodsumm(lines, module=None, filename=None) """ autosummary_re = re.compile(r'^(\s*)\.\.\s+autosummary::\s*') automodule_re = re.compile( - r'^\s*\.\.\s+automodule::\s*([A-Za-z0-9_.]+)\s*$') + r'^\s*\.\.\s+automodule::\s*([A-Za-zäüöÄÜÖß0-9_.]+)\s*$') module_re = re.compile( - r'^\s*\.\.\s+(current)?module::\s*([a-zA-Z0-9_.]+)\s*$') - autosummary_item_re = re.compile(r'^\s+(~?[_a-zA-Z][a-zA-Z0-9_.]*)\s*.*?') + r'^\s*\.\.\s+(current)?module::\s*([a-zA-ZäüöÄÜÖß0-9_.]+)\s*$') + autosummary_item_re = re.compile(r'^\s+(~?[_a-zA-ZäüöÄÜÖß][a-zA-ZäüöÄÜÖß0-9_.]*)\s*.*?') toctree_arg_re = re.compile(r'^\s+:toctree:\s*(.*?)\s*$') template_arg_re = re.compile(r'^\s+:template:\s*(.*?)\s*$') inherited_members_arg_re = re.compile(r'^\s+:inherited-members:\s*$')