[Lldb-commits] [PATCH] D94967: [lldb][docs] Filter out 'thisown' attribute and inheritance boilerplate
Raphael Isemann via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Jan 20 00:08:03 PST 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3c69ff4b03ab: [lldb][docs] Filter out 'thisown' attribute and inheritance boilerplate (authored by teemperor).
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D94967/new/
https://reviews.llvm.org/D94967
Files:
lldb/docs/conf.py
Index: lldb/docs/conf.py
===================================================================
--- lldb/docs/conf.py
+++ lldb/docs/conf.py
@@ -298,3 +298,36 @@
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
+
+empty_attr_summary = re.compile(r'\.\. rubric:: Attributes Summary\s*\.\. autosummary::\s*\.\. rubric::')
+empty_attr_documentation = re.compile(r'\.\. rubric:: Attributes Documentation\s*\.\. rubric::')
+
+def cleanup_source(app, docname, source):
+ """ Cleans up source files generated by automodapi. """
+ # Don't cleanup anything beside automodapi-generated sources.
+ if not automodapi_toctreedirnm in docname:
+ return
+ processed = source[0]
+
+ # Don't show the list of inheritance info as there is no inheritance in the
+ # SBI API. This avoids all the repeated text on all doc pages that a
+ # class inherits from 'object'.
+
+ processed = processed.replace(":show-inheritance:", "")
+ # Remove the SWIG generated 'thisown' attribute. It just bloats the generated
+ # documentation and users shouldn't fiddle with the value anyway.
+ processed = re.sub(r'~SB[a-zA-Z]+\.thisown', "", processed)
+ processed = processed.replace(" .. autoattribute:: thisown", "")
+
+ # After removing 'thisown', many objects don't have any attributes left.
+ # Remove all now empty attribute summary/documentation sections with
+ # some rather ugly regex.
+ processed = empty_attr_summary.sub('.. rubric::', processed)
+ processed = empty_attr_documentation.sub('.. rubric::', processed)
+
+ # Replace the original source with the processed one (source is a single
+ # element list).
+ source[0] = processed
+
+def setup(app):
+ app.connect('source-read', cleanup_source)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94967.317791.patch
Type: text/x-patch
Size: 1792 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210120/e5f9303e/attachment-0001.bin>
More information about the lldb-commits
mailing list