Search results page.
(key)
| 2564 | return 'Index of Modules', ''.join(contents) |
| 2565 | |
| 2566 | def html_search(key): |
| 2567 | """Search results page.""" |
| 2568 | # scan for modules |
| 2569 | search_result = [] |
| 2570 | |
| 2571 | def callback(path, modname, desc): |
| 2572 | if modname[-9:] == '.__init__': |
| 2573 | modname = modname[:-9] + ' (package)' |
| 2574 | search_result.append((modname, desc and '- ' + desc)) |
| 2575 | |
| 2576 | with warnings.catch_warnings(): |
| 2577 | warnings.filterwarnings('ignore') # ignore problems during import |
| 2578 | def onerror(modname): |
| 2579 | pass |
| 2580 | ModuleScanner().run(callback, key, onerror=onerror) |
| 2581 | |
| 2582 | # format page |
| 2583 | def bltinlink(name): |
| 2584 | return '<a href="%s.html">%s</a>' % (name, name) |
| 2585 | |
| 2586 | results = [] |
| 2587 | heading = html.heading( |
| 2588 | '<strong class="title">Search Results</strong>', |
| 2589 | ) |
| 2590 | for name, desc in search_result: |
| 2591 | results.append(bltinlink(name) + desc) |
| 2592 | contents = heading + html.bigsection( |
| 2593 | 'key = %s' % key, 'index', '<br>'.join(results)) |
| 2594 | return 'Search Results', contents |
| 2595 | |
| 2596 | def html_topics(): |
| 2597 | """Index of topic texts available.""" |
no test coverage detected