Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix nonascii object names #184

Merged
merged 6 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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Äöüß
============
m-rossi marked this conversation as resolved.
Show resolved Hide resolved

.. currentmodule:: sphinx_automodapi.tests.example_module.nonascii

.. autoclass:: NonAscii
.. autoclass:: NonAsciiÄöüß
m-rossi marked this conversation as resolved.
Show resolved Hide resolved
:show-inheritance:

.. rubric:: Methods Summary

.. autosummary::

~NonAscii.get_ß
~NonAscii.get_äöü
~NonAsciiÄöüß.get_ß
~NonAsciiÄöüß.get_äöü
m-rossi marked this conversation as resolved.
Show resolved Hide resolved

.. rubric:: Methods Documentation

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

NonAscii
NonAsciiÄöüß
m-rossi marked this conversation as resolved.
Show resolved Hide resolved

4 changes: 2 additions & 2 deletions sphinx_automodapi/tests/example_module/nonascii.py
@@ -1,7 +1,7 @@
__all__ = ['NonAscii']
__all__ = ['NonAsciiÄöüß']
m-rossi marked this conversation as resolved.
Show resolved Hide resolved


class NonAscii(object):
class NonAsciiÄöüß(object):
m-rossi marked this conversation as resolved.
Show resolved Hide resolved
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*$')
m-rossi marked this conversation as resolved.
Show resolved Hide resolved
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*.*?')
m-rossi marked this conversation as resolved.
Show resolved Hide resolved
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