Skip to content

Commit

Permalink
Fixed #4
Browse files Browse the repository at this point in the history
  • Loading branch information
http-samc committed Jun 22, 2021
1 parent fc8021e commit b7c1775
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions gen_doc/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def extractDocStrings(filepath: str, parent: str = None, classSections: bool = F

if not isinstance(node, list):
functionDocString = ast.get_docstring(node)
if fence: functionDocString = f"```Python\n{functionDocString}\n```"
if fence and functionDocString: functionDocString = f"```Python\n{functionDocString}\n```"

if functionDocString is None and excludeDocless: continue
retStr += f"### {relPathFormatted}.`{node.name}` [function]\n"
Expand Down Expand Up @@ -155,7 +155,8 @@ def extractDocStrings(filepath: str, parent: str = None, classSections: bool = F
del node[0] # Removing top-level ClassDef, only iterating through class' nodes
for function in node:
functionDocString = ast.get_docstring(function)
if fence: functionDocString = f"```Python\n{functionDocString}\n```"
if fence and functionDocString: functionDocString = f"```Python\n{functionDocString}\n```"


if functionDocString is None and excludeDocless: continue
functionName = function.name.replace('_', '\_') # preventing MD from turning __func__ to *func*
Expand Down

0 comments on commit b7c1775

Please sign in to comment.