Open
Description
Expected Behavior
When dealing with docstrings at the module level and the class level, pdoc3
should include the valid source code for the class in the rendered HTML, regardless of what is in module-level docstrings.
Actual Behavior
Including a section name in the module-level docstring that matches the name of a class to be documented causes pdoc3
to fail to parse the source and as a result fail to include it in the rendered HTML.
Steps to Reproduce
- Create file
min_working_example.py
:
"""Module docstring.
Some additional text.
class ABC
---------
This header creates the problem.
class `DEF`
-----------
This header does not create a problem.
"""
from __future__ import absolute_import
from __future__ import unicode_literals
__all__ = ["ABC", "DEF"]
class ABC:
"""ABC class docstring."""
def __init__(self):
"""Construct object."""
self.name = "ABC"
class DEF:
"""DEF class docstring."""
def __init__(self):
"""Construct object."""
self.name = "DEF"
- Run
pdoc3 --html min_working_example
which yields the following error:
~/.local/lib/python3.6/site-packages/pdoc/__init__.py:227: UserWarning: Couldn't get/parse source of '<Class 'min_working_example.ABC'>'
warn("Couldn't get/parse source of '{!r}'".format(doc_obj))
Additional info
- pdoc version: 0.7.2
May be related to References stop working after code blocks #134 and Linking to other identifiers does not work after "foobar
" is introduced #106