Przeglądaj źródła

add function docs to search index

Rodja Trappe 1 rok temu
rodzic
commit
56287543ac
2 zmienionych plików z 25 dodań i 20 usunięć
  1. 6 0
      website/build_search_index.py
  2. 19 20
      website/static/search_index.json

+ 6 - 0
website/build_search_index.py

@@ -1,5 +1,6 @@
 #!/usr/bin/env python3
 #!/usr/bin/env python3
 import ast
 import ast
+import inspect
 import json
 import json
 import os
 import os
 import re
 import re
@@ -74,6 +75,11 @@ class DocVisitor(ast.NodeVisitor):
             if docstring is None:
             if docstring is None:
                 api = getattr(ui, self.topic) if hasattr(ui, self.topic) else getattr(app, self.topic)
                 api = getattr(ui, self.topic) if hasattr(ui, self.topic) else getattr(app, self.topic)
                 docstring = api.__doc__ or api.__init__.__doc__
                 docstring = api.__doc__ or api.__init__.__doc__
+                for name, method in api.__dict__.items():
+                    if not name.startswith('_') and inspect.isfunction(method):
+                        # add method name to docstring
+                        docstring += name + ' '
+                        docstring += method.__doc__ or ''
             lines = cleanup(docstring).splitlines()
             lines = cleanup(docstring).splitlines()
             self.add_to_search_index(lines[0], lines[1:], main=True)
             self.add_to_search_index(lines[0], lines[1:], main=True)
 
 

Plik diff jest za duży
+ 19 - 20
website/static/search_index.json


Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików