Skip to content

Commit

Permalink
Merge pull request #184 from m-rossi/more-nonascii-fixes
Browse files Browse the repository at this point in the history
Fix nonascii object names
  • Loading branch information
pllim committed Feb 15, 2024
2 parents 56f69fe + 5ab68d0 commit 2963d43
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Expand Up @@ -8,6 +8,8 @@ Changes in sphinx-automodapi

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

- Fixed issue with non-ascii characters in object names. [#184]

0.16.0 (2023-08-17)
-------------------

Expand Down
2 changes: 1 addition & 1 deletion sphinx_automodapi/automodsumm.py
Expand Up @@ -291,7 +291,7 @@ def process_automodsumm_generation(app):
if app.config.automodsumm_writereprocessed:
if lines: # empty list means no automodsumm entry is in the file
outfn = os.path.join(app.srcdir, sfn) + '.automodsumm'
with open(outfn, 'w') as f:
with open(outfn, 'w', encoding='utf8') as f:
for l in lines: # noqa: E741
f.write(l)
f.write('\n')
Expand Down
@@ -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

Expand Down
Expand Up @@ -11,5 +11,5 @@
.. autosummary::
:toctree: api

NonAscii
NonAsciiÄöüßő

4 changes: 2 additions & 2 deletions 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 äöüß
Expand Down
6 changes: 3 additions & 3 deletions sphinx_automodapi/utils.py
Expand Up @@ -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*$')
Expand Down

0 comments on commit 2963d43

Please sign in to comment.