Skip to content

Commit 2963d43

Browse files
authored
Merge pull request #184 from m-rossi/more-nonascii-fixes
Fix nonascii object names
2 parents 56f69fe + 5ab68d0 commit 2963d43

File tree

6 files changed

+14
-12
lines changed

6 files changed

+14
-12
lines changed

CHANGES.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Changes in sphinx-automodapi
88

99
- Minimum supported Python version is now 3.8. [#177]
1010

11+
- Fixed issue with non-ascii characters in object names. [#184]
12+
1113
0.16.0 (2023-08-17)
1214
-------------------
1315

sphinx_automodapi/automodsumm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ def process_automodsumm_generation(app):
291291
if app.config.automodsumm_writereprocessed:
292292
if lines: # empty list means no automodsumm entry is in the file
293293
outfn = os.path.join(app.srcdir, sfn) + '.automodsumm'
294-
with open(outfn, 'w') as f:
294+
with open(outfn, 'w', encoding='utf8') as f:
295295
for l in lines: # noqa: E741
296296
f.write(l)
297297
f.write('\n')
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
NonAscii
2-
========
1+
NonAsciiÄöüßő
2+
=============
33

44
.. currentmodule:: sphinx_automodapi.tests.example_module.nonascii
55

6-
.. autoclass:: NonAscii
6+
.. autoclass:: NonAsciiÄöüßő
77
:show-inheritance:
88

99
.. rubric:: Methods Summary
1010

1111
.. autosummary::
1212

13-
~NonAscii.get_ß
14-
~NonAscii.get_äöü
13+
~NonAsciiÄöüßő.get_ß
14+
~NonAsciiÄöüßő.get_äöü
1515

1616
.. rubric:: Methods Documentation
1717

sphinx_automodapi/tests/cases/non_ascii/output/index.rst.automodsumm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
.. autosummary::
1212
:toctree: api
1313

14-
NonAscii
14+
NonAsciiÄöüßő
1515

sphinx_automodapi/tests/example_module/nonascii.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
__all__ = ['NonAscii']
1+
__all__ = ['NonAsciiÄöüßő']
22

33

4-
class NonAscii(object):
4+
class NonAsciiÄöüßő(object):
55
def get_äöü(self):
66
"""
77
Return a string with common umlauts like äöüß

sphinx_automodapi/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,10 @@ def find_autosummary_in_lines_for_automodsumm(lines, module=None, filename=None)
125125
"""
126126
autosummary_re = re.compile(r'^(\s*)\.\.\s+autosummary::\s*')
127127
automodule_re = re.compile(
128-
r'^\s*\.\.\s+automodule::\s*([A-Za-z0-9_.]+)\s*$')
128+
r'^\s*\.\.\s+automodule::\s*([A-Za-zäüöÄÜÖßő0-9_.]+)\s*$')
129129
module_re = re.compile(
130-
r'^\s*\.\.\s+(current)?module::\s*([a-zA-Z0-9_.]+)\s*$')
131-
autosummary_item_re = re.compile(r'^\s+(~?[_a-zA-Z][a-zA-Z0-9_.]*)\s*.*?')
130+
r'^\s*\.\.\s+(current)?module::\s*([a-zA-ZäüöÄÜÖßő0-9_.]+)\s*$')
131+
autosummary_item_re = re.compile(r'^\s+(~?[_a-zA-ZäüöÄÜÖßő][a-zA-ZäüöÄÜÖßő0-9_.]*)\s*.*?')
132132
toctree_arg_re = re.compile(r'^\s+:toctree:\s*(.*?)\s*$')
133133
template_arg_re = re.compile(r'^\s+:template:\s*(.*?)\s*$')
134134
inherited_members_arg_re = re.compile(r'^\s+:inherited-members:\s*$')

0 commit comments

Comments
 (0)