MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / get_html_page

Function get_html_page

tools/python-3.11.9-amd64/Lib/pydoc.py:2717–2755  ·  view source on GitHub ↗

Generate an HTML page for url.

(url)

Source from the content-addressed store, hash-verified

2715 return "Error - %s" % url, contents
2716
2717 def get_html_page(url):
2718 """Generate an HTML page for url."""
2719 complete_url = url
2720 if url.endswith('.html'):
2721 url = url[:-5]
2722 try:
2723 if url in ("", "index"):
2724 title, content = html_index()
2725 elif url == "topics":
2726 title, content = html_topics()
2727 elif url == "keywords":
2728 title, content = html_keywords()
2729 elif '=' in url:
2730 op, _, url = url.partition('=')
2731 if op == "search?key":
2732 title, content = html_search(url)
2733 elif op == "topic?key":
2734 # try topics first, then objects.
2735 try:
2736 title, content = html_topicpage(url)
2737 except ValueError:
2738 title, content = html_getobj(url)
2739 elif op == "get?key":
2740 # try objects first, then topics.
2741 if url in ("", "index"):
2742 title, content = html_index()
2743 else:
2744 try:
2745 title, content = html_getobj(url)
2746 except ValueError:
2747 title, content = html_topicpage(url)
2748 else:
2749 raise ValueError('bad pydoc url')
2750 else:
2751 title, content = html_getobj(url)
2752 except Exception as exc:
2753 # Catch any errors and display them in an error page.
2754 title, content = html_error(complete_url, exc)
2755 return html.page(title, content)
2756
2757 if url.startswith('/'):
2758 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.80
partitionMethod · 0.80
pageMethod · 0.45

Tested by

no test coverage detected