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

Function get_html_page

Lib/pydoc.py:2669–2707  ·  view source on GitHub ↗

Generate an HTML page for url.

(url)

Source from the content-addressed store, hash-verified

2667 return "Error - %s" % url, contents
2668
2669 def get_html_page(url):
2670 """Generate an HTML page for url."""
2671 complete_url = url
2672 if url.endswith('.html'):
2673 url = url[:-5]
2674 try:
2675 if url in ("", "index"):
2676 title, content = html_index()
2677 elif url == "topics":
2678 title, content = html_topics()
2679 elif url == "keywords":
2680 title, content = html_keywords()
2681 elif '=' in url:
2682 op, _, url = url.partition('=')
2683 if op == "search?key":
2684 title, content = html_search(url)
2685 elif op == "topic?key":
2686 # try topics first, then objects.
2687 try:
2688 title, content = html_topicpage(url)
2689 except ValueError:
2690 title, content = html_getobj(url)
2691 elif op == "get?key":
2692 # try objects first, then topics.
2693 if url in ("", "index"):
2694 title, content = html_index()
2695 else:
2696 try:
2697 title, content = html_getobj(url)
2698 except ValueError:
2699 title, content = html_topicpage(url)
2700 else:
2701 raise ValueError('bad pydoc url')
2702 else:
2703 title, content = html_getobj(url)
2704 except Exception as exc:
2705 # Catch any errors and display them in an error page.
2706 title, content = html_error(complete_url, exc)
2707 return html.page(title, content)
2708
2709 if url.startswith('/'):
2710 url = url[1:]

Callers 1

_url_handlerFunction · 0.85

Calls 10

html_indexFunction · 0.85
html_topicsFunction · 0.85
html_keywordsFunction · 0.85
html_searchFunction · 0.85
html_topicpageFunction · 0.85
html_getobjFunction · 0.85
html_errorFunction · 0.85
endswithMethod · 0.45
partitionMethod · 0.45
pageMethod · 0.45

Tested by

no test coverage detected