Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-06-18 09:26:16 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-06-18 09:26:16 +0300
commit502e6bd8395eaf3a8184118f2de51ddc9191b29d (patch)
tree4d4e90a3d93ed95b53f25882c22e9febea5c4c9e /doc/python_api/sphinx_doc_gen.py
parent3ada1949f8633293b4a424bf20789d94cf924c43 (diff)
Fix doc generation for enum & attr's with multi-line descriptions
Diffstat (limited to 'doc/python_api/sphinx_doc_gen.py')
-rw-r--r--doc/python_api/sphinx_doc_gen.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py
index d4cc1d37262..d76775d749e 100644
--- a/doc/python_api/sphinx_doc_gen.py
+++ b/doc/python_api/sphinx_doc_gen.py
@@ -83,6 +83,8 @@ import inspect
import shutil
import logging
+from textwrap import indent
+
from platform import platform
PLATFORM = platform().split('-')[0].lower() # 'linux', 'darwin', 'windows'
@@ -1196,12 +1198,15 @@ def pyrna_enum2sphinx(prop, use_empty_descriptions=False):
break
if ok:
- return "".join(["* ``%s`` %s.\n" %
- (identifier,
- ", ".join(escape_rst(val) for val in (name, description) if val),
- )
- for identifier, name, description in prop.enum_items
- ])
+ return "".join([
+ "* ``%s``\n"
+ "%s.\n" % (
+ identifier,
+ # Account for multi-line enum descriptions, allowing this to be a block of text.
+ indent(", ".join(escape_rst(val) for val in (name, description) if val) or "Undocumented", " "),
+ )
+ for identifier, name, description in prop.enum_items
+ ])
else:
return ""
@@ -1268,7 +1273,7 @@ def pyrna2sphinx(basepath):
fw(ident + ":%s%s:\n\n" % (id_name, identifier))
if prop.name or prop.description:
- fw(ident + " " + ", ".join(val for val in (prop.name, prop.description) if val) + "\n\n")
+ fw(indent(", ".join(val for val in (prop.name, prop.description) if val), ident + " ") + "\n\n")
# special exception, can't use generic code here for enums
if enum_text: