Search results page.
(key)
| 2612 | return 'Index of Modules', ''.join(contents) |
| 2613 | |
| 2614 | def html_search(key): |
| 2615 | """Search results page.""" |
| 2616 | # scan for modules |
| 2617 | search_result = [] |
| 2618 | |
| 2619 | def callback(path, modname, desc): |
| 2620 | if modname[-9:] == '.__init__': |
| 2621 | modname = modname[:-9] + ' (package)' |
| 2622 | search_result.append((modname, desc and '- ' + desc)) |
| 2623 | |
| 2624 | with warnings.catch_warnings(): |
| 2625 | warnings.filterwarnings('ignore') # ignore problems during import |
| 2626 | def onerror(modname): |
| 2627 | pass |
| 2628 | ModuleScanner().run(callback, key, onerror=onerror) |
| 2629 | |
| 2630 | # format page |
| 2631 | def bltinlink(name): |
| 2632 | return '<a href="%s.html">%s</a>' % (name, name) |
| 2633 | |
| 2634 | results = [] |
| 2635 | heading = html.heading( |
| 2636 | '<strong class="title">Search Results</strong>', |
| 2637 | ) |
| 2638 | for name, desc in search_result: |
| 2639 | results.append(bltinlink(name) + desc) |
| 2640 | contents = heading + html.bigsection( |
| 2641 | 'key = %s' % key, 'index', '<br>'.join(results)) |
| 2642 | return 'Search Results', contents |
| 2643 | |
| 2644 | def html_topics(): |
| 2645 | """Index of topic texts available.""" |
no test coverage detected