Skip to content

Commit

Permalink
BUG: Allow wrapped lines in "See also" numpy section (#141)
Browse files Browse the repository at this point in the history
* allow wrapped lines in "see also" numpy section

* minor update

Co-authored-by: kernc <kerncece@gmail.com>
  • Loading branch information
poke1024 and kernc committed Jan 12, 2020
1 parent d6eca2a commit 30ca5ef
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions pdoc/html_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ def _numpy_sections(match):
"""
section, body = match.groups()
if section.title() == 'See Also':
body = re.sub(r'\n\s{4}\s*', ' ', body) # Handle line continuation
body = re.sub(r'^((?:\n?[\w.]* ?: .*)+)|(.*\w.*)',
_ToMarkdown._numpy_seealso, body)
elif section.title() in ('Returns', 'Yields', 'Raises', 'Warns'):
Expand Down
2 changes: 2 additions & 0 deletions pdoc/test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,8 @@ def test_numpy(self):
<dd>Function a with its description.</dd>
<dt><a><code>scipy.random.norm</code></a></dt>
<dd>Random variates, PDFs, etc.</dd>
<dt><a><code>pdoc.Doc</code></a></dt>
<dd>A class description that spans several lines.</dd>
</dl>
<h2 id="notes">Notes</h2>
<p>Foo bar.</p>
Expand Down
2 changes: 2 additions & 0 deletions pdoc/test/example_pkg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ def numpy(self):
--------
pdoc.text : Function a with its description.
scipy.random.norm : Random variates, PDFs, etc.
pdoc.Doc : A class description that
spans several lines.
Notes
-----
Expand Down

0 comments on commit 30ca5ef

Please sign in to comment.