MCPcopy Index your code
hub / github.com/RustPython/RustPython / html_topicpage

Function html_topicpage

Lib/pydoc.py:2627–2650  ·  view source on GitHub ↗

Topic or keyword help page.

(topic)

Source from the content-addressed store, hash-verified

2625 return 'Keywords', contents
2626
2627 def html_topicpage(topic):
2628 """Topic or keyword help page."""
2629 buf = io.StringIO()
2630 htmlhelp = Helper(buf, buf)
2631 contents, xrefs = htmlhelp._gettopic(topic)
2632 if topic in htmlhelp.keywords:
2633 title = 'KEYWORD'
2634 else:
2635 title = 'TOPIC'
2636 heading = html.heading(
2637 '<strong class="title">%s</strong>' % title,
2638 )
2639 contents = '<pre>%s</pre>' % html.markup(contents)
2640 contents = html.bigsection(topic , 'index', contents)
2641 if xrefs:
2642 xrefs = sorted(xrefs.split())
2643
2644 def bltinlink(name):
2645 return '<a href="topic?key=%s">%s</a>' % (name, name)
2646
2647 xrefs = html.multicolumn(xrefs, bltinlink)
2648 xrefs = html.section('Related help topics: ', 'index', xrefs)
2649 return ('%s %s' % (title, topic),
2650 ''.join((heading, contents, xrefs)))
2651
2652 def html_getobj(url):
2653 obj = locate(url, forceload=1)

Callers 1

get_html_pageFunction · 0.85

Calls 10

_gettopicMethod · 0.95
sortedFunction · 0.85
bigsectionMethod · 0.80
multicolumnMethod · 0.80
HelperClass · 0.70
headingMethod · 0.45
markupMethod · 0.45
splitMethod · 0.45
sectionMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected