diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-11-25 02:24:07 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-11-25 02:24:07 +0400 |
commit | 1c6dc61d17685c48b1d7524d382eb4239d8f1b82 (patch) | |
tree | b53d76c62f9457f4f08f6fa251416f79b7de10d8 /doc/python_api/sphinx_doc_gen.py | |
parent | f8affbb98028821d87034521e90f02de93d0f75a (diff) |
blacklist language property for sphinx docs, encoding was messing up PDF generation.
Diffstat (limited to 'doc/python_api/sphinx_doc_gen.py')
-rw-r--r-- | doc/python_api/sphinx_doc_gen.py | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index fc17b9a24a5..88641bdb663 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -110,6 +110,12 @@ INFO_DOCS = ( ("info_gotcha.rst", "Gotcha's: some of the problems you may come up against when writing scripts"), ) +# only support for properties atm. +RNA_BLACKLIST = { + # messes up PDF!, really a bug but for now just workaround. + "UserPreferencesSystem": {"language", }, + } + # ----------------------------------------------------------------------------- # configure compile time options @@ -757,22 +763,23 @@ def pyrna2sphinx(BASEPATH): fw = file.write base_id = getattr(struct.base, "identifier", "") + struct_id = struct.identifier if _BPY_STRUCT_FAKE: if not base_id: base_id = _BPY_STRUCT_FAKE if base_id: - title = "%s(%s)" % (struct.identifier, base_id) + title = "%s(%s)" % (struct_id, base_id) else: - title = struct.identifier + title = struct_id write_title(fw, title, "=") fw(".. module:: bpy.types\n\n") # docs first?, ok - write_example_ref("", fw, "bpy.types.%s" % struct.identifier) + write_example_ref("", fw, "bpy.types.%s" % struct_id) base_ids = [base.identifier for base in struct.get_bases()] @@ -801,9 +808,9 @@ def pyrna2sphinx(BASEPATH): base_id = _BPY_STRUCT_FAKE if base_id: - fw(".. class:: %s(%s)\n\n" % (struct.identifier, base_id)) + fw(".. class:: %s(%s)\n\n" % (struct_id, base_id)) else: - fw(".. class:: %s\n\n" % struct.identifier) + fw(".. class:: %s\n\n" % struct_id) fw(" %s\n\n" % struct.description) @@ -811,7 +818,15 @@ def pyrna2sphinx(BASEPATH): sorted_struct_properties = struct.properties[:] sorted_struct_properties.sort(key=lambda prop: prop.identifier) + # support blacklisting props + struct_blacklist = RNA_BLACKLIST.get(struct_id, ()) + for prop in sorted_struct_properties: + + # support blacklisting props + if prop.identifier in struct_blacklist: + continue + type_descr = prop.get_type_description(class_fmt=":class:`%s`", collection_id=_BPY_PROP_COLLECTION_ID) # readonly properties use "data" directive, variables properties use "attribute" directive if 'readonly' in type_descr: @@ -860,7 +875,7 @@ def pyrna2sphinx(BASEPATH): descr = prop.name fw(" `%s`, %s, %s\n\n" % (prop.identifier, descr, type_descr)) - write_example_ref(" ", fw, "bpy.types." + struct.identifier + "." + func.identifier) + write_example_ref(" ", fw, "bpy.types." + struct_id + "." + func.identifier) fw("\n") @@ -876,7 +891,7 @@ def pyrna2sphinx(BASEPATH): py_func = None for identifier, py_func in py_funcs: - py_c_func2sphinx(" ", fw, "bpy.types", struct.identifier, identifier, py_func, is_class=True) + py_c_func2sphinx(" ", fw, "bpy.types", struct_id, identifier, py_func, is_class=True) lines = [] @@ -955,7 +970,7 @@ def pyrna2sphinx(BASEPATH): fw("\n") # docs last?, disable for now - # write_example_ref("", fw, "bpy.types.%s" % struct.identifier) + # write_example_ref("", fw, "bpy.types.%s" % struct_id) file.close() if "bpy.types" not in EXCLUDE_MODULES: |